Method: CloudFlock::App::ServerProfile#initialize

Defined in:
lib/cloudflock/app/server-profile.rb

#initializeServerProfile

Public: Connect to and profile a remote host, then display the gathered information.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/cloudflock/app/server-profile.rb', line 14

def initialize
  options     = parse_options
  servers     = options[:servers]
  save_option = true unless servers
  servers   ||= [options]

  results = servers.map { |server| profile_host(server.dup, save_option) }
  printable = results.map do |hash|
    name = hash.keys.first
    profile = hash[name]
    UI.bold { UI.green { "#{name}\n" } } +
    generate_report(profile) +
    (options[:verbose] ? profile.process_list.to_s : "")
  end

  puts printable.join("\n\n")
end