Sha256: 7212c2b39b18b3be7f63358c6d3315596dfbdd49241dd7eee538c77476493055
Contents?: true
Size: 1.81 KB
Versions: 8
Compression:
Stored size: 1.81 KB
Contents
#!/usr/bin/env ruby VERSION_PATH = File.expand_path('../../lib/app-rb/version.rb', __FILE__) CHANGELOG_PATH = File.expand_path('../../CHANGELOG.md', __FILE__) current_version = File.read(VERSION_PATH).split("\n").find { |l| l.index("VERSION") }.split('"')[1] major, minor, patch = current_version.split(".", 3).map(&:to_i) dev = !!current_version.index("-dev") if ARGV[0] == "patch" && !dev version = "#{major}.#{minor}.#{patch + 1}" next_version = "#{major}.#{minor}.#{patch + 1}" elsif ARGV[0] == "minor" && dev && patch == 0 version = "#{major}.#{minor}.0" next_version = "#{major}.#{minor + 1}.0-dev" elsif ARGV[0] == "major" && dev && patch == 0 version = "#{major + 1}.0.0" next_version = "#{major + 1}.1.0-dev" else puts "Current version: #{current_version}" unless dev puts "./bin/release patch # => #{major}.#{minor}.#{patch + 1}" end if dev puts "./bin/release minor # => #{major}.#{minor}.0" puts "./bin/release major # => #{major + 1}.0.0" end exit end def exec(cmd) puts "[exec] #{cmd}" system cmd end puts "releasing version: #{version}" exec %(git add .) exec %(git commit -am"uncommitted changes before release #{version}") exec %(git pull --rebase) File.write(VERSION_PATH, File.read(VERSION_PATH).sub(/VERSION = ".*?"/, %(VERSION = "#{version}"))) File.write(CHANGELOG_PATH, "## App-rb #{version} (#{Time.now.strftime("%B %-d, %Y")}) ##\n\n" + File.read(CHANGELOG_PATH)) exec %(git commit -am"Release #{version}") exec %(git tag v#{version}) exec %(git push) exec %(git push --tags) exec %(gem build app-rb.gemspec) exec %(gem push app-rb-#{version}.gem) exec %(rm -f app-rb-#{version}.gem) File.write(VERSION_PATH, File.read(VERSION_PATH).sub(/VERSION = ".*?"/, %(VERSION = "#{next_version}"))) exec %(git commit -am"Start version #{next_version}") exec %(git push) puts "Done."
Version data entries
8 entries across 8 versions & 1 rubygems