Class: ServerStatus::Commands::Run

Inherits:
BaseCommand show all
Defined in:
lib/server-status/commands/run.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#config

Instance Method Summary collapse

Methods inherited from BaseCommand

#settings

Constructor Details

#initialize(config, options) ⇒ Run

Returns a new instance of Run.



4
5
6
7
8
# File 'lib/server-status/commands/run.rb', line 4

def initialize(config, options)
  super(config)

  @options = options
end

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/server-status/commands/run.rb', line 10

def perform
  unless settings['hosts']
    puts "No hosts tracked. To add hosts: server-status add <host> [name]"
    exit(1)
  end

  host_set = ServerStatus::HostSet.new(config, @options, settings['hosts'])
  host_set.fetch_statuses

  report = ServerStatus::Report.new(config, @options, host_set)
  puts report.generate_table
end