Class: Bolt::Notifiers::NotifyOsd
- Inherits:
-
Object
- Object
- Bolt::Notifiers::NotifyOsd
- Defined in:
- lib/bolt/notifiers/notify_osd.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#use_growlnotify ⇒ Object
Returns the value of attribute use_growlnotify.
Instance Method Summary collapse
- #error(name, description) ⇒ Object
-
#info(name, description) ⇒ Object
info message.
-
#initialize(pars = {}) ⇒ NotifyOsd
constructor
A new instance of NotifyOsd.
-
#notify(title, msg, img, pri = 'normal') ⇒ Object
generic notify method.
- #result(filename, results) ⇒ Object
-
#test_file_missing(filename) ⇒ Object
message to be displayed when test file is missing.
Constructor Details
#initialize(pars = {}) ⇒ NotifyOsd
Returns a new instance of NotifyOsd.
13 14 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 13 def initialize(pars = {}) end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
11 12 13 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 11 def host @host end |
#use_growlnotify ⇒ Object
Returns the value of attribute use_growlnotify.
11 12 13 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 11 def use_growlnotify @use_growlnotify end |
Instance Method Details
#error(name, description) ⇒ Object
53 54 55 56 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 53 def error(name, description) image_path = File.dirname(__FILE__) + "/../../../images/failed.png" notify name, description.to_s, image_path end |
#info(name, description) ⇒ Object
info message
22 23 24 25 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 22 def info(name, description) image_path = File.dirname(__FILE__) + "/../../../images/pending.png" notify name, description.to_s, image_path end |
#notify(title, msg, img, pri = 'normal') ⇒ Object
generic notify method
17 18 19 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 17 def notify(title, msg, img, pri = 'normal') system "notify-send -i #{img} -u #{pri} '#{title}' '#{msg}'" end |
#result(filename, results) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 34 def result(filename, results) = results if results.match('example') #rspec if results.match('pending') icon = 'pending' elsif results.match('0 failures') icon = 'success' else icon = 'failed' end elsif (results.match('0 failures, 0 errors')) # test::unit icon = 'success' else icon = 'failed' end image_path = File.dirname(__FILE__) + "/../../../images/#{icon}.png" notify "Test results for: #{filename}", , image_path end |
#test_file_missing(filename) ⇒ Object
message to be displayed when test file is missing
28 29 30 31 32 |
# File 'lib/bolt/notifiers/notify_osd.rb', line 28 def test_file_missing(filename) image_path = File.dirname(__FILE__) + "/../../../images/failed.png" = "The following test file could not be found: #{filename}" notify "Could not find test file", , image_path end |