Sha256: 67489bdb4308dd5cdbcd2b0669e15ed8b217bf2c1f6f07a3111300b8c7df34a0
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 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" 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] ||= begin $1.next end 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] puts "Creating git commit" system "git add #{name} && git commit -m 'Bump version to #{opts[:new_version]}'" end end # done! exit 0 end end puts "No version file found. :("
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bumpy-0.1.4 | bin/bumpy |