Class: AutotestNotification::Mac

Inherits:
Object
  • Object
show all
Defined in:
lib/autotest_notification/mac.rb

Class Method Summary collapse

Class Method Details

.notify(title, msg, img, total = 1, failures = 0, priority = 0) ⇒ Object



7
8
9
10
# 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}"
  say(total, failures) if SPEAKING
end

.say(total, failures) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/autotest_notification/mac.rb', line 12

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