2011-11-13 26 views
3

Capistrano在我的deploy.rb中不能與rvmsudo一起使用。Capistrano rvmsudo

我試圖

set :sudo, 'rvmsudo' 
set :sudo_prompt, 'password: ' 

然後用流動的命令:

sudo "god -c config/unicorn.god --log-level debug" 

但Capistrano的卡上的密碼提示。

此解決方案here說使用sudo "whoami",然後rvmsudo,因爲它會記住您的密碼5分鐘,但我的密碼不記得。

方面:

desc "Start unicorn" 
    task :start, :except => { :no_release => true } do 
    sudo "god -c config/unicorn.god --log-level debug" 
end 

回答

3

你在做

require 'bundler/capistrano' 

其哈克,但你可以嘗試:

after "deploy:update_code", :do_bundle_install 

task :do_bundle_install do 
    run "cd #{current_release} && rvmsudo bundle install --gemfile #{current_release}/Gemfile --path {path to install}/bundle --without development test cucumber" 
end 
+0

是的,我正在做'require bundler/capistrano' – LanguagesNamedAfterCofee

+0

而且我無法完成你建議的內容,因爲我正在使用這個上下文(更新後的文章) – LanguagesNamedAfterCofee

+0

這實際上對任何人都有效嗎?即使在觸發任務中,rvmsudo也不適用於我 – NikoRoberts

1

嘗試使用sudo運行命令裏面,但在調用須藤從集:

task :do_something do 
    run "#{sudo} root task" 
end 

如果您改變了主意這樣,您不需要重寫所有任務,只能刪除set :sudo

3

嘗試使用此:

task :do_something do 
    run "cd #{latest_release} && rvmsudo -p '#{sudo_prompt}' some_command" 
end 

它爲我工作!