Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleTable of Contents

Table of Contents


...


Install bundler

Code Block
titleinstall current version
gem install bundler                     # installs in current gemset
rvm @global do gem install bundler      # installs in @global gemset for current ruby version

...

Code Block
titleinstall specific version
gem install bundler --version 1.4.7


Examples

Install based on RVM gem-set
Code Block
titlesaves gems in current rvm gemset
# Install the gems specified by the Gemfile saving them in current rvm gemset (or gemset specified in .ruby-gemset)
bundle install      


Install in vendor/bundle

Preferred as this will be deleted when the app is deleted.

Code Block
titlesave gems in rails app
# Install the gems specified by the Gemfile saving them in the rails app at the specified path
# vendor/bundle is best practice location for rails apps
# bundle saves the path at .bundle/config in the rails app

bundle install --path=vendor/bundle

NOTE: This path should be in .gitignore.


Documentation: http://bundler.io


Files:

  • Gemfile - editable by developer
  • Gemfile.lock - updated by bundler do not edit


Process:

  • edit Gemfile and add dependencies
  • run command to update
Code Block
languageruby
$ bundle install


Executing a command in the context of a bundle

Code Block
languageruby
# the following may get errors
$ rake db:migrate

# if it does, try the following to execute in context of the bundle dependencies
$ bundle exec rake db:migrate


Man page

Code Block
languagenone
BUNDLE(1)                                                                              BUNDLE(1)

NAME
       bundle - Ruby Dependency Management

SYNOPSIS
       bundle COMMAND [--no-color] [--verbose] [ARGS]

DESCRIPTION
       Bundler  manages  an  application's  dependencies  through  its  entire  life across many
       machines systematically and repeatably.

       See the bundler website http://bundler.io for information on getting  started,  and  Gem-
       file(5) for more information on the Gemfile format.

OPTIONS
       --no-color
              Prints all output without color

       --verbose
              Prints out additional logging information

BUNDLE COMMANDS
       We divide bundle subcommands into primary commands and utilities.

PRIMARY COMMANDS
       bundle install(1) bundle-install.1.html
              Install the gems specified by the Gemfile or Gemfile.lock

       bundle update(1) bundle-update.1.html
              Update dependencies to their latest versions

       bundle package(1) bundle-package.1.html
              Package  the  .gem files required by your application into the vendor/cache direc-
              tory

       bundle exec(1) bundle-exec.1.html
              Execute a script in the context of the current bundle

       bundle config(1) bundle-config.1.html
              Specify and read configuration options for bundler

       bundle help(1)
              Displays detailed help for each subcommand

UTILITIES
       bundle check(1)
              Determine whether the requirements for your application are installed  and  avail-
              able to bundler

       bundle list(1)
              Show all of the gems in the current bundle

       bundle show(1)
              Show the source location of a particular gem in the bundle

       bundle outdated(1)
              Show all of the outdated gems in the current bundle

       bundle console(1)
              Start an IRB session in the context of the current bundle

       bundle open(1)
              Open an installed gem in the editor

       bundle viz(1)
              Generate a visual representation of your dependencies

       bundle init(1)
              Generate a simple Gemfile, placed in the current directory

       bundle gem(1)
              Create a simple gem, suitable for development with bundler

       bundle platform(1) bundle-platform.1.html
              Displays platform compatibility information

       bundle clean(1)
              Cleans up unused gems in your bundler directory

OBSOLETE
       These commands are obsolete and should no longer be used

       o   bundle lock(1)

       o   bundle unlock(1)

       o   bundle cache(1)

...