Class: AutotestNotification::Mac
- Inherits:
-
Object
- Object
- AutotestNotification::Mac
- Defined in:
- lib/autotest_notification/mac.rb
Class Method Summary collapse
- .notify(title, msg, img, total = 1, failures = 0, priority = 0) ⇒ Object
- .play(sound_file) ⇒ Object
- .say(total, failures) ⇒ Object
Class Method Details
.notify(title, msg, img, total = 1, failures = 0, priority = 0) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/autotest_notification/mac.rb', line 7 def notify(title, msg, img, total = 1, failures = 0, priority = 0) system "growlnotify -n autotest --image #{img} #{'-s ' if ((failures > 0) and STICKY)}-p #{priority} -m '#{msg}' -t #{title}" play(SUCCESS_SOUND) if AutotestNotification.const_defined?("SUCCESS_SOUND") && !SUCCESS_SOUND.empty? && failures == 0 play(FAILURE_SOUND) if AutotestNotification.const_defined?("FAILURE_SOUND") && !FAILURE_SOUND.empty? && failures > 0 say(total, failures) if SPEAKING end |
.play(sound_file) ⇒ Object
24 25 26 |
# File 'lib/autotest_notification/mac.rb', line 24 def play(sound_file) `#{File.(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}` end |
.say(total, failures) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/autotest_notification/mac.rb', line 14 def say(total, failures) if failures > 0 DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.") @last_test_failed = true elsif @last_test_failed DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.") @last_test_failed = false end end |