部署时我得到以下输出:
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(Rake 版本: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"
变量定义正确(我之前修复了该错误),但我在运行方法中遇到了缺少方法错误,我不知道为什么。
您的代码使用 2.x 语法,而您的版本是 3.x。在 3.x 中,语法如下所示:
namespace :deploy do
on roles :all do
execute :chown, "-R :#{fetch(:group)} #{deploy_to} && chmod -R g+s #{deploy_to}"
end
end
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)