1

我正在使用 CentOS。这是我的输出:

# which rvm
/usr/local/rvm/bin/rvm
# rvm ruby-1.9.3-p392@gemset
# /usr/local/rvm/bin/rvm ruby-1.9.3-p392@gemset
RVM is not a function, selecting rubies with 'rvm use ...' will not work.

You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

如您所见,我是否正在使用rvm一切正常。但是capistrano在这样的命令中使用完整路径

[46f28bd9] Command: cd /var/www/app/releases/20140718172057 && /usr/local/rvm/bin/rvm ruby-1.9.3-p392@gemset do bundle install --binstubs /var/www/app/shared/bin --path /var/www/app/shared/bundle --without development test --deployment --verbose

所以它只是失败了,所有的宝石都安装在默认的 ruby​​ 上,而不是ruby-1.9.3-p392@gemset

感谢您的任何建议。

4

1 回答 1

1

我的假设:

  • 您正在使用 Capistrano v3
  • 已经包含require 'capistrano/rvm'在您的 Capfile 中
  • 当你cd进入你的项目目录时,你就有了类似的东西.ruby-version.ruby-gemset为你设置了 RVM。

您可能想尝试这样的事情

within fetch(:current_path) do
    with rails_env: fetch(:rails_env) do
        execute :bundle, "install"
    end
end

任务在 v3 中的工作方式不同:https ://github.com/capistrano/capistrano#tasks

tl; dr: execute(:bundle, :install) 和 execute('bundle install') 的行为不同!

于 2014-07-24T07:38:24.550 回答