Capistrano 3用角色调用任务?

时间:2014-06-04 22:46:02

标签: ruby-on-rails ruby capistrano capistrano3

namespace :package do
  task :install, :packages do |task, args|
    on roles(:all) do
      execute :sudo, "apt-get install -y #{args[:packages]}"
    end
  end
end

namespace :git do
  task :install do
    # 1 code
    invoke 'package:install', 'git-core' # works but I want this installed only on the :app role
    # 2 code
    on role(:app) do
      invoke 'package:install', 'git-core' # errors
    end
  end
end

注意:我没有运行#1#2,我正在运行#1#2

是否有办法invoke任务指定执行哪个role

0 个答案:

没有答案