Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong results when bumping version major and minor. #19

Open
sbotman opened this issue Nov 1, 2013 · 1 comment
Open

Wrong results when bumping version major and minor. #19

sbotman opened this issue Nov 1, 2013 · 1 comment

Comments

@sbotman
Copy link
Contributor

sbotman commented Nov 1, 2013

Bumping version with -M -m will need some extra logic within this function.

      def choose_version(version)
          if version =~ /(\d+)\.(\d+)\.(\d+)/
             major = $1
             minor = $2
             patch = $3
             major = major.to_i + 1 if config[:major]
             minor = minor.to_i + 1 if config[:minor]
             patch = patch.to_i + 1 if config[:patch]
             version = "#{major}.#{minor}.#{patch}"
             Chef::Log.debug("New version is #{version}")
          else
             Chef::Log.error("Version is in a format I cannot auto auto-update")
             exit 1
          end
          version
      end

Example, my current version is: 1.3.5
Bumping patch with -p will result into: 1.3.6 (seems ok)
Bumping minor with -m will result into: 1.4.5 (not ok, should be 1.4.0)
Bumping major with -M will result into: 2.3.5 (not ok, should be 2.0.0)

@sbpadmin
Copy link

sbpadmin commented Nov 1, 2013

Ahh yes, you are right!!

Sent from my iPhone

On 1 nov. 2013, at 22:01, "Sander Botman" <[email protected]mailto:[email protected]> wrote:

Bumping version with -M -m will need some extra logic within this function.

  def choose_version(version)
      if version =~ /(\d+)\.(\d+)\.(\d+)/
         major = $1
         minor = $2
         patch = $3
         major = major.to_i + 1 if config[:major]
         minor = minor.to_i + 1 if config[:minor]
         patch = patch.to_i + 1 if config[:patch]
         version = "#{major}.#{minor}.#{patch}"
         Chef::Log.debug("New version is #{version}")
      else
         Chef::Log.error("Version is in a format I cannot auto auto-update")
         exit 1
      end
      version
  end

Example, my current version is: 1.3.5
Bumping patch with -p will result into: 1.3.6 (seems ok)
Bumping minor with -m will result into: 1.4.5 (not ok, should be 1.4.0)
Bumping major with -M will result into: 2.3.5 (not ok, should be 2.0.0)


Reply to this email directly or view it on GitHubhttps://github.com//issues/19.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants