Class: Relay
- Inherits:
-
Object
- Object
- Relay
- Defined in:
- lib/relay.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Instance Method Summary collapse
- #command(command) ⇒ Object
-
#initialize ⇒ Relay
constructor
A new instance of Relay.
- #recipe(recipe) ⇒ Object
- #run(servers) ⇒ Object
Constructor Details
#initialize ⇒ Relay
Returns a new instance of Relay.
45 46 47 48 |
# File 'lib/relay.rb', line 45 def initialize @recipes = [] @commands = [] end |
Instance Method Details
#command(command) ⇒ Object
54 55 56 |
# File 'lib/relay.rb', line 54 def command(command) @commands << command end |
#recipe(recipe) ⇒ Object
50 51 52 |
# File 'lib/relay.rb', line 50 def recipe(recipe) @recipes << recipe end |
#run(servers) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/relay.rb', line 58 def run(servers) servers.each do |server| Ssh.new(server).start do |session| @commands.each do |command| session.run(command) end @recipes.each do |recipe| File.readlines(recipe).each do |command| session.run(command) end end end end end |