public
Rubygem
Description: This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.
Homepage: http://www.nomedojogo.com/
Clone URL: git://github.com/carlosbrando/autotest-notification.git
100644 19 lines (16 sloc) 0.555 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module AutotestNotification
  class Doom
    class << self
      def image(total, failures)
        "#{IMAGES_DIRECTORY}/doom/doom_#{percent(total, failures)}.png"
      end
 
      def play_sound(total, failures)
        `#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/#{percent(total, failures)}.wav`
      end
 
      private
        def percent(total, failures)
          percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
        end
    end
  end
end