Define Bundle Path With Capistrano

2019-03-31 19:44发布

I am using the following configurations in my deploy.rb file for capistrano:

require 'bundler/capistrano'
require 'rvm/capistrano'

set :bundle_cmd, "/home/deployment/.rvm/gems/ruby-1.9.3-p194@global/bin/bundle"

set :default_environment, {
    'PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194/bin:/home/deployment/.rvm/bin:$PATH",
    'RUBY_VERSION' => 'ruby 1.9.3',
    'GEM_HOME' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194",
    'GEM_PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194",
    'BUNDLE_PATH' => "/home/deployment/.rvm/gems/ruby-1.9.3-p194"
}

But when I run cap deploy:update I get this:

* executing "cd /var/www/currienet/marketplace/releases/20120928140140 && /home/deployment/.rvm/gems/ruby-1.9.3-p194@global/bin/bundle install --gemfile /var/www/currienet/marketplace/releases/20120928140140/Gemfile --path /var/www/currienet/marketplace/shared/bundle --deployment --quiet --without development test"

That is, it's not setting the bundle path (the --path argument) to what I want it to be.

I've tried a number of tutorials, including the rvm capistrano tutorial but nothing seems to work. It continues to use the capistrano default.

Capistrano also creates an application with the following .bundler/config

BUNDLE_FROZEN: '1'
BUNDLE_PATH: /var/www/currienet/marketplace/shared/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
BUNDLE_WITHOUT: development:test

Development Machine: Windows 7, bundler (1.0.22), capistrano (2.12.0), rvm-capistrano (1.2.7), rails (3.2.8), (no rvm)

Production: Debian, bundler (1.2.1) (no capistrano), (no rvm-capistrano), rails (3.2.8), rvm 1.16.5

1条回答
【Aperson】
2楼-- · 2019-03-31 20:31

Thanks to Joseph Holsten's blog I was able to ascertain my problem was I was not defining the bundler variables in my deploy.rb before I required 'bundler/capistrano'. I also needed to define the bundle_dir variable, to create code that looks like the following:

set :bundle_cmd, "/home/deployment/.rvm/gems/ruby-1.9.3-p194@global/bin/bundle"
set :bundle_dir, "/home/deployment/.rvm/gems/ruby-1.9.3-p194"

require 'bundler/capistrano'
查看更多
登录 后发表回答