rvm+bundler

From http://everydayrails.com/2010/09/13/rvm-project-gemsets.html

Create a global gemset

This is where things begin to get a little tricky. What we’re going to do is create a globalgemset that contains gems that will be used across multiple projects, then a project-specificgemset for each of our Rails applications. To begin, let’s make our global gemset:

$ rvm gemset create global $ rvm use @global

What you put in @global is up to you, but try to keep it clean. Since the point of this exercise is to maintain separate development environments for Rails 2.3 and Rails 3, don’t install any frameworks in @global. Here I’m just loading some necessities. We’ll get to a project-specific gemset momentarily.

$ gem install bundler mongrel capistrano hirb wirble

Set up your project

Thanks to Bundler, getting your Rails 3 projects configured to use your new development environment should be fairly straightforward.

First, we’ll create another gemset; this one will be specific to our Rails 3 project. Replacerails3_project with a gemset name that makes more sense for your project:

$ rvm gemset create rails3_project $ rvm use @rails3_project

Next, create a .rvmrc file at the root of your Rails 3 application. It will look something like this:

rvm ree-1.8.7-2010.02@rails3_project

You can install gems with bundler from your Gemfile and skip a certain environment with

123

bundle install --without test

To skip multiple environments do

123

bundle install --without test --without development

This of course assumes you have a a gemfile something like:

1234567891011

group :development, :test do gem 'ruby-debug'endgroup :test do gem "rspec", ">= 2.0.0.beta.19"end

Also, Michael points out that you can skip the slow “Fetching source index for http://rubygems.org/” by using “—no-update-sources”