What is Bundler?
Bundler maintains a consistent environment for ruby applications. It tracks an application's code and the rubygems it needs to run, so that an application will always have the exact gems (and versions) that it needs to run.
We designed bundler to make it easy to share your code across a number of development, staging and production machines. Of course, you know how to share your own application or gem: stick it on GitHub and clone it where you need it. Bundler makes it easy to make sure that your application has the dependencies it needs to start up and run without errors.
$ gem install bundler
Learn More: Gemfiles
source 'https://rubygems.org' gem 'nokogiri' gem 'rack', '~>1.1' gem 'rspec', :require => 'spec'
Learn More: bundle install
$ bundle install $ git add Gemfile Gemfile.lock
Learn More: Bundler.setup
require 'rubygems' require 'bundler/setup' # require your gems as usual require 'nokogiri'
$ bundle exec rspec spec/models
In some cases, running executables without
may work, if the executable happens to be installed in your system
and does not pull in any gems that conflict with your bundle.
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
$ bundle install --binstubs $ bin/rspec spec/models
binare scoped to the bundle, and will always work.
Use Bundler with
Bundler has a lot of contributors and users, and they all talk to each other quite a bit. If you have questions, try the IRC channel or mailing list. If you're interested in contributing to the project (no programming skills needed), read the contributing guide. If you have sponsorship or security questions, please contact the core team directly.