Read my latest article: Announcing RailsDeveloper (posted Wed, 01 Sep 2010 17:01:00 GMT)

Managing Required Gems on Rails Projects

Posted by Robby Russell Thu, 27 Mar 2008 03:27:00 GMT

54 comments Latest by mac cosmetics outlet Fri, 27 Aug 2010 08:29:19 GMT

We’re starting a new project and I’m finding myself adding things to the code base that we’ve done in the past… hence the last few posts. As we’re doing this, I’d like to highlight some of the little things that we do on each project to maintain some consistency and in that process reach out to the community for alternative approaches.

I’m intrigued by the vendor everything concept, but we haven’t yet adopted this on any of our projects (yet).

What we have been doing is to maintain a REQUIRED_GEMS file in the root directory of our Rails application.

For example:


$ cat REQUIRED_GEMS

actionmailer
actionpack
actionwebservice
activerecord
activesupport
cgi_multipart_eof_fix
daemons
fastercsv
fastthread
feedtools
gem_plugin
image_science
mongrel
mongrel_cluster
mysql
rails
rake
RedCloth
Ruby-MemCache
soap4r
uuidtools

Everybody on the team (designers/developers) knows to look here to make sure they have everything installed when beginning to work on the application.

This has worked fairly well from project to project but since we’re starting a new project, I’m curious if anybody has some better ways to approach this. Should we look more seriously at the vendor everything approach or are there any alternative approaches?

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    Brandon Keepers Thu, 27 Mar 2008 04:20:06 GMT

    We’ve been using the gemtracker plugin, which allows you to define the required gems and versions in config/gems.yml, and then raises an error when the server starts up if a dependency is missing. Also provides rake gems:install to install all the dependencies.

    It’s worked out really well and is one of the reasons that we haven’t vendor’d everything.

  2. Avatar
    John Barnette Thu, 27 Mar 2008 05:25:02 GMT

    GemInstaller looks pretty robust.

  3. Avatar
    Hugh Thu, 27 Mar 2008 05:38:57 GMT

    Don’t forget you can have cap require certain gems when deploying too.

  4. Avatar
    Pat Maddox Thu, 27 Mar 2008 05:53:44 GMT

    Use geminstaller. We’ve been using it for our project (as has every project at the pivotal office) for the last several months. It’s awesome.

  5. Avatar
    Arie Thu, 27 Mar 2008 06:03:29 GMT

    I like the FrozenGemsGenerator

  6. Avatar
    Arie Thu, 27 Mar 2008 06:03:38 GMT

    I like the FrozenGemsGenerator

  7. Avatar
    Jack Danger Canty Thu, 27 Mar 2008 06:22:56 GMT

    We’ve had a lot of luck with vendor everything. We unpack gems (with version numbers intact in the directory name) into vendor/gems and have a one-liner in environment.rb that adds each gem directory to the load path.

    It’s great to be able to know not only which gem we’re using but which specific version.

  8. Avatar
    Raymond Brigleb Thu, 27 Mar 2008 06:44:12 GMT

    It’s nice to have your team begging to work on your application!

  9. Avatar
    Robby Russell Thu, 27 Mar 2008 06:45:43 GMT Recommend me on Working with Rails

    @raymond: hah! nice catch. :-)

  10. Avatar
    Chris Bailey Thu, 27 Mar 2008 07:50:13 GMT

    Another vote for GemInstaller. As compared to others, it also solves the platform specific gems problem, as well as deals with ensuring the gems you specified are what are actually on your app’s load path, even if you have multiple versions of the same gem installed. Here’s some more info I wrote up about it.

  11. Avatar
    Nuno Job Thu, 27 Mar 2008 14:53:34 GMT

    Thanks for the link brandon :)

  12. Avatar
    josh Thu, 27 Mar 2008 14:55:29 GMT

    +1 for GemInstaller. Also, I put a dependencies.rb file in config/initializers to require other non-gem files.

  13. Avatar
    jerome Thu, 27 Mar 2008 16:11:20 GMT

    We love cap deploy:check

  14. Avatar
    Lee Thu, 27 Mar 2008 16:32:34 GMT

    GemInstaller does look like a good solution. On that note, here is an interesting discussion on Rails Trac regarding a potential addition to RoR core http://dev.rubyonrails.org/ticket/11167

  15. Avatar
    Joe Grossberg Thu, 27 Mar 2008 16:32:51 GMT

    I don’t see gem versions listed, though. You seem to be assuming that there is backwards-compatibility.

    Have you ever looked at http://rubyforge.org/projects/plugems Plugems? It’s what we use at Revolution Health.

  16. Avatar
    Walter McGinnis Sat, 29 Mar 2008 23:38:57 GMT

    For my open source Rails app, called Kete (Maori word for basket, http://kete.net.nz) I built code for both gems and other required supporting software.

    If you want something that will report when other required software besides gems is uninstalled it might have some good example code:

    http://svn.kete.net.nz/projects/kete/trunk/config/required_software.yml http://svn.kete.net.nz/projects/kete/trunk/lib/required_software.rb http://svn.kete.net.nz/projects/kete/trunk/config/initializers/check_for_missing_software.rb

    If a Kete app is started and MISSING_SOFTWARE is not blank it will give a helpful message with what needs to be installed.

    Cheers, Walter

  17. Avatar
    Walter McGinnis Sat, 29 Mar 2008 23:39:45 GMT

    For my open source Rails app, called Kete (Maori word for basket, http://kete.net.nz) I built code for both gems and other required supporting software.

    If you want something that will report when other required software besides gems is uninstalled it might have some good example code:

    http://svn.kete.net.nz/projects/kete/trunk/config/required_software.yml http://svn.kete.net.nz/projects/kete/trunk/lib/required_software.rb http://svn.kete.net.nz/projects/kete/trunk/config/initializers/check_for_missing_software.rb

    If a Kete app is started and MISSING_SOFTWARE is not blank it will give a helpful message with what needs to be installed.

    Cheers, Walter

  18. Avatar
    Walter McGinnis Sat, 29 Mar 2008 23:40:48 GMT

    For my open source Rails app, called Kete (Maori word for basket, http://kete.net.nz) I built code for both gems and other required supporting software.

    If you want something that will report when other required software besides gems is uninstalled it might have some good example code:

    http://svn.kete.net.nz/projects/kete/trunk/config/required_software.yml http://svn.kete.net.nz/projects/kete/trunk/lib/required_software.rb http://svn.kete.net.nz/projects/kete/trunk/config/initializers/check_for_missing_software.rb

    If a Kete app is started and MISSING_SOFTWARE is not blank it will give a helpful message with what needs to be installed.

    Cheers, Walter

  19. Avatar
    Chad Woolley Mon, 31 Mar 2008 17:01:53 GMT

    Hi,

    Thanks for the GemInstaller propz. Full disclosure – I currently have broken tests against the new 1.1.0 RubyGems release (http://ci.thewoolleyweb.com/), which I’m working on. Strangely, I was green against trunk the day before the release, so I dunno WTF. I hope to have this fixed soon, limited only by my programming skills and ability to stay awake hacking after putting the kid to bed. Contributions welcome ;)

  20. Avatar
    Chad Woolley Mon, 31 Mar 2008 18:25:44 GMT

    @lee,

    A better “reimagined” approach just made it into trunk here:

    http://dev.rubyonrails.org/ticket/11444

    This finally looks like the right solution. Any gem pre-loaded on the load path (via GemInstaller hook in preinitializer, for example) will be picked up, and there can be a rails_init hook which will make the loaded gem be initialized like a plugin.

    I haven’t tried this on any plugins yet, but I’m really excited about it. It looks like the best solution overall when used with GemInstaller – explicit auto-installed and auto-loaded dependencies as gems, installed/compiled for the proper current platform, controlled via a config file, which can also act as rails plugins.

  21. Avatar
    Chad Woolley Mon, 31 Mar 2008 18:56:48 GMT

    @lee,

    A better “reimagined” approach just made it into trunk here:

    http://dev.rubyonrails.org/ticket/11444

    This finally looks like the right solution. Any gem pre-loaded on the load path (via GemInstaller hook in preinitializer, for example) will be picked up, and there can be a rails_init hook which will make the loaded gem be initialized like a plugin.

    I haven’t tried this on any plugins yet, but I’m really excited about it. It looks like the best solution overall when used with GemInstaller – explicit auto-installed and auto-loaded dependencies as gems, installed/compiled for the proper current platform, controlled via a config file, which can also act as rails plugins.

  22. Avatar
    Michael Murray Mon, 31 Mar 2008 20:58:11 GMT

    You can manage required gems in EDGE now: http://dev.rubyonrails.org/changeset/9140/trunk/railties/CHANGELOG

    Rake tasks are also provided to installed all the required gems.

  23. Avatar
    Vigrx plus Wed, 03 Mar 2010 06:45:06 GMT

    Great detailed information, I ll be visiting you more frequently, this is very interesting information

  24. Avatar
    Provestra Wed, 03 Mar 2010 09:04:20 GMT

    This post is really well written as it has provided all detailed facts and information about the topic. This post speaks credibility and authenticity and exposes real caliber of the writer. Fantastic job!

  25. Avatar
    SEO Expert India Tue, 09 Mar 2010 18:39:34 GMT

    Hey – great website, just looking around some blogs, seems a really nice platform you are using. I’m currently using Wordpress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?

  26. Avatar
    Sapphire Rings Tue, 09 Mar 2010 18:39:42 GMT

    I finally found one post which is informative and which has provided genuine information for the readers. I really liked the way writer has thrown some light on unhidden facts. Great job in deed

  27. Avatar
    Dental Implants Tue, 09 Mar 2010 18:39:48 GMT

    I have seen many posts similar to this one on internet but all other have filler content and are not up-to-the mark. This post especially made me to post my comments as its credible, it’s well written and above all it is interactive in nature. Well done!

  28. Avatar
    http://livingwithhiv.blinkweb.com/ Thu, 22 Apr 2010 10:04:33 GMT

    Really appreciate this post. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it!

  29. Avatar
    laptop adapter manufacturer Thu, 13 May 2010 06:41:20 GMT

    As we’re doing this, I’d like to highlight some of the little things that we do on each project to maintain some consistency and in that process reach out to the community for alternative approaches.

  30. Avatar
    Pregnancy Symptoms Tue, 25 May 2010 07:53:28 GMT

    Pregnancy Symptoms Do you accept guest posts? I would love to write couple articles here.I was wondering what is up with that weird gravatar??? I know 5am is early and I’m not looking my best at that hour, but I hope I don’t look like this! I might however make that face if I’m asked to do 100 pushups. lol

  31. Avatar
    mac makeup Wed, 26 May 2010 17:58:52 GMT

    ’ve had a lot of luck with vendor everything. We unpack gems (with version numbers intact in the directory name) into vendor/gems and have a one-liner in environment.rb that adds each gem directory to the load pat

  32. Avatar
    louis vuitton Fri, 28 May 2010 09:00:03 GMT
  33. Avatar
    air jordan retro Tue, 01 Jun 2010 02:25:00 GMT

    YRTY TRY

  34. Avatar
    ugg boot Tue, 01 Jun 2010 07:03:25 GMT
    http://www.boon-shoes.com/ugg-classic-cardy-knit-c-7.html">ugg classic cardy short ugg classic cardy short ugg fluff flip flop slippers ugg fluff flip flop slippers mbt chapa azul mbt chapa azul
  35. Avatar
    mbt chapa gtx Tue, 01 Jun 2010 07:07:55 GMT

    ugg erin baby boots ugg erin baby boots http://chapambt.com/mbt-chapa-gtx-black-blue-womens-shoes-p-63.html">mbt chapa caviar black mbt chapa caviar black

    Jordan 6 Rings white alue Jordan 6 Rings white alue mbt chapa birch mbt chapa birch
  36. Avatar
    mbt chapa gtx Tue, 01 Jun 2010 07:08:29 GMT

    ugg fluff flip flop slippers ugg fluff flip flop slippers ugg erin baby boots ugg erin baby boots mbt chapa caviar black mbt chapa caviar black

  37. Avatar
    ugg boot Tue, 01 Jun 2010 07:08:51 GMT
    jordan 11 white jordan 11 white mbt chapa birch mbt chapa birch jordan 24 alack jordan 24 alack
  38. Avatar
    supra Footwear Wed, 02 Jun 2010 07:00:27 GMT

    thanks your so much!!

  39. Avatar
    mbt black kaya Fri, 04 Jun 2010 08:21:02 GMT

    YT UYT

  40. Avatar
    2010 germany 16 lahm Fri, 04 Jun 2010 08:21:15 GMT

    YT TY U

  41. Avatar
    designer handbags reviews Fri, 11 Jun 2010 11:58:00 GMT

    I put a dependencies.rb file in config/initializers to require other non-gem files.

  42. Avatar
    Chanel handbags Mon, 28 Jun 2010 03:49:23 GMT

    If you are absolutely searching to buy chanel watches , you’ll be drooling over the advanced array of styles and colors of Chanel bags . One of the Chanel bag is its checky covering design.

    But do you know why Coach Outlet are so expensive? Many people think Coach Ergo are too expensive to buy. Pink Coach Gallery is perhaps one of the stylish accessories of the most desired among young women. It is difficult to obtain Coach Hamptons .

  43. Avatar
    dentist Mon, 28 Jun 2010 06:49:55 GMT

    I have been surfing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my opinion, if all webmasters and bloggers made good content as you did, the internet will be much more useful than ever before.

  44. Avatar
    air jordan 11 Wed, 30 Jun 2010 08:30:40 GMT

    Demonstrate a unique new conceptjordan shoesAwq9

  45. Avatar
    Shower Thu, 01 Jul 2010 09:52:26 GMT

    I will admit this is the third time I have visited your blog and Im loving it! I added your blog to my rss reader. Looking forward to see more blog posts!

  46. Avatar
    virtual assistant Fri, 16 Jul 2010 12:40:24 GMT

    Excellent really great stuff. thanks a lot for share this…

  47. Avatar
    dell mini 10 battery Sun, 18 Jul 2010 11:47:57 GMT

    Interesting read, thanks for helping keep me busy at work

  48. Avatar
    Discount Louis Vuitton Mon, 19 Jul 2010 15:55:22 GMT

    Louis Vuitton Damier Canvas Altona GM N53312 Louis Vuitton Damier Canvas Altona Louis Vuitton Damier Canvas Belem PM N51173 Louis Vuitton Damier Canvas Belem Louis Vuitton Damier Canvas Chelsea N51119 Louis Vuitton Damier Canvas Chelsea Louis Vuitton Damier Canvas Triana N51155 Louis Vuitton Damier Canvas Triana Louis Vuitton Damier Canvas Griet N48108 Louis Vuitton Damier Canvas Griet Louis Vuitton Damier Canvas Illovo PM N51996 Louis Vuitton Damier Canvas Illovo Louis Vuitton Manosque GM N51120 Louis Vuitton Manosque Louis Vuitton Manosque PM N51121 Louis Vuitton Manosque Louis Vuitton Hampstead GM N51203 Louis Vuitton Hampstead Louis Vuitton Damier Canvas Musette N51302 Louis Vuitton Damier Canvas Musette Louis Vuitton Musette N51300 Louis Vuitton Musette Louis Vuitton Nolita N41455 Louis Vuitton Nolita Louis Vuitton Olav MM N41441 Louis Vuitton Olav

  49. Avatar
    designerhandbags Fri, 23 Jul 2010 09:33:45 GMT

    thank you for your sharing.

  50. Avatar
    replica watches Mon, 02 Aug 2010 08:07:50 GMT

    thank you for your sharing.

  51. Avatar
    bag manufacturer Fri, 06 Aug 2010 03:32:18 GMT

    past… hence the last few posts. As we’re doing this, I’d like to highlight some of the little things that we do on each project to maintain some consistency and i

  52. Avatar
    http://www.bestretroshoes.com Tue, 10 Aug 2010 09:20:44 GMT
    Air Jordan 6,Air Jordan 6
    air jordans 13,air jordans 13
    air jordans 14,air jordans 14
    air jordans 16,air jordans 16
    Air Jordan 7,Air Jordan 7
    Air Jordan 8,Air Jordan 8
    Air Jordan 9,Air Jordan 9
    women jordan shoes,women jordan shoes
  53. Avatar
    ugg adirondack boot Fri, 13 Aug 2010 07:25:45 GMT

    The article is worth reading, I like it very much. I will keep your new articles. uggs boots on sale ugg snow boots new uggs

  54. Avatar
    mac cosmetics outlet Fri, 27 Aug 2010 08:29:19 GMT

    original mac makeup wholesale saving over 60% off.

Share your thoughts... (really...I want to hear them)

Comments