Using Groups

Grouping your dependencies allows you to perform operations on the entire group.
# These gems are in the :default group
gem 'nokogiri'
gem 'sinatra'

gem 'wirble', :group => :development

group :test do
  gem 'faker'
  gem 'rspec'
end

group :test, :development do
  gem 'capybara'
  gem 'rspec-rails'
end

gem 'cucumber', :group => [:cucumber, :test]
Install all gems, except those in the listed groups. Gems in at least one non-excluded group will still be installed.
$ bundle install --without test development
Require the gems in particular groups, noting that gems outside of a named group are in the :default group
Bundler.require(:default, :development)
Require the default gems, plus the gems in a group named the same as the current Rails environment
Bundler.require(:default, Rails.env)
Restrict the groups of gems that you want to add to the load path. Only gems in these groups will be require'able
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :ci)
require 'nokogiri'
Learn More: Bundler.setup
Fork me on GitHub
Docs: v0.9 v1.0 v1.1 v1.2 v1.3 v1.5 v1.6 v1.7