Sha256: 5a7f2d50cfe19b774b3d83991e699f3d5361047c76b25e3f91d462edbff5c07e

Contents?: true

Size: 805 Bytes

Versions: 6

Compression:

Stored size: 805 Bytes

Contents

module New::Version
  require 'semantic'

  def version= string
    @version ||= begin
      Semantic::Version.new string
    rescue
      New.say "#{string} is not a semantic version.  Use format `1.2.3`", type: :fail
      exit
    end
  end
  def version; @version; end

  def bump_version part
    case part
    when :major
      version.major += 1
    when :minor
      version.minor += 1
    when :patch
      version.patch += 1
    end

    version
  end

  def get_part
    New.say "            Current Version: #{version}", type: :success
    New.say " Specify which part to bump: [#{'Mmp'.green}] (#{'M'.green}ajor / #{'m'.green}inor / #{'p'.green}atch)"
    part = STDIN.gets.chomp!

    case part
    when 'M'
      :major
    when 'm'
      :minor
    when 'p'
      :patch
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
new-0.0.6 lib/new/version.rb
new-0.0.5 lib/new/version.rb
new-0.0.4 lib/new/version.rb
new-0.0.3 lib/new/version.rb
new-0.0.2 lib/new/version.rb
new-0.0.0 lib/new/version.rb