Sha256: b74ccacc962e2b8f9f8d1cca2128caf513e160f266bc1658e29440ab0ea985be

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

path = File.realpath File.join(__dir__, '../lib/webdrone/version.rb')
load path

current = Webdrone::VERSION
numbers = current.split('.').map(&:to_i)
length = numbers.count

versions = length.times.map do |index|
  version = numbers.dup
  version[index] += index.zero? ? 1 : 2
  index += 1
  (index...length).each do |i|
    version[i] = 0
  end
  version.join '.'
end.reverse

text = versions.each_with_index.map do |version, index|
  "#{index + 1}. #{version}"
end.join("\n")

puts <<~FIN

  Version file: #{path}

  Current version: #{current}. Choose next version:
  #{text}

FIN

print 'Choose? [1]'
option = gets.strip

index = option == '' ? 0 : option.to_i - 1
version = versions[index]
raise "Invalid option #{option}" unless version

`ruby -p -i -e 'gsub /#{current}/,"#{version}"' #{path}`
puts `bundle; git add #{path} Gemfile.lock; git commit -m "Version #{version}."; git tag v#{version}`

puts <<~FIN

  Press enter to git push or CTRL+C to cancel

FIN

print 'git push origin master --tags'
gets
puts `git push origin master --tags`

puts 'rake release'
gets
puts `rake release`

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
webdrone-1.18.2 bin/release-version
webdrone-1.18.0 bin/release-version
webdrone-1.16.2 bin/release-version
webdrone-1.16.0 bin/release-version
webdrone-1.14.0 bin/release-version
webdrone-1.12.0 bin/release-version
webdrone-1.10.0 bin/release-version