我想用capistrano 3改写一个capistrano 2任务。
此代码来自Railscast 335
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command, roles: :app, except: {no_release: true} do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
我可以根据这样的capistrano文件重写。
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command do
on roles(:app) do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
end
但我不知道如何重写except: {no_release: true}
部分,我找不到有关它的文档。
我怎样才能改写它?
答案 0 :(得分:1)
%w[start stop restart].each do |command|
desc "#{command} unicorn server"
task command do
on roles(:app), reject: lambda { |h| h.properties.no_release } do
run "/etc/init.d/unicorn_#{application} #{command}"
end
end
end
更多信息:http://capistranorb.com/2013/06/01/release-announcement.html