Discover Gem Bundler
Posted by Sandro Paganotti in
Ruby on Rails -
no comments
I’m experimenting some features from Bundler, the new standard gem for calculating gem dependencies. Bundler works out of the box with Rails 3.0 but can also be implemented into Ruby projects without much effort.
All you have to do is install bundler with the command:
gem install bundler
Then you may create your Gemfile in your project root directory specifing wich gems you need; there is no DSL, just pure Ruby code with some nice helpers:
source "http://rubygems.org"
gem "nokogiri"
If you call ‘bundle install’ from command line now, all the missing gem specified in the Gemfile are installed (and compiled) automatically.
To benefit from these gems within your code you need to put on top of your .rb file the following lines:
require "rubygems"
require "bundler"
Bundler.setup
# now you can require all the gems specified in your Gemfile
require "nokogiri"
And that’s it.

