• Home
  • About

stonean

Feeds:
Posts
Comments

config.gem

April 10, 2009 by stonean

When the config.gem statement was introduced I was pleased. It was great to have a centralized list of what gems were required by your application and with the rake gems:install task it would, in some cases, install the gems defined. More about that later, in another post.

After some time issues started to surface due to the lack of thought put into how to use config.gem. Here’s a list of some do’s and don’ts:

  • Use absolute version references!. This is really important when you want to roll back. If you update gems as a part of your deployment and your config.gem statement has :version => “>= 0.9″ and version “1.0″ had api changes. When you roll back, you’re still going to pick up the new version and potentially go boom!
  • Don’t put config.gem statements related to your application server. e.g. don’t put references to mongrel, passenger, etc… That’s a pain when you develop with passenger but deploy to mongrel boxes.
  • Use :lib => false, if you don’t want Rails to require the gem.
  • Do put testing related gems in your config/environments/test.rb, don’t put them in environment.rb (even if you use :lib => false, I think it’s a better practice. )
  • Don’t install the gem then add the config.gem statement. Add the config.gem statement, then use rake gems:install. This will help you find any issues before you deploy.

If you have some best practices that have saved you, I would love to hear about them!

Thanks to Hashrocket for at least one of the above. Can’t remember where each one originated.

Posted in RubyOnRails | No Comments Yet

  • Open Source


    Lockdown (GitHub)
    RuHL (GitHub)

  • Recommend Me

  • twitter: stonean

    • I checked my RailsConf proposal status and it's 'under review'. 'Dumb and Dumber' then came to mind: 'so there's a chance, *yeah*'. 19 hours ago
    • Yet another way to waste time in the guise of keeping up to date: http://vurl.me/EIR 3 days ago
    • So I submitted my RailsConf proposal, called it Beyond MVC. We shall see. I do such a bad job talking about myself, the bio sucked. 4 days ago
    • @ubermuda that's good to know, thank you! 5 days ago
    • @chanmix51 cool, thanks! 5 days ago
  • Categories

    classy-inheritance Code Style DataMapper Fusion git Haml Interview Questions jQuery lockdown Merb MysqlUtils Process Quick Tips REST RSpec Ruby RubyOnRails rubytrends Stage thoughts Uncategorized


  • Archives

    • November 2009
    • May 2009
    • April 2009
    • March 2009
    • February 2009
    • January 2009
    • December 2008
    • November 2008
    • October 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007

Blog at WordPress.com.

Theme: Mistylook by Sadish.