requiring gems from github (specifically flickr-fu and xml_magic) using config.gem

May 22nd, 2009

So the rails way of requiring a gem in your app is by using the config.gem instruction in environment.rb (as opposed to sticking a require statement in your environment.rb).

However including gems from github is a different beast … sometimes the gem author will tell you exactly how to do it, or sometimes they won’t, as the case with flickr-fu.

Just fyi … typically when you are including a gem from git hub you will want to do something like this …

config.gem 'gem-name-from-'gem -list'-command', :lib => 'github_gem_name', :source => 'http://gems.github.com'

“gem name from gem -list command” … by this I mean that you should run a gem -list command from your command line and use the name that shows up for your gem there.

… so the will_paginate gem config.gem statement looks like this …

config.gem 'mislav-will_paginate', :lib => 'will_paginate', :source => 'http://gems.github.com'

but for the xml-magic gem, its this ….

config.gem 'xml-magic', :lib => 'xml_magic', :source => 'http://gems.github.com'

and for the flickr-fu gem, its this ….

config.gem 'flickr-fu', :lib => 'flickr_fu', :source => 'http://gems.github.com'

Its not documented anywhere.

I had to figure it out by trial-and error, now you don’t have to :D

Entry Filed under: ruby on rails

Leave a Comment

Required

Required, hidden

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

February 2012
S M T W T F S
« May    
 1234
567891011
12131415161718
19202122232425
26272829  

I recommend

Linode VPS's for Rails hosting

Heroku for mindless Rails hosting

Site 5 for shared Rails hosting and all round great service

Most Recent Posts

Categories