Class: StatMon::CLI::Execute

Inherits:
Object
  • Object
show all
Defined in:
lib/stat_mon/cli/execute.rb

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Execute

Returns a new instance of Execute.



5
6
7
8
# File 'lib/stat_mon/cli/execute.rb', line 5

def initialize(params)
  @params = params
  start
end

Instance Method Details

#load_config(config) ⇒ Object



17
18
19
20
# File 'lib/stat_mon/cli/execute.rb', line 17

def load_config( config )
  abort "Unable to find config file" unless File.exist?( config )
  load_stat_file( config )
end

#load_stat_file(stat_file) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/stat_mon/cli/execute.rb', line 23

def load_stat_file( stat_file )
  load File.expand_path( stat_file )
rescue Exception => e
  puts "There was an error in #{stat_file}"
  puts "\t" + e.message
  puts "\t" + e.backtrace.join("\n\y\t")
  
end

#startObject



10
11
12
13
14
15
# File 'lib/stat_mon/cli/execute.rb', line 10

def start
  StatMon.init
  config = load_config( @params[:config] )

  StatMon.start
end