Skip to content
Tyler Bird edited this page Feb 26, 2014 · 9 revisions

This page highlights the features of the bundler recipe.

Disable Standard Require

The standard require of bundler will run the vanilla bundler hooks. Because we hook into the deploy process in a custom way, see Enable Bundler Recipe next on how we enable it.

# require 'bundler/capistrano'

This can be especially useful for users who have shared folders because they won't then run bundler twice during a deploy, even on a single server.

Enable Bundler Recipe

Currently the bundler:bundle_gems recipe runs as a after hook of the deploy:symlink_configs task. You will see in your deploy.rb file a line like:

after "deploy:update_code", "deploy:symlink_configs"

There must be a "deploy:symlink_configs" task in your deploy.rb file or else the bundler:bundle_gems task will not run.

Read the code of the recipe.

Disable Bundler By Application Server

Given that you are using a Shared File system for multiple Application servers, and you do not need to have bundler install gems more than once. You'll need to add a :no_bundle => true to your deploy.rb file and the secondary application servers.

task :production do
  role :web, "123.123.123.123:7000" 
  role :app, "123.123.123.123:7000", :unicorn => true
  role :db , "123.123.123.123:7000", :primary => true
  role :app, "123.123.123.123:7001", :unicorn => true, :no_release => true, :no_symlink => true, :no_bundle => true
  set :rails_env, "production"
  set :environment_database, defer { production_database }
  set :environment_dbhost, defer { production_dbhost }
end

Bundle Without Specified Groups

If you manage your Gemfile with specific groups and would like Bundler to skip installing those groups on deployment, please add this option to your deploy.rb file:

set :bundle_without, "test deployment ci"

This would overwrite the default which would be test deployment and then run this during the deploy:

bundle install --without test deployment ci

Managing eycap with your Gemfile

When including eycap in your Gemfile and in your :development group, just add the :require => false to the end of your gem statement like so:

group :development do
  gem "eycap", :require => false
end

And then it won't need it as a runtime dependency for the app to run, but it will still be documented and installed when you bundle install.