Class: Group
- Inherits:
-
Object
- Object
- Group
- Defined in:
- lib/cosmo/group.rb
Instance Method Summary collapse
- #accounts ⇒ Object
- #cp(options = {:files => [], :to => []}) ⇒ Object
- #dry_run(*commands) ⇒ Object
-
#initialize(name, accounts) ⇒ Group
constructor
A new instance of Group.
- #local ⇒ Object
- #machines ⇒ Object
- #remotes ⇒ Object
- #run(*commands) ⇒ Object
Constructor Details
#initialize(name, accounts) ⇒ Group
Returns a new instance of Group.
2 3 4 5 |
# File 'lib/cosmo/group.rb', line 2 def initialize name, accounts @name = name @accounts = accounts end |
Instance Method Details
#accounts ⇒ Object
27 28 29 |
# File 'lib/cosmo/group.rb', line 27 def accounts @accounts end |
#cp(options = {:files => [], :to => []}) ⇒ Object
43 44 45 46 47 |
# File 'lib/cosmo/group.rb', line 43 def cp = {:files => [], :to => []} @accounts.each do |account| account.cp end end |
#dry_run(*commands) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cosmo/group.rb', line 15 def dry_run *commands @accounts.each do |account| commands.each do |command| account.dry_run command end end end |
#local ⇒ Object
31 32 33 34 35 |
# File 'lib/cosmo/group.rb', line 31 def local locals = [] @accounts.each {|m| locals.push m if m.local?} locals.first end |
#machines ⇒ Object
23 24 25 |
# File 'lib/cosmo/group.rb', line 23 def machines @accounts.map {|a| a.machine}.uniq end |
#remotes ⇒ Object
37 38 39 40 41 |
# File 'lib/cosmo/group.rb', line 37 def remotes remotes = [] @accounts.each {|m| remotes.push m unless m.local?} remotes end |