Blog An exploration of the art and
craft of software development

Adding Github gem dependencies in Merb

Posted by Marty Haught on Thursday, February 12, 2009

Here’s a little nugget that seems to be missing from all of the doc I’ve seen on Merb is how to specify a gem that is on Github. First, make sure that Github is added to your gem sources. You can check via:


MartyMPB2:~ marty$ gem sources
*** CURRENT SOURCES ***

http://gems.rubyforge.org/
http://gems.github.com

If it’s not there go ahead and run this:


gem sources -a http://gems.github.com

Now that you have Github in your sources you can add this to your config/dependencies.rb file:


dependency("mattetti-couchrest", :require_as => 'couchrest') 

In this example I’m interested in pulling in Mattetti’s couchrest fork. The require_as is necessary so that Merb doesn’t try to put the username into the require. One more gotcha that might trip you up is if the Github fork is not buildable as a gem. That will keep it from properly being included. Finally, run Thor’s install command to get everything installed.


thor merb:gem:install
blog comments powered by Disqus