Quantcast
Channel: capistrano - There's an echo in my head
Viewing all articles
Browse latest Browse all 15

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

$
0
0

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

Viewing all articles
Browse latest Browse all 15

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>