There's an echo in my head

日々のメモ。

Capistranoで今処理しようとしているhostの属するroleを判定する

host.rolesを叩くと、role(のSymbol)のSetが返ってくる。

task :foo do
  on release_roles :all do |host|
    host.roles #=> #<Set: {:web, :app, :db}> 
  end
end

git_strategyの中でもcontextを通して同じことができる。

set :git_strategy, MyGitStrategy

module MyGitStrategy
  def release
    context.host.roles #=> #<Set: {:web, :app, :db}> 
  end
end
このブログに出てくるコードスニペッツは、引用あるいは断りがない限りMITライセンスです。