Class: Malevich::Kernel

Inherits:
Object
  • Object
show all
Includes:
Loader
Defined in:
lib/malevich.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Loader

#find_plugin, #load_plugins, #load_responders

Constructor Details

#initializeKernel

Returns a new instance of Kernel.



10
11
12
13
14
15
16
17
# File 'lib/malevich.rb', line 10

def initialize
  @config = Malevich::Hashie.new # for config from file
  @cmd = Malevich::Hashie.new
  @plugins = Malevich::Hashie.new # for plugin containers (errors, settings)
  @logger = Logger.new(STDOUT)
  @monitor = Malevich::Monitor.new
  @riemann_events = ::Queue.new
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



8
9
10
# File 'lib/malevich.rb', line 8

def cmd
  @cmd
end

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/malevich.rb', line 8

def config
  @config
end

#dslObject (readonly)

Returns the value of attribute dsl.



8
9
10
# File 'lib/malevich.rb', line 8

def dsl
  @dsl
end

#monitorObject (readonly)

Returns the value of attribute monitor.



8
9
10
# File 'lib/malevich.rb', line 8

def monitor
  @monitor
end

#ohaiObject (readonly)

Returns the value of attribute ohai.



8
9
10
# File 'lib/malevich.rb', line 8

def ohai
  @ohai
end

#pluginsObject (readonly)

Returns the value of attribute plugins.



8
9
10
# File 'lib/malevich.rb', line 8

def plugins
  @plugins
end

#riemann_eventsObject (readonly)

Returns the value of attribute riemann_events.



8
9
10
# File 'lib/malevich.rb', line 8

def riemann_events
  @riemann_events
end

Instance Method Details

#log(level = :info, message) ⇒ Object



25
26
27
# File 'lib/malevich.rb', line 25

def log(level = :info, message)
  @logger.send(level.to_sym, message)
end

#log_level=(level = 'INFO') ⇒ Object



29
30
31
# File 'lib/malevich.rb', line 29

def log_level=(level = 'INFO')
  @logger.level = Logger.const_get(level)
end

#test_plugin(file) ⇒ Object



19
20
21
22
23
# File 'lib/malevich.rb', line 19

def test_plugin(file)
  return unless malevich.cmd[:test_given]
  Malevich::DSL.test(file).run!
  exit 0
end