Bundler is developed entirely by a team of volunteers. Support their work and help make Bundler better for everyone.
Gemfileand how to use them.
bundle init. If you can, use
httpsso your connection to the rubygems.org server will be verified with SSL.
bundle configto set the username and password for any sources that need it. The command must be run once on each computer that will install the Gemfile, but this keeps the credentials from being stored in plain text in version control.
$ bundle config https://gems.example.com/ user:password
gem 'nokogiri' gem 'rails', '3.0.0.beta3' gem 'rack', '>=1.0' gem 'thin', '~>1.1'
>= 1.0, are self-explanatory. The specifier
~>has a special meaning, best shown by example.
~> 2.0.3is identical to
~> 2.1is identical to
~> 2.2.betawill match prerelease versions like
gem 'rspec', :require => 'spec' gem 'sqlite3'
:require => falseto prevent bundler from requiring the gem, but still install it and maintain dependencies.
gem 'rspec', :require => false gem 'sqlite3'
Gemfile, you will need to call
Bundler.requirein your application.
:sourceoption on that gem.
gem 'my_gem', '1.0', :source => 'https://gems.example.com'
sourceblock to group them together.
source 'https://gems.example.com' do gem 'my_gem', '1.0' gem 'another_gem', '1.2.1' end
bundle config, as described above.
:ref. The default is the
gem 'nokogiri', :git => 'https://github.com/tenderlove/nokogiri.git', :branch => '1.4'
.gemspecfile, bundler will create a simple one, without any dependencies, executables or C extensions. This may work for simple gems, but not work for others. If there is no .gemspec, you probably shouldn't use the gem from git.
:pathoption to the path containing the gem's files.
gem 'extracted_library', :path => './vendor/extracted_library'
--without) or required all at once (using
gem 'wirble', :group => :development gem 'debugger', :group => [:development, :test] group :test do gem 'rspec' endLearn more: Groups
ruby. If the
Gemfileis loaded on a different Ruby version, Bundler will raise an exception with an explanation.
ruby '1.9.3', :engine => 'jruby', :engine_version => '1.6.7'Learn More: Ruby Directive