Sha256: e347d33f579900866f029e72ec54570ade4f4a55695336f1e56dd2177f4d2d84
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'trollop' require 'bumpy' opts = Trollop::options do version "bumpy #{Bumpy::VERSION} by Hendrik Mans" banner <<-EOS Bumpy bumps your gem's version number. Usage: bumpy [options] [version] Available Options: EOS opt :dryrun, "Dry run (no writing or committing)" opt :no_git, "Don't automatically create git commit" opt :message, "Supply a git commit message (%s is replaced with bumped version number)", :type => :string end EXPR = %r{VERSION = ['"](.+)['"]} opts[:new_version] = ARGV.shift Dir['./lib/**/version.rb'].each do |name| contents = File.read(name) if contents =~ EXPR opts[:new_version] ||= Bumpy.bump_version($1) puts "Bumping version number found in #{name} to #{opts[:new_version]}" contents.sub!(EXPR, "VERSION = \"#{opts[:new_version]}\"") unless opts[:dryrun] File.open(name, 'w+') do |f| f.write(contents) end # create git commit if File.exists?('./.git') && !opts[:no_git] opts[:message] ||= "Bump version to #{opts[:new_version]}" system "git add #{name} && git commit -m '#{opts[:message] % opts[:new_version]}'" end end # done! exit 0 end end puts "No version file found. :("
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bumpy-1.0.0 | bin/bumpy |
bumpy-0.1.5 | bin/bumpy |