pex
pex

Reputation: 7731

Capistrano: use Bundle Gems from standard Gem-Home

When deploying with Capistrano I want to use installed gems instead of installing them into vendor.

Capistrano seems to ignore .gemrc & .bashrc, so I tried this in deploy.rb:

require 'bundler/capistrano'

set :default_environment, {
  'GEM_HOME'     => '/some_path/.gem',
  'GEM_PATH'     => '/some_path/.gem',
  'BUNDLE_PATH'  => '/some_path/.gem'
}

My gems are located in /some_path/.gem/gems, bin: /some_path/.gem/bin.

Upvotes: 3

Views: 2743

Answers (4)

branded items
branded items

Reputation: 19

It is the manifestation of the YAML engine switch from Syck to Psych and all of the incompatibilities it has brought. The problem is that now you have to reinstall all of your gems, because all installed gems have wrong gemspec specification.

Upvotes: 1

Paweł Gościcki
Paweł Gościcki

Reputation: 9594

Here's what I have in my config/deploy.rb to tell bundler to install gems into "system" gems:

require "bundler/capistrano"
set :bundle_dir,     ""         # install into "system" gems
set :bundle_flags,   "--quiet"  # no verbose output
set :bundle_without, []         # bundle all gems (even dev & test)

http://paulgoscicki.com/archives/2011/10/tell-bundler-to-install-gems-globally-when-using-capistrano/

Upvotes: 3

Gurpartap Singh
Gurpartap Singh

Reputation: 2764

If you are doing

require 'bundler/capistrano'

Put this in deploy.rb to set bundle install's --path arg:

set :bundle_dir, "/path/to/gems"

Upvotes: 3

lebreeze
lebreeze

Reputation: 5134

You can tell bundler where gems should go (or are I believe) and pass the --local to install from the local gem caches as opposed to fetching from http://rubygems.org

bundle install --local --path='/some_path/.gem

Upvotes: 2

Related Questions