module Lighthouse

Constants

STATUS_MAPPER

Public Class Methods

map_status(status) click to toggle source
# File lib/lighthouse/core.rb, line 83
def map_status(status)
  STATUS_MAPPER[(status.to_s rescue nil)]
end
node(name="unknown", options={}) { || ... } click to toggle source
# File lib/lighthouse/core.rb, line 58
def node(name="unknown", options={})
  raise "node shouldn't be inside node block." if @node != nil
  @node=name
  @group=options[:group]
  @contact=options[:contact]
  @variables=options[:variables]
  if block_given?
    yield
  end
  rescue LighthouseException
  rescue => e
    report(:fail, e.message, true)
  ensure
  @node=nil
  @group=nil
  @contact=nil
  @variables=nil
end
project(name="unknown") { || ... } click to toggle source
# File lib/lighthouse/core.rb, line 33
def project(name="unknown")
  raise "project shouldn't be inside project block." if @project != nil
  @project=name
  if block_given?
    yield
  end
  rescue => e
    raise "This is custom raising error\nChange this at Lighthouse::Core\n"+e.message
  ensure
  @node=nil
  @topic=nil
  @group=nil
  @project=nil
end
report(status, message=nil, noraise=false) click to toggle source
# File lib/lighthouse/core.rb, line 77
def report(status, message=nil, noraise=false)
  status = map_status(status)
  Client.send_message({:status => status, :message => message, :project => @project, :topic => @topic, :group => @group, :node => @node, :contact => @contact, :variables => @variables})
  raise LighthouseException.new("done") unless noraise
end
topic(name="unknown", options={}) { || ... } click to toggle source
# File lib/lighthouse/core.rb, line 48
def topic(name="unknown", options={})
  raise "topic shouldn't be inside topic block." if @topic != nil
  @topic=name
  if block_given?
    yield
  end
  ensure
  @topic=nil
end