Class: Gusteau::SSHConfig
- Inherits:
-
Object
- Object
- Gusteau::SSHConfig
- Defined in:
- lib/gusteau/ssh_config.rb
Instance Method Summary collapse
-
#initialize(nodes) ⇒ SSHConfig
constructor
A new instance of SSHConfig.
- #section(name, server) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(nodes) ⇒ SSHConfig
Returns a new instance of SSHConfig.
6 7 8 9 10 11 12 13 14 |
# File 'lib/gusteau/ssh_config.rb', line 6 def initialize(nodes) @config = [] nodes.sort.each do |name, node| if server = node.server @config << section(name, server) end end end |
Instance Method Details
#section(name, server) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/gusteau/ssh_config.rb', line 16 def section(name, server) <<-eos Host #{name} HostName #{server.host} Port #{server.port} User #{server.user} eos end |
#to_s ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/gusteau/ssh_config.rb', line 25 def to_s <<-eos # BEGIN GUSTEAU NODES #{@config.join("\n")} # END GUSTEAU NODES eos end |