Installing Gems Using Bundler
This article assumes that you already have a basic understanding of Rails and how to use a terminal.
Bundler manages all gems in a file called “Gemfile” in the root directory of your application (~/yourapp/Gemfile). If you ever want to install more gems for your application, this is the file you need to edit. Open it up in your text editor and you can see that the format is fairly easy to understand. The default Rails Gemfile should look something similar to the below (don’t worry if it’s slightly different):
source 'http://rubygems.org' gem 'rails', '3.1.0' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' gem 'json' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', " ~> 3.1.0" gem 'coffee-rails', "~>; 3.1.0" gem 'uglifier' end gem 'jquery-rails' # Use unicorn as the web server # gem 'unicorn' # Deploy with Capistrano # gem 'capistrano' # To use debugger # gem 'ruby-debug'
Once you have added the gems and versions that you wish to install to the Gemfile, we will need to process the changes by running the following command:
cd ~/yourapp/; bundle install --path vendor/bundle
That’s it!
For more detailed information about Bundler, please see the Bundler website