I spent a couple of minutes trying to figure out how to ‘freeze’ gems with a recent Rails app (2.2.2) I’m developing. A bunch of git repositories have this vendor/gems folder a bit like in Merb, so I was pretty sure something had changed in Rails itself. I finally found this screencast. I’m sharing it again as I spent a bit of time already myself.
Turns out it’s pretty well integrated. First edit your environment.rb to specify which gem you want to register as a dependency:
Rails::Initializer.run do |config|
# ...
# Specify gems that this application depends on.
# They can then be installed with "rake gems:install" on new installations.
# You have to specify the :lib option for libraries, where the Gem name (sqlite3-ruby) differs from the file itself (sqlite3)
config.gem "fastercsv", :version => '1.4.0'
# ...
end
If you want to freeze the registered gems automatically under vendor/gems, just do:
rake gems:unpack
There is also the possibility to install them on any machine using this:
rake gems:install
Generally, I prefer to keep things in my repository, as I don’t want my deployment to fail because of network or routing issues.
The comments system is brand new - don't be afraid to comment!
- Monitoring File Changes and Getting Notified via Growl (February 14th, 2010)
- How to use Google Calendar and Rufus-Google for Basic Time Tracking (November 27th, 2009)
- Using JRuby to prototype VST plugins (November 17th, 2009)
- Introducing Learnivore.com (September 15th, 2009)
- How to create small, unique tokens in Ruby (July 2nd, 2009)
- Detecting Which Ruby Interpreter is Running (JRuby, IronRuby) (March 4th, 2009)
- How to create an empty Rails Edge application (January 28th, 2009)
- Thoughts on IronRuby and .Net Testing (December 1st, 2008)
- How to Retrieve Delicious Tags and Number of Bookmarks for a Given Url (November 30th, 2008)
- Fixing Symbol not found _rl_filename_completion_function (November 6th, 2008)
- How to Generate a Gradient for your CSS using RMagick (October 21st, 2008)
- Analyzing Your GMail History (September 18th, 2008)
- Data Visualization with Ruby and RMagick - Where Are Those Bikes ? (March 31st, 2008)
- All-Time Classics: a Selection of Recommended Books for Software Developers (February 23rd, 2008)

