All notes
Bundl

Intro

bundler.io.

Installation


gem install bundler

# Adds the named gem to the Gemfile and run bundle install.
bundle add rails
# Remove gem.
bundle exec gem uninstall GEM_NAME

bundle install
git add Gemfile Gemfile.lock

Commands


bundle init

bundle install
bundle install --deployment
##### About cache:
# While installing gems, Bundler will check vendor/cache and then your system's gems. If a gem isn't cached or installed, Bundler will try to install it from the sources you have declared in your Gemfile.

# Rebuild your Gemfile.lock
bundle update

bundle console

# Show the env:
bundle env
  # GEM_HOME  /Users/i337146/.rvm/gems/ruby-2.1.3
  # GEM_PATH  /Users/i337146/.rvm/gems/ruby-2.1.3:/Users/i337146/.rvm/gems/[email protected] wcfNote: It is the place where "bundle install" puts gems.

# Cleans up unused gems in your bundler directory
bundle clean [--dry-run] [--force]
# Checks if the dependencies listed in Gemfile are satisfied by currently installed gems
bundle check [--dry-run] [--gemfile=FILE] [--path=PATH]

# Opens the source directory of the provided GEM in your editor.
bundle open GEM

# Generates a visual dependency graph
bundle viz
# Show platform compatibility
bundle platform

bundle update rails

bundle package
# Copy all of the .gem files needed to run the application into the vendor/cache directory. In the future, when running bundle install, use the gems in the cache in preference to the ones on rubygems.org.

bundle exec and LOAD_PATH



# Print the $LOAD_PATH
p $:
Without "bundle exec", the LOAD_PATH is:
["/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby/2.2.0/x86_64-linux", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby/2.2.0/x86_64-linux", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0/x86_64-linux"]

With "bundle exec":
["/home/dev/.rvm/gems/[email protected]/gems/bundler-1.15.4/lib", "/home/dev/.rvm/gems/[email protected]/gems/foodcritic-junit-0.2.2/lib", "/home/dev/.rvm/gems/[email protected]/gems/foodcritic-9.0.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/yajl-ruby-1.3.0/lib", "/home/dev/.rvm/gems/[email protected]/extensions/x86_64-linux/2.2.0/yajl-ruby-1.3.0", "/home/dev/.rvm/gems/[email protected]/gems/treetop-1.6.8/lib", "/home/dev/.rvm/gems/[email protected]/gems/polyglot-0.3.5/lib", "/home/dev/.rvm/gems/[email protected]/gems/rufus-lru-1.1.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/nokogiri-1.7.1/lib", "/home/dev/.rvm/gems/[email protected]/extensions/x86_64-linux/2.2.0/nokogiri-1.7.1", "/home/dev/.rvm/gems/[email protected]/gems/mini_portile2-2.1.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/erubis-2.7.0/lib", "/home/dev/code/myproj/vendor/cache/my-liba-220e01988ddb/lib", "/home/dev/.rvm/gems/[email protected]/gems/cucumber-core-2.0.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/gherkin-4.1.1/lib", "/home/dev/.rvm/gems/[email protected]/gems/capistrano-maintenance-0.0.3/lib", "/home/dev/.rvm/gems/[email protected]/gems/capistrano-ext-1.2.1/lib", "/home/dev/.rvm/gems/[email protected]/gems/capistrano-2.14.2/lib", "/home/dev/.rvm/gems/[email protected]/gems/net-ssh-gateway-1.2.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/net-sftp-2.1.2/lib", "/home/dev/.rvm/gems/[email protected]/gems/net-scp-1.1.2/lib", "/home/dev/.rvm/gems/[email protected]/gems/net-ssh-2.7.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/highline-1.6.20/lib", "/home/dev/.rvm/gems/[email protected]/gems/backports-3.7.0/lib", "/home/dev/.rvm/gems/[email protected]/gems/rake-12.0.0/lib", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby/2.2.0/x86_64-linux", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/site_ruby", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby/2.2.0/x86_64-linux", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/vendor_ruby", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0", "/home/dev/.rvm/rubies/ruby-2.2.6/lib/ruby/2.2.0/x86_64-linux"]

FAQ

Difference between the gems bundle and bundler

SO: what is the difference between bundle and bundler.

bundle is just an empty gem with bundler as dependency.
In fact, bundle is an alias for bundler.
Good thing, imagine if someone actually created a completely separate gem, called bundle.