使用 Capistrano 定义捆绑路径

2024-01-11

我在 capistrano 的 deploy.rb 文件中使用以下配置:

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"
}

但当我跑步时cap deploy:update我明白了:

* 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"

也就是说,它没有将包路径(--path 参数)设置为我想要的位置。

我尝试过很多教程,包括RVM Capistrano 教程 https://rvm.io/integration/capistrano/#gem但似乎没有任何作用。它继续使用 capistrano 默认值。

Capistrano 还使用以下 .bundler/config 创建应用程序

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

开发机器:Windows 7、bundler (1.0.22)、capistrano (2.12.0)、rvm-capistrano (1.2.7)、rails (3.2.8)、(无 rvm)

生产:Debian、bundler (1.2.1)(无 capistrano)、(无 rvm-capistrano)、rails (3.2.8)、rvm 1.16.5


谢谢约瑟夫·霍尔斯坦的博客 http://web.archive.org/web/20120622085031/http://blog.josephholsten.com/2010/09/deploying-with-bundler-and-capistrano我能够确定我的问题是在我需要“bundler/capistrano”之前我没有在deploy.rb中定义bundler变量。我还需要定义 bundle_dir 变量,以创建如下所示的代码:

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'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

使用 Capistrano 定义捆绑路径 的相关文章

随机推荐