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
Special Doom Edition. Only for Mac.
carlosbrando (author)
Mon Jun 16 07:03:33 -0700 2008
commit  87dacb8b184b664f9a100704a5c5d02f28d96b7a
tree    fcbecd77385d6b3f64aae6dafd7c329bd7f5dbe0
parent  a642737b9a19e7d2d8a878ff93b160da66eaed6d
...
12
13
14
 
15
16
17
...
36
37
38
 
39
40
41
42
43
44
45
46
 
47
...
12
13
14
15
16
17
18
...
37
38
39
40
41
42
43
44
45
 
 
46
47
48
0
@@ -12,6 +12,7 @@ lib/autotest_notification/linux.rb
0
 lib/autotest_notification/windows.rb
0
 lib/autotest_notification/cygwin.rb
0
 lib/autotest_notification/mac.rb
0
+lib/autotest_notification/doom.rb
0
 script/console
0
 script/destroy
0
 script/generate
0
@@ -36,10 +37,10 @@ bin/an-uninstall
0
 images/pass.png
0
 images/fail.png
0
 autotest-notification.gemspec
0
+images/doom/doom_0.png
0
 images/doom/doom_1.png
0
 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
-images/doom/doom_7.png
0
\ No newline at end of file
0
+images/doom/doom_6.png
0
\ No newline at end of file
...
16
17
18
19
 
 
20
21
22
...
35
36
37
38
39
 
 
 
 
 
 
40
41
42
...
54
55
56
 
57
58
59
60
...
16
17
18
 
19
20
21
22
23
...
36
37
38
 
 
39
40
41
42
43
44
45
46
47
...
59
60
61
62
63
64
65
66
0
@@ -16,7 +16,8 @@ require 'ftools'
0
 
0
 OPTIONS = {
0
   :path => '~',
0
- :speaking => false
0
+ :speaking => false,
0
+ :doom => false
0
 }
0
 MANDATORY_OPTIONS = %w( )
0
 
0
@@ -35,8 +36,12 @@ BANNER
0
           "Default: ~") { |OPTIONS[:path]| }
0
           
0
   opts.on("-s", "--speaking",
0
- "If a test failed, the computer will speak.",
0
- "Only for Mac.") { |OPTIONS[:speaking]| OPTIONS[:speaking] = true }
0
+ "If a test failed, the computer will speak.",
0
+ "For all plataforms.") { |OPTIONS[:speaking]| OPTIONS[:speaking] = true }
0
+
0
+ opts.on("-d", "--doom",
0
+ "Special Doom Edition.",
0
+ "Only for Mac.") { |OPTIONS[:doom]| OPTIONS[:doom] = true }
0
           
0
   opts.on("-h", "--help",
0
           "Show this help message.") { puts opts; exit }
0
@@ -54,6 +59,7 @@ f = File.new(File.expand_path(path) + "/.autotest", "w")
0
 f.write "# ~.autotest\n"
0
 f.write "require 'autotest_notification'\n"
0
 f.write("SPEAKING = #{OPTIONS[:speaking]}\n")
0
+f.write("DOOM_EDITION = #{OPTIONS[:doom]}\n")
0
 f.close
0
 puts "\nAs from now all tests will be notified automatically."
0
 puts "" # a blank line
0
\ No newline at end of file
...
1
2
 
3
4
5
6
7
8
 
 
 
9
10
11
...
28
29
30
31
 
32
33
 
34
35
36
...
38
39
40
41
 
42
43
44
45
46
 
47
48
49
...
1
 
2
3
4
5
 
 
 
6
7
8
9
10
11
...
28
29
30
 
31
32
 
33
34
35
36
...
38
39
40
 
41
42
43
44
45
 
46
47
48
49
0
@@ -1,11 +1,11 @@
0
 $:.unshift(File.dirname(__FILE__))
0
-%w{ linux mac windows cygwin }.each { |x| require "autotest_notification/#{x}" }
0
+%w{ linux mac windows cygwin doom }.each { |x| require "autotest_notification/#{x}" }
0
 
0
 module AutotestNotification
0
   IMAGES_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../images/")
0
- SUCCESS_IMAGE = "#{IMAGES_DIRECTORY}/doom/doom_1.png"
0
- FAIL_IMAGE = "#{IMAGES_DIRECTORY}/doom/doom_7.png"
0
-
0
+ SUCCESS_IMAGE = "#{IMAGES_DIRECTORY}/pass.png"
0
+ FAIL_IMAGE = "#{IMAGES_DIRECTORY}/fail.png"
0
+
0
   EXPIRATION_IN_SECONDS = 3
0
 
0
   Autotest.add_hook :ran_command do |at|
0
@@ -28,9 +28,9 @@ module AutotestNotification
0
       end
0
 
0
       if @failures > 0 || @errors > 0
0
- notify "FAIL", msg, FAIL_IMAGE, @failures + @errors, 2
0
+ notify "FAIL", msg, FAIL_IMAGE, @tests + @examples, @failures + @errors, 2
0
       else
0
- notify "Pass", msg, SUCCESS_IMAGE
0
+ notify "Pass", msg, SUCCESS_IMAGE, @tests + @examples
0
       end
0
 
0
       puts "\e[#{code}m#{'=' * 80}\e[0m\n\n"
0
@@ -38,12 +38,12 @@ module AutotestNotification
0
   end
0
 
0
   class << self
0
- def notify(title, msg, img = SUCCESS_IMAGE, failures = 0, pri = 0)
0
+ def notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, pri = 0)
0
       case RUBY_PLATFORM
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/
...
1
2
 
3
4
5
6
 
 
 
 
7
 
 
8
9
 
 
10
11
12
...
14
15
16
 
17
18
19
...
1
2
3
4
5
6
 
7
8
9
10
11
12
13
14
 
15
16
17
18
19
...
21
22
23
24
25
26
27
0
@@ -1,12 +1,19 @@
0
 module AutotestNotification
0
   class Mac
0
+
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
+ img = Doom.image(total, failures) if DOOM_EDITION
0
+
0
         system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title}"
0
+ say(failures) if SPEAKING
0
+ end
0
 
0
- if SPEAKING && failures > 0
0
+ def say(failures)
0
+ if failures > 0
0
           system("say #{failures} test#{'s' unless failures == 1} failed.")
0
           @last_test_failed = true
0
         elsif @last_test_failed
0
@@ -14,6 +21,7 @@ module AutotestNotification
0
           @last_test_failed = false
0
         end
0
       end
0
+
0
     end
0
   end
0
 end
...
1
2
3
4
5
 
 
6
7
8
...
1
2
3
 
 
4
5
6
7
8
0
@@ -1,8 +1,8 @@
0
 module AutotestNotification #:nodoc:
0
   module VERSION #:nodoc:
0
     MAJOR = 1
0
- MINOR = 1
0
- TINY = 2
0
+ MINOR = 2
0
+ TINY = 0
0
 
0
     STRING = [MAJOR, MINOR, TINY].join('.')
0
   end

Comments

    No one has commented yet.