如何重写 capistrano 2 任务,与 capistarano 3 有“例外”



我想以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  

我可以像这样根据卡皮斯特拉诺的文件重写。

  %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}部分,也找不到有关它的文档。

如何重写?

  %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

最新更新