Module: Godlike
Overview
Godlike Extracted code from Carlos Brando’s autotest notifications Wanted to make something easy that would play a cool sound after a successful test run aka: GODLIKE
Instance Method Summary collapse
Instance Method Details
#fail ⇒ Object
31 32 33 |
# File 'lib/godlike.rb', line 31 def fail # do nothing end |
#pending ⇒ Object
35 36 37 |
# File 'lib/godlike.rb', line 35 def pending # do nothing end |
#play_sound(sound_file) ⇒ Object
10 11 12 |
# File 'lib/godlike.rb', line 10 def play_sound sound_file Thread.new { `#{File.expand_path(File.dirname(__FILE__) + "/../bin/")}/playsound #{sound_file}` } end |
#success ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/godlike.rb', line 14 def success sound_file = "" sounds_directory = "#{File.dirname(__FILE__)}/godlike/sounds" if defined?(GODLIKE_SOUND) sound_name = GODLIKE_SOUND.is_a?(Proc) ? GODLIKE_SOUND.call : GODLIKE_SOUND if File.exists? "#{sounds_directory}/#{sound_name}.mp3" sound_file = "#{sounds_directory}/#{sound_name}.mp3" else sound_file = sound_name end else sound_file = "#{sounds_directory}/godlike.mp3" end play_sound(sound_file) end |