Managing Required Gems on Rails Projects
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?
Enjoying the content? Be sure to subscribe to my RSS feed.






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.
GemInstaller looks pretty robust.
Don’t forget you can have cap require certain gems when deploying too.
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.
I like the FrozenGemsGenerator
I like the FrozenGemsGenerator
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.
It’s nice to have your team begging to work on your application!
@raymond: hah! nice catch. :-)
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.
Thanks for the link brandon :)
+1 for GemInstaller. Also, I put a dependencies.rb file in config/initializers to require other non-gem files.
We love cap deploy:check
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
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.
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
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
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
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 ;)
@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.
@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.
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.
Great detailed information, I ll be visiting you more frequently, this is very interesting information
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!
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?
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
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!
Really appreciate this post. It’s hard to sort the good from the bad sometimes, but I think you’ve nailed it!
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.
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
’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
YRTY TRY
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 birchugg 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
thanks your so much!!
YT UYT
YT TY U
I put a dependencies.rb file in config/initializers to require other non-gem files.
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 .
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.
Demonstrate a unique new conceptjordan shoesAwq9
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!
Excellent really great stuff. thanks a lot for share this…
Interesting read, thanks for helping keep me busy at work
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
thank you for your sharing.
thank you for your sharing.
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
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
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
original mac makeup wholesale saving over 60% off.