Sha256: 2f9d81e501ec5dd9a8f351580817831f78fa13e7fb55d169b9d9205a3a9eaf53

Contents?: true

Size: 831 Bytes

Versions: 13

Compression:

Stored size: 831 Bytes

Contents

module AutotestNotification  
  class Doom
    class << self
      def image(total, failures)
        "#{Config.images_directory}/doom/doom_#{percent(total, failures)}.png"
      end

      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

      private
        def percent(total, failures)
          percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
        end
    end
  end  
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
carlosbrando-autotest-notification-1.9.0 lib/autotest_notification/doom.rb
carlosbrando-autotest-notification-1.9.1 lib/autotest_notification/doom.rb
carlosbrando-autotest-notification-2.0.0 lib/autotest_notification/doom.rb
samflores-autotest-notification-1.9.1 lib/autotest_notification/doom.rb
autotest-notification-2.3.4 lib/autotest_notification/doom.rb
autotest-notification-2.3.3 lib/autotest_notification/doom.rb
autotest-notification-2.3.2 lib/autotest_notification/doom.rb
autotest-notification-2.3.1 lib/autotest_notification/doom.rb
autotest-notification-2.3.0 lib/autotest_notification/doom.rb
autotest-notification-2.2.1 lib/autotest_notification/doom.rb
blackwinter-autotest-notification-2.2.0 lib/autotest_notification/doom.rb
autotest-notification-2.2.0 lib/autotest_notification/doom.rb
autotest-notification-2.1.0 lib/autotest_notification/doom.rb