Skip to content

Wrong results when bumping version major and minor. #19

Description

@sbotman

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions