Sha256: 26949025ac87553270a87d86d900bb6f55b26a32cb0ec75fa653bcd93be09dfc

Contents?: true

Size: 736 Bytes

Versions: 5

Compression:

Stored size: 736 Bytes

Contents

module AutotestNotification
  class Doom
    class << self
      def image(total, failures)
        "#{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}")
        end
      end

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

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
carlosbrando-autotest-notification-1.4.0 lib/autotest_notification/doom.rb
carlosbrando-autotest-notification-1.5.0 lib/autotest_notification/doom.rb
tapajos-autotest-notification-1.4.0 lib/autotest_notification/doom.rb
tchandy-autotest-notification-1.4.0 lib/autotest_notification/doom.rb
urubatan-autotest-notification-1.4.0 lib/autotest_notification/doom.rb