Class: Claws::Capistrano
- Inherits:
-
Object
- Object
- Claws::Capistrano
- Defined in:
- lib/claws/capistrano.rb
Instance Attribute Summary collapse
-
#home ⇒ Object
Returns the value of attribute home.
Instance Method Summary collapse
- #all_host_roles ⇒ Object
-
#initialize(home = nil) ⇒ Capistrano
constructor
A new instance of Capistrano.
- #roles(host) ⇒ Object
Constructor Details
#initialize(home = nil) ⇒ Capistrano
Returns a new instance of Capistrano.
5 6 7 |
# File 'lib/claws/capistrano.rb', line 5 def initialize(home = nil) self.home = home || File.join('config', 'deploy') end |
Instance Attribute Details
#home ⇒ Object
Returns the value of attribute home.
3 4 5 |
# File 'lib/claws/capistrano.rb', line 3 def home @home end |
Instance Method Details
#all_host_roles ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/claws/capistrano.rb', line 9 def all_host_roles @all_roles ||= begin roles = Hash.new Dir.glob(File.join(self.home, '**/*.rb')).each do |f| environment = File.basename(f)[0..-4] roles[environment.to_sym] = get_roles(environment) end roles end end |
#roles(host) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/claws/capistrano.rb', line 22 def roles(host) self.all_host_roles.each do |env, hh| hh.each do |k,v| return v if k == host end end end |