i made my first rubygem!
In an effort to make the world better for others I made my new recipe library for capistrano into a ruby gem. It took a little doing as there didn't appear to be a concise example on the rubygems site of how to construct the gemspec file. Dave Thomas's Pickaxe book covered it well though.
So here's my quick and dirty guide to creating a gem.
Make a file called projectname.gemspec
require 'rubygems'
SPEC = Gem::Specification.new do |spec|
spec.name = 'deprec'
spec.version = '0.1.1'
spec.summary = 'deployment recipes for capistrano'
spec.description = <<-EOF
This project provides libraries of Capistrano tasks and extensions to
remove the repetative manual work associated with installing services
on linux servers.
EOF
spec.require_path = "lib"
# spec.platform = Gem::Platform::Ruby
# spec.required_ruby_version = '>= 1.6.8' # I don't know
spec.add_dependency('capistrano', '>= 1.2.0')
spec.files = Dir['lib/*.rb']
end
Then run these commands to build and install the gem
gem build deprec.gemspec
sudo gem install deprec-0.1.1.gem
I applied for a rubyforge project today and aim to publish the gem when it gets approved.
2 comments:
You might wanna check out Hoe, which will give you a bunch of Rake tasks to automate managing and publishing the gem:
http://seattlerb.rubyforge.org/hoe/
Thanks for the tip!
Post a Comment