gem_version

Automated version management for your Gem builds.

Resources

Install

  • sudo gem install gem_version

Use

  • require ‘gem_version’

Description

Never bother updating the version for your next gem build by hand. Configured in your Rakefile, gem_version automatically provides the next version and commits it to the repository.

Use

Require the library in your Rakefile:

require 'gem_version'

Use gem_version in your Gem Specification:

spec = Gem::Specification.new do |s|
  s.version = GemVersion.next_version
  ...
end

Increment and commit the gem version in your Gemspec rake task:

desc 'Generate a gemspec file.'
task :gemspec do
  File.open("#{spec.name}.gemspec", 'w') do |f|
    f.write spec.to_ruby
  end
  GemVersion.increment_version
  GemVersion.commit_and_push
end

Everytime you build your gem (this example uses Gemcutter):

rake gemspec
gem build your_gem_name.gemspec

gem_version provides the next version for each build.

Bumping or resetting the next gem version

Gem version creates a file named ‘next_gem_version’ in the root directory of your project which contains the ‘next’ gem version. Edit the version in this file to bump or reset the version for the next build.

Dependencies

  • Git gem (>= 1.2.5)