Freeze (vendor, unpack) a single Ruby gem with and without Bundler

When you need to patch an existing gem, one way is to "vendor" the gem by copying it into the vendor/gems directory of your Rails project. You can then make any changes you require and Rails will use the vendored version of the gem after a server restart. Unfortunately you need to perform some additional steps to marry Rails and the copied gem. This notes describes what to do.

With Bundler

This is super-painful. If you just copy the gem to vendor/gems, Rails will complain:

Unpacked gem foolib in vendor/gems has no s...

How to install the date_performance gem

sudo gem install zip
git clone git://github.com/rtomayko/date-performance.git
cd date-performance
rake package:build
cd dist
sudo gem install --no-ri --no-rdoc date-performance-0.4.7.gem

Install a gem without RI and RDdoc

To improve installation times of gems you can use the following approach:

gem install xyz --no-document

To permanently ignore ri and rdoc when installing gems, add this line to ~/.gemrc:

gem: --no-document

Be aware that eliding local documentation may disable documentation support in your IDE.

Create an application with an older Rails version

sudo gem install rails --version="=1.2.3"
rails _1.2.3_ new-project-folder