部署時我得到以下輸出:未定義的方法`用於主運行」:對象
cap aborted!
NoMethodError: undefined method `run' for main:Object
config/deploy.rb:37:in `block (2 levels) in <top (required)>'
/var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/dsl/task_enhancements.rb:12:in `block in after'
/var/lib/gems/1.9.1/gems/capistrano-3.2.1/lib/capistrano/application.rb:15:in `run'
/var/lib/gems/1.9.1/gems/capistrano-3.2.1/bin/cap:3:in `<top (required)>'
Tasks: TOP => deploy:permissions
(See full trace by running task with --trace)
The deploy has failed with an error: #<NoMethodError: undefined method `run' for main:Object>
我使用Capistrano的版本:3.2.1(瑞克版本:10.3.2)。 部署工作正常,但我創建了一個部署後的任務修改部署的版本看起來如此的所有者:
namespace :deploy do
task :permissions do
run "chown -R :#{fetch(:group)} #{deploy_to} && chmod -R g+s #{deploy_to}"
end
end
after :deploy, "deploy:permissions"
瓦爾正確定義(我固定在這之前的錯誤),但我得到這個缺少的方法錯誤運行方法,我不知道爲什麼。
它通過調用'on'來指定我想要運行代碼的位置。我也必須用execute命令替換run命令。 – agro