rake + rspec + gemcutter
Today I’m going to talk about how I release new versions of ice_cube. I’ve set up a rake task called ‘release’, which makes sure that all of my tests pass before deploying tagging and pushing to RubyGems. I got the basis of the idea from a yehuda katz blog post.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | require 'spec/rake/spectask' require 'lib/ice_cube/version' task :build => :test do system "gem build ice_cube.gemspec" end task :release => :build do # tag and push system "git tag v#{IceCube::VERSION}" system "git push origin --tags" # push the gem system "gem push ice_cube-#{IceCube::VERSION}.gem" end Spec::Rake::SpecTask.new(:test) do |t| t.spec_files = FileList['spec/**/*_spec.rb'] fail_on_error = true # be explicit end |
Then you can just update the version.rb file:
1 2 3 | module IceCube VERSION = "0.3.9" end |
and type:
$ rake release
Voila! Using this simple release method (thanks to rake and rspec), will make sure you don’t accidentally push broken versions ever (again).
Tweets that mention rake + rspec + gemcutter « outlaw love song -- Topsy.com 10:02 pm on June 17, 2010 Permalink
[...] This post was mentioned on Twitter by John Crepezzi, Matthew Closson. Matthew Closson said: Ensure you never push broken gems – RT @seejohnrun: Just published a post on releasing gems: http://bit.ly/9yVSSI #ruby #rspec [...]