我有以下 cap3 任务
task :gemset do
on roles(:all) do
if remote_dir_exists?(".rvm")
execute :rvm, :gemset, :use, "#{ Configs.rvm.ruby }@#{ Configs.rvm.gemset } --create"
else
info "RVM not installed"
end
end
end
用于设置
rvm:
ruby: ruby-2.0.0-p247
gemset: cap3
它应该在我的服务器上执行以下命令
rvm gemset use ruby-2.0.0-p247@cap3 --create
但它给了我
DEBUG [9bd5fc11] RVM is not a function, selecting rubies with 'rvm use ...' will not work.
DEBUG [9bd5fc11]
DEBUG [9bd5fc11] You need to change your terminal emulator preferences to allow login shell.
DEBUG [9bd5fc11] Sometimes it is required to use `/bin/bash --login` as the command.
DEBUG [9bd5fc11] Please visit https://rvm.io/integration/gnome-terminal/ for a example.
它被解决了
SSHKit.config.command_map.prefix[:rvm].push("source .bash_profile &&")
现在我的任务看起来像这样
task :gemset do
on roles(:all) do
if remote_dir_exists?(".rvm")
SSHKit.config.command_map.prefix[:rvm].push("source .bash_profile &&")
execute :rvm, :gemset, :use, "#{ Configs.rvm.ruby }@#{ Configs.rvm.gemset } --create"
else
info "RVM not installed"
end
end
end
在 capistrano 2 中,我有以下设置
default_run_options[:shell] = "/bin/bash --login"
但在 cap3 中它不起作用
我尝试使用
set :pty, true
set :shell, '/bin/bash --login'
set :default_shell, '/bin/bash --login'
但在 cap3 中它也不起作用
如何在没有 SSHkit.config 挂钩的情况下解决 cap3 中的bash --login问题?