Sha256: c278019a7251696ed37c0b89035a410520d8bd547d2fb6d99501d1cbe4a012b0

Contents?: true

Size: 925 Bytes

Versions: 2

Compression:

Stored size: 925 Bytes

Contents

#!/usr/bin/env ruby
level = ARGV.first
if level.nil?
  warn "Example: #{__FILE__} (tiny|minor|major)"
  exit 1
end

path = 'lib/mixed_gauge/version.rb'
regexp = /VERSION = '(.+)'.freeze$/
version = File.read(path).scan(regexp)[0][0]
version_strs = version.split('.')

if version_strs.size > 3
  warn "Current version includes a prelease suffix, drop it: #{version}"
  version_strs = version_strs[0..2]
end

case level
when 'tiny'
  version_strs[2] = version_strs[2].to_i + 1
when 'minor'
  version_strs[1] = version_strs[1].to_i + 1
  version_strs[2] = 0
when 'major'
  version_strs[0] = version_strs[0].to_i + 1
  version_strs[1] = 0
  version_strs[2] = 0
else
  warn "Example: #{__FILE__} (tiny|minor|major)"
  exit 1
end

next_version = version_strs.join('.')
File.write(path, File.read(path).gsub(regexp, "VERSION = '#{next_version}'.freeze"))
system('git', 'add', path)
system('git', 'commit', '-m', "v#{next_version}")

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mixed_gauge-1.2.0.beta2 bump
mixed_gauge-1.2.0.beta1 bump