Class: AutotestNotification::Cygwin
- Inherits:
-
Object
- Object
- AutotestNotification::Cygwin
- Defined in:
- lib/autotest_notification/cygwin.rb
Class Method Summary collapse
- .get_image_path(img) ⇒ Object
- .notify(title, msg, img, total = 1, failures = 0) ⇒ Object
- .play(sound_file) ⇒ Object
- .say(total, failures) ⇒ Object
Class Method Details
.get_image_path(img) ⇒ Object
14 15 16 |
# File 'lib/autotest_notification/cygwin.rb', line 14 def get_image_path(img) `cygpath -m #{img}` end |
.notify(title, msg, img, total = 1, failures = 0) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/autotest_notification/cygwin.rb', line 6 def notify(title, msg, img, total = 1, failures = 0) img = get_image_path(img).strip system "sncmd /m '#{title}' '#{msg}' '#{img}' /t #{Config.expiration_in_seconds}" 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 DOOM_EDITION end |
.play(sound_file) ⇒ Object
28 29 30 |
# File 'lib/autotest_notification/cygwin.rb', line 28 def play(sound_file) system "cp #{sound_file} /dev/dsp" end |
.say(total, failures) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/autotest_notification/cygwin.rb', line 18 def say(total, failures) if failures > 0 Doom.play_sound(total, failures) @last_test_failed = true elsif @last_test_failed Doom.play_sound(total, failures) @last_test_failed = false end end |