Sha256: f4b36cb1724cc4e626a4b0feab0468f1a3f53e29e5e196731ec6be07379ae1b0
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
#!/usr/bin/env ruby 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 parts = $1.split('.') parts[-1] = parts[-1].to_i + 1 parts.join '.' end puts "Bumping version number found in #{name} to #{opts[:new_version]}" contents.sub!(EXPR, "VERSION = \"#{opts[:new_version]}\"") unless opts[:dryrun] File.write(name, contents) # 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 break end end puts "No version file found. :("
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bumpy-0.1.1 | bin/bumpy |