class Gusteau::SSHConfig

Public Class Methods

new(nodes) click to toggle source
# 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

Public Instance Methods

section(name, server) click to toggle source
# 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() click to toggle source
# File lib/gusteau/ssh_config.rb, line 25
    def to_s
      <<-eos
# BEGIN GUSTEAU NODES

#{@config.join("\n")}
# END GUSTEAU NODES
      eos
    end