Module: Autotest::Snarl

Defined in:
lib/autotest/snarl.rb

Constant Summary collapse

IMG_PATH =
File.expand_path(File.join(File.dirname(__FILE__), '..' , '..', 'img'))

Class Method Summary collapse

Class Method Details

.notify(title, text, klass, sticky = false) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/autotest/snarl.rb', line 39

def self.notify(title, text, klass, sticky = false)
  snarl.notify(
    :app => 'autotest',
    :title => title,
    :text => text,
    :class => klass,
    :timeout => sticky ? 0 : 5,
    :icon => File.join(IMG_PATH, "#{klass}.png")
  )
end

.snarlObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/autotest/snarl.rb', line 50

def self.snarl
  return @@snarl if defined?(@@snarl)

  @@snarl = Net::Snarl.new
  @@snarl.register('autotest')
  @@snarl.add_class('autotest', 'passed')
  @@snarl.add_class('autotest', 'failed')
  @@snarl.add_class('autotest', 'pending')
  @@snarl.add_class('autotest', 'error')
  @@snarl
end