Class: AutotestNotification::Doom

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

Class Method Summary collapse

Class Method Details

.image(total, failures) ⇒ Object



4
5
6
# File 'lib/autotest_notification/doom.rb', line 4

def image(total, failures)
  "#{Config.images_directory}/doom/doom_#{percent(total, failures)}.png"
end

.play_sound(total, failures) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/autotest_notification/doom.rb', line 8

def play_sound(total, failures)
  sound_file = "#{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/#{percent(total, failures)}.wav"

  case RUBY_PLATFORM
  when /darwin/
    `#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
  when /linux/
    system("/usr/bin/mplayer #{sound_file} > /dev/null 2> /dev/null")
  when /cygwin/
    system "cp #{sound_file} /dev/dsp"
  end
end