Monday, July 30, 2012

Rails 3 - Bundler


Bundler is used to manage your application's gem dependencies. By default all Rails 3 application contains bundler gem.

If your applications need gems other than those belonging to Rails itself, you'll need to specify those gems into manifest file named Gemfile into the root of your Rails project directory.

Simple syntax to load gem

gem "paperclip"
gem "rspec"

Syntax to load gem on specific application environment

group :development, :test do
   gem "rspec"

Syntax to load specific gem version

gem "rspec" , "1.2"
gem "rspec", "> 1.2"

Syntax to load gem form a Git Repository

gem "paperclip", :git => "git://"

Installing Gems

Once you update the Gemfile then make sure you have installed all the dependencies in your Gemfile of Rails 3 applications.

$ bundle install
$ bundle install --without test

These commands will install all gem dependencies on your Rails 3 application which is specified on Gemfile.

Packing Gems

You can package up all your gems in the vendor/cache directory inside of your Rails 3 applications.

Here is the syntax to package up

$ bundle package

I hope you have some idea about Bundler and how it helpful in Rails 3 applications. If you need any clarifications please let me know.

No comments:

Post a Comment