Tuesday 27 October 2009

Rails: Unpacking your gems into vendor/gems

Okay you have your marvelous gem but want to put it into the vendor directly.

No worries. In this example I will be working with the "marc (0.3.0)" gem.
  1. Edit the environment.rb file and under the "Rails::Initializer.run do |config|" put the following line: config.gem 'marc'
  2. Next "rake gems:unpack GEM=marc" where GEM=gem_name - don't worry about the version number.
All done. You should have a new directory under vendor/gems/gem_name.

Troubleshooting. If this doesn't quite work, you might want to try:
  • Create the gems directory under vendor yourself
  • It may complain that it lacks the specification file. If so go to the vendor/gems/gem_name directory and run: gem specification gem_name > .specification
If this still doesn't work ... then google or bing yourself to death.

No comments: