0.0
No commit activity in last 3 years
No release in over 3 years
Automated version management for your Gem builds
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 1.2.5
 Project Readme

GemVersion¶ ↑

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

GemVersion provides the next version for each build.

See my Rakefile for an example.

Adding other files¶ ↑

To add other files to the GemVersion.commit_and_push method use the block. For instance, if you want to commit and push the gemspec file also:

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

Bumping or resetting the next gem version¶ ↑

GemVersion 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 or use the rake tasks to bump or set the version for the next build.

GemVersion increments the last component of your version. If you need to bump from 0.1.x to 0.2.x, you’ll need to bump the version manually.

Rake tasks¶ ↑

Two rake tasks gem:clean and gem:version are available whenever you require gem_version.

  • Clean the project root of .gem and .gemspec files.

    rake gem:clean

  • Get the next gem version

    rake gem:version

  • Set the next gem version

    rake gem:version set=0.1.0

Dependencies¶ ↑

  • Git gem (>= 1.2.5)