Gem Dependencies

If your app uses Bundler (recommended, and default with Rails 3+), then the Brightbox deployment gem will handle running “bundle install” during deployment for you (and adds “bundle exec” to any rake commands). You don't need to do anything, the gem will handle things automatically.

If you're not using bundler, or need to define some gems to be installed before bundler runs then the Brightbox deployment gem can be configured to auto install any gems that your app needs.

Disabling Bundler

If you aren't using Bundler, you'll need to explicitly disable bundler support by adding the following to your config/deploy.rb.

set :bundle_disable, true

Manual gem installation

If you aren't using Bundler, the following explains how to configure gem dependencies. The deployment gem does not try to auto install gems listed in your environment.rb, as this caused too many problems with misbehaving Rails plugins.

So, to get your gems installed automatically, list them in config/deploy.rb using the Capistrano depends mechanism. You can specify exact versions if you need to. For example:

depend :remote, :gem, "rails", "2.3.2"
depend :remote, :gem, "ferret", "0.11.6"
depend :remote, :gem, "rmagick", ">=2.7"

You can also specify an alternative source, such as github:

depend :remote, :gem, "mislav-will_paginate", ">=2.3", :source => "http://gems.github.com"

If you don't care which version of a gem is installed, you can just pass a greater than zero version number:

depend :remote, :gem, "eventmachine", ">0"
docs/gemv2/gem_dependencies.txt · Last modified: 2013/07/17 15:19 by ben