views:

252

answers:

4

I have developed a simple library in Ruby and need to use this in several Rails applications (some of which are not built yet). What is the best way to easily add this Ruby library to several Rails applications as and when required? Our team is running Ubuntu and our repository is Mercurial.

Should I use a...

  1. Rails plugin? This would be my first choice but it appears not to support Mercurial??
  2. Ruby Gem?
  3. Custom Rake script?
  4. Other options??

Any pointers would be much appreciated!

+10  A: 

Ruby already has an established mechanism for code sharing i.e. RubyGems. Jeweler makes Gem creation easy. I'd recommend that you check it out.

John Topley
+2  A: 

Make a gem or a plugin. Gems are better in my opinion, easier to manage.

nkassis
+1  A: 

Make a Rails plugin. It doesn't "support" Mercurial in the sense that you can't do script/plugin install $REPO_URL and have it work automatically, but if it's for your own use, then you won't miss that feature.

savetheclocktower
+2  A: 

My rule of thumb:

If it doesn't depend on rails, make it a gem.
If it depends on rails, make it a plugin.

Scott