Sunday, October 17, 2010

Creating a Gem with Bundler

Bundler is really cool in that it helps manage gem dependencies and its a default in Rails 3.


Using those information, i am going to run through steps to start making a gem.

Step 1
$ bundle gem awesome-stuff

Step 2
Make some changes to .gemspec

Step 3
Put the logic in /lib/awesome-stuff

Step 4
require the rb files in /lib/awesome-stuff.rb

Step 5
$ git add .
$ git commit -m "My first gem commit"

Step 6
$ gem build awesome-stuff.gemspec
$ gem install awesome-stuff-0.0.1.gem

Now fire up Interactive Ruby (irb)
> require 'rubygems'
> require 'awesome-stuff'
> Awesome::Pop.makeSomeNoise
> Hello Gem!
> => nil

It works!

The github documentation has some information on using Rspec and Gem Dependencies stuff that you might be interested.
And share the gem with the rest of the world.

0 comments:

Post a Comment