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
Added Doom sounds.
carlosbrando (author)
Wed Jun 18 07:48:13 -0700 2008
commit  783b089b82447310757ccb1a8dbf567d9b15de89
tree    5b573cca8a8d07f2b798e1bace40633b75f0505d
parent  681a12754784b75b7978cc29ec408536e1530638
...
34
35
36
 
37
38
39
...
43
44
45
46
47
 
 
 
 
 
 
 
 
48
...
34
35
36
37
38
39
40
...
44
45
46
 
47
48
49
50
51
52
53
54
55
56
0
@@ -34,6 +34,7 @@ website/stylesheets/screen.css
0
 website/template.html.erb
0
 bin/an-install
0
 bin/an-uninstall
0
+bin/playsound
0
 images/pass.png
0
 images/fail.png
0
 autotest-notification.gemspec
0
@@ -43,4 +44,11 @@ images/doom/doom_2.png
0
 images/doom/doom_3.png
0
 images/doom/doom_4.png
0
 images/doom/doom_5.png
0
-images/doom/doom_6.png
0
\ No newline at end of file
0
+images/doom/doom_6.png
0
+sounds/doom/0.wav
0
+sounds/doom/1.wav
0
+sounds/doom/2.wav
0
+sounds/doom/3.wav
0
+sounds/doom/4.wav
0
+sounds/doom/5.wav
0
+sounds/doom/6.wav
0
\ No newline at end of file
...
46
47
48
49
 
50
51
52
...
46
47
48
 
49
50
51
52
0
@@ -46,7 +46,7 @@ module AutotestNotification
0
       when /linux/
0
         Linux.notify(title, msg, img, failures)
0
       when /darwin/
0
- Mac.notify(title, msg, img, failures, pri)
0
+ Mac.notify(title, msg, img, total, failures, pri)
0
       when /cygwin/
0
         Cygwin.notify(title, msg, img)
0
       when /mswin/
...
2
3
4
5
6
 
7
 
 
 
 
 
 
 
 
 
8
9
10
...
2
3
4
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
0
@@ -2,9 +2,17 @@ module AutotestNotification
0
   class Doom
0
     class << self
0
       def image(total, failures)
0
- percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
0
- "#{IMAGES_DIRECTORY}/doom/doom_#{percent}.png"
0
+ "#{IMAGES_DIRECTORY}/doom/doom_#{percent(total, failures)}.png"
0
       end
0
+
0
+ def play_sound(total, failures)
0
+ `#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/#{percent(total, failures)}.wav`
0
+ end
0
+
0
+ private
0
+ def percent(total, failures)
0
+ percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
0
+ end
0
     end
0
   end
0
 end
...
3
4
5
6
 
 
7
8
 
9
10
11
 
12
13
 
14
15
16
 
17
18
19
 
20
21
22
...
3
4
5
 
6
7
8
 
9
10
11
 
12
13
 
14
15
16
 
17
18
19
20
21
22
23
24
0
@@ -3,20 +3,22 @@ module AutotestNotification
0
     @last_test_failed = false
0
 
0
     class << self
0
- def notify(title, msg, img, failures = 0, pri = 0)
0
+
0
+ def notify(title, msg, img, total = 1, failures = 0, pri = 0)
0
         system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title}"
0
- say(failures) if SPEAKING
0
+ say(total, failures) if SPEAKING
0
       end
0
 
0
- def say(failures)
0
+ def say(total, failures)
0
         if failures > 0
0
- system("say #{failures} test#{'s' unless failures == 1} failed.")
0
+ DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
0
           @last_test_failed = true
0
         elsif @last_test_failed
0
- system("say All tests passed successfully.")
0
+ DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.")
0
           @last_test_failed = false
0
         end
0
       end
0
+
0
     end
0
   end
0
 end
...
1
2
3
4
 
5
6
7
...
1
2
3
 
4
5
6
7
0
@@ -1,7 +1,7 @@
0
 module AutotestNotification #:nodoc:
0
   module VERSION #:nodoc:
0
     MAJOR = 1
0
- MINOR = 2
0
+ MINOR = 3
0
     TINY = 0
0
 
0
     STRING = [MAJOR, MINOR, TINY].join('.')

Comments

    No one has commented yet.