urubatan-autotest-notification 1.0.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +22 -1
- data/Manifest.txt +19 -1
- data/README.txt +11 -1
- data/autotest-notification.gemspec +6 -6
- data/bin/an-install +19 -5
- data/bin/playsound +0 -0
- data/config/hoe.rb +1 -1
- data/config/requirements.rb +1 -1
- data/images/doom/doom_0.png +0 -0
- data/images/doom/doom_1.png +0 -0
- data/images/doom/doom_2.png +0 -0
- data/images/doom/doom_3.png +0 -0
- data/images/doom/doom_4.png +0 -0
- data/images/doom/doom_5.png +0 -0
- data/images/doom/doom_6.png +0 -0
- data/lib/autotest_notification.rb +31 -36
- data/lib/autotest_notification/cygwin.rb +1 -3
- data/lib/autotest_notification/doom.rb +25 -0
- data/lib/autotest_notification/linux.rb +34 -30
- data/lib/autotest_notification/mac.rb +16 -2
- data/lib/autotest_notification/version.rb +1 -1
- data/sounds/doom/0.wav +0 -0
- data/sounds/doom/1.wav +0 -0
- data/sounds/doom/2.wav +0 -0
- data/sounds/doom/3.wav +0 -0
- data/sounds/doom/4.wav +0 -0
- data/sounds/doom/5.wav +0 -0
- data/sounds/doom/6.wav +0 -0
- data/test/autotest_notification/test_linux.rb +45 -17
- data/test/autotest_notification/test_mac.rb +19 -0
- data/test/test_autotest_notification.rb +2 -2
- data/website/index.html +2 -2
- metadata +24 -3
data/History.txt
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
|
1
|
+
1.4.0 - Jun 18, 2008
|
2
|
+
* Special Doom Edition for Linux (ozsantana)
|
3
|
+
|
4
|
+
1.3.1 - Jun 18, 2008
|
5
|
+
* Added backup to old .autotest file (tchandy)
|
6
|
+
|
7
|
+
1.3.0 - Jun 18, 2008
|
8
|
+
* Added Doom sounds.
|
9
|
+
|
10
|
+
1.2.0 - Jun 17, 2008
|
11
|
+
* Special Doom Edition
|
12
|
+
|
13
|
+
1.1.2
|
14
|
+
* Refactoring code.
|
15
|
+
|
16
|
+
* 1.1.1
|
17
|
+
* Changed to speak when passing the tests after a series of failures. Only in Mac.
|
18
|
+
|
19
|
+
* 1.1.0
|
20
|
+
* Now speaking in Linux too.
|
21
|
+
|
22
|
+
* 0.3.0
|
2
23
|
* If a test failed, the computer will speak. Only for Mac.
|
3
24
|
|
4
25
|
* 0.2.2 2008-05-13
|
data/Manifest.txt
CHANGED
@@ -11,6 +11,8 @@ lib/autotest_notification/version.rb
|
|
11
11
|
lib/autotest_notification/linux.rb
|
12
12
|
lib/autotest_notification/windows.rb
|
13
13
|
lib/autotest_notification/cygwin.rb
|
14
|
+
lib/autotest_notification/mac.rb
|
15
|
+
lib/autotest_notification/doom.rb
|
14
16
|
script/console
|
15
17
|
script/destroy
|
16
18
|
script/generate
|
@@ -24,6 +26,7 @@ test/test_helper.rb
|
|
24
26
|
test/autotest_notification/test_cygwin.rb
|
25
27
|
test/autotest_notification/test_linux.rb
|
26
28
|
test/autotest_notification/test_windows.rb
|
29
|
+
test/autotest_notification/test_mac.rb
|
27
30
|
website/index.html
|
28
31
|
website/index.txt
|
29
32
|
website/javascripts/rounded_corners_lite.inc.js
|
@@ -31,6 +34,21 @@ website/stylesheets/screen.css
|
|
31
34
|
website/template.html.erb
|
32
35
|
bin/an-install
|
33
36
|
bin/an-uninstall
|
37
|
+
bin/playsound
|
34
38
|
images/pass.png
|
35
39
|
images/fail.png
|
36
|
-
autotest-notification.gemspec
|
40
|
+
autotest-notification.gemspec
|
41
|
+
images/doom/doom_0.png
|
42
|
+
images/doom/doom_1.png
|
43
|
+
images/doom/doom_2.png
|
44
|
+
images/doom/doom_3.png
|
45
|
+
images/doom/doom_4.png
|
46
|
+
images/doom/doom_5.png
|
47
|
+
images/doom/doom_6.png
|
48
|
+
sounds/doom/0.wav
|
49
|
+
sounds/doom/1.wav
|
50
|
+
sounds/doom/2.wav
|
51
|
+
sounds/doom/3.wav
|
52
|
+
sounds/doom/4.wav
|
53
|
+
sounds/doom/5.wav
|
54
|
+
sounds/doom/6.wav
|
data/README.txt
CHANGED
@@ -25,6 +25,8 @@ Independent of operating system you are using, you must install the ZenTest:
|
|
25
25
|
In your shell, cd to the directory on the Growl disk image containing growlnotify, and type ./install.sh.
|
26
26
|
That script will install growlnotify to /usr/local/bin and the manpage to /usr/local/man.
|
27
27
|
|
28
|
+
If you want to be notified with voice of the test results, when running an-install, pass a "-s" switch, when you do not want voices notifications anymore, just run it again without the "-s" switch.
|
29
|
+
|
28
30
|
|
29
31
|
* If you're using Windows (with cygwin):
|
30
32
|
You need to have Snarl and sncmd installed on your machine.
|
@@ -60,9 +62,11 @@ Independent of operating system you are using, you must install the ZenTest:
|
|
60
62
|
If you use KDE and do not have libnotify-bin installed, it will try to use kdialog wich is part of KDE.
|
61
63
|
It also works if you have zenity installed.
|
62
64
|
|
63
|
-
If you want to be notified with voice of the test results, instal espeak too, it is not needed.
|
65
|
+
If you want to be notified with voice of the test results, instal espeak [http://espeak.sourceforge.net/] too, it is not needed.
|
64
66
|
And when running an-install, pass a "-s" switch, when you do not want voices notifications anymore, just run it again without the "-s" switch.
|
65
67
|
|
68
|
+
To hear the sounds of Doom Edition, you need the mplayer [http://www.mplayerhq.hu/design7/dload.html] installed.
|
69
|
+
|
66
70
|
|
67
71
|
== INSTALL:
|
68
72
|
|
@@ -81,6 +85,10 @@ To turn off the notifier:
|
|
81
85
|
$ an-uninstall
|
82
86
|
|
83
87
|
|
88
|
+
== Special Doom Edition
|
89
|
+
|
90
|
+
$ an-install --doom --speaking
|
91
|
+
|
84
92
|
== CONTRIBUTORS:
|
85
93
|
|
86
94
|
* carlosbrando [http://www.nomedojogo.com]
|
@@ -89,6 +97,8 @@ To turn off the notifier:
|
|
89
97
|
* chjunior [http://tas.milk-it.net]
|
90
98
|
* daviscabral [http://blog.impactmedia.com.br]
|
91
99
|
* tapajos [http://www.improveit.com.br/tapajos]
|
100
|
+
* tchandy [http://tchandy.wordpress.com]
|
101
|
+
* ozsantana [http://blog.iconcreative.net/]
|
92
102
|
|
93
103
|
|
94
104
|
== LICENSE:
|
@@ -1,17 +1,17 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{autotest-notification}
|
3
|
-
s.version = "1.0
|
3
|
+
s.version = "1.4.0"
|
4
4
|
|
5
5
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Carlos Brando", "Rodrigo Urubatan", "Alexandre da Silva", "Carlos J\303\272nior", "Davis Zanetti Cabral", "Marcos Tapaj\303\263s"]
|
9
|
-
s.date = %q{2008-
|
8
|
+
s.authors = ["Carlos Brando", "Rodrigo Urubatan", "Alexandre da Silva", "Carlos J\303\272nior", "Davis Zanetti Cabral", "Marcos Tapaj\303\263s", "Thiago Pradi", "Oz\303\251ias Sant'ana"]
|
9
|
+
s.date = %q{2008-06-18}
|
10
10
|
s.description = %q{This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.}
|
11
11
|
s.email = ["eduardobrando@gmail.com"]
|
12
|
-
s.executables = ["an-install", "an-uninstall"]
|
12
|
+
s.executables = ["an-install", "an-uninstall", "playsound"]
|
13
13
|
s.extra_rdoc_files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "website/index.txt"]
|
14
|
-
s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "lib/autotest_notification.rb", "lib/autotest_notification/version.rb", "lib/autotest_notification/linux.rb", "lib/autotest_notification/
|
14
|
+
s.files = ["History.txt", "License.txt", "Manifest.txt", "PostInstall.txt", "README.txt", "Rakefile", "config/hoe.rb", "config/requirements.rb", "lib/autotest_notification.rb", "lib/autotest_notification/version.rb", "lib/autotest_notification/linux.rb", "lib/autotest_notification/windows.rb", "lib/autotest_notification/cygwin.rb", "lib/autotest_notification/mac.rb", "lib/autotest_notification/doom.rb", "script/console", "script/destroy", "script/generate", "script/txt2html", "setup.rb", "tasks/deployment.rake", "tasks/environment.rake", "tasks/website.rake", "test/test_autotest_notification.rb", "test/test_helper.rb", "test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_windows.rb", "test/autotest_notification/test_mac.rb", "website/index.html", "website/index.txt", "website/javascripts/rounded_corners_lite.inc.js", "website/stylesheets/screen.css", "website/template.html.erb", "bin/an-install", "bin/an-uninstall", "bin/playsound", "images/pass.png", "images/fail.png", "autotest-notification.gemspec", "images/doom/doom_0.png", "images/doom/doom_1.png", "images/doom/doom_2.png", "images/doom/doom_3.png", "images/doom/doom_4.png", "images/doom/doom_5.png", "images/doom/doom_6.png", "sounds/doom/0.wav", "sounds/doom/1.wav", "sounds/doom/2.wav", "sounds/doom/3.wav", "sounds/doom/4.wav", "sounds/doom/5.wav", "sounds/doom/6.wav"]
|
15
15
|
s.has_rdoc = true
|
16
16
|
s.homepage = %q{http://github.com/carlosbrando/autotest-notification/}
|
17
17
|
s.post_install_message = %q{
|
@@ -29,7 +29,7 @@ To turn off:
|
|
29
29
|
s.rubyforge_project = %q{autotest-notification}
|
30
30
|
s.rubygems_version = %q{1.1.1}
|
31
31
|
s.summary = %q{This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results.}
|
32
|
-
s.test_files = ["test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_windows.rb", "test/test_autotest_notification.rb", "test/test_helper.rb"]
|
32
|
+
s.test_files = ["test/autotest_notification/test_cygwin.rb", "test/autotest_notification/test_linux.rb", "test/autotest_notification/test_mac.rb", "test/autotest_notification/test_windows.rb", "test/test_autotest_notification.rb", "test/test_helper.rb"]
|
33
33
|
|
34
34
|
s.add_dependency(%q<ZenTest>, [">= 3.9.2"])
|
35
35
|
end
|
data/bin/an-install
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Created on 2008-5-11.
|
4
4
|
# Copyright (c) 2008. All rights reserved.
|
5
5
|
|
@@ -16,7 +16,8 @@ require 'ftools'
|
|
16
16
|
|
17
17
|
OPTIONS = {
|
18
18
|
:path => '~',
|
19
|
-
:speaking => false
|
19
|
+
:speaking => false,
|
20
|
+
:doom => false
|
20
21
|
}
|
21
22
|
MANDATORY_OPTIONS = %w( )
|
22
23
|
|
@@ -35,8 +36,12 @@ BANNER
|
|
35
36
|
"Default: ~") { |OPTIONS[:path]| }
|
36
37
|
|
37
38
|
opts.on("-s", "--speaking",
|
38
|
-
|
39
|
-
|
39
|
+
"If a test failed, the computer will speak.",
|
40
|
+
"For all plataforms.") { |OPTIONS[:speaking]| OPTIONS[:speaking] = true }
|
41
|
+
|
42
|
+
opts.on("-d", "--doom",
|
43
|
+
"Special Doom Edition.",
|
44
|
+
"Only for Mac.") { |OPTIONS[:doom]| OPTIONS[:doom] = true }
|
40
45
|
|
41
46
|
opts.on("-h", "--help",
|
42
47
|
"Show this help message.") { puts opts; exit }
|
@@ -50,10 +55,19 @@ end
|
|
50
55
|
|
51
56
|
path = OPTIONS[:path]
|
52
57
|
|
53
|
-
|
58
|
+
autotest_path = File.expand_path(path)
|
59
|
+
|
60
|
+
if File.exists?("#{autotest_path}/.autotest")
|
61
|
+
puts "\nYou Already have a .autotest file, renamed to .autotest.backup"
|
62
|
+
FileUtils.cp "#{autotest_path}/.autotest", "#{autotest_path}/.autotest.backup"
|
63
|
+
end
|
64
|
+
|
65
|
+
f = File.new("#{autotest_path}/.autotest", "w")
|
54
66
|
f.write "# ~.autotest\n"
|
55
67
|
f.write "require 'autotest_notification'\n"
|
56
68
|
f.write("SPEAKING = #{OPTIONS[:speaking]}\n")
|
69
|
+
f.write("DOOM_EDITION = #{OPTIONS[:doom]}\n")
|
57
70
|
f.close
|
71
|
+
|
58
72
|
puts "\nAs from now all tests will be notified automatically."
|
59
73
|
puts "" # a blank line
|
data/bin/playsound
ADDED
Binary file
|
data/config/hoe.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'autotest_notification/version'
|
2
2
|
|
3
|
-
AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral, Marcos Tapajós"
|
3
|
+
AUTHOR = "Carlos Brando, Rodrigo Urubatan, Alexandre da Silva, Carlos Júnior, Davis Zanetti Cabral, Marcos Tapajós, Thiago Pradi, Ozéias Sant'ana"
|
4
4
|
EMAIL = "eduardobrando@gmail.com"
|
5
5
|
DESCRIPTION = "This gem set the autotest (ZenTest) to send messages to software as Growl, LibNotify, and Snarl, displaying a window with the results."
|
6
6
|
GEM_NAME = 'autotest-notification' # what ppl will type to install your gem
|
data/config/requirements.rb
CHANGED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,51 +1,36 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__))
|
2
|
-
require
|
3
|
-
require 'autotest_notification/mac'
|
4
|
-
require 'autotest_notification/windows'
|
5
|
-
require 'autotest_notification/cygwin'
|
2
|
+
%w{ linux mac windows cygwin doom }.each { |x| require "autotest_notification/#{x}" }
|
6
3
|
|
7
4
|
module AutotestNotification
|
8
|
-
FAIL = -1
|
9
|
-
PENDING = 0
|
10
|
-
SUCCESS = 1
|
11
|
-
|
12
|
-
EXPIRATION_IN_SECONDS = 3
|
13
|
-
|
14
5
|
IMAGES_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../images/")
|
15
6
|
SUCCESS_IMAGE = "#{IMAGES_DIRECTORY}/pass.png"
|
16
7
|
FAIL_IMAGE = "#{IMAGES_DIRECTORY}/fail.png"
|
17
8
|
|
18
|
-
|
9
|
+
EXPIRATION_IN_SECONDS = 3
|
19
10
|
|
11
|
+
Autotest.add_hook :ran_command do |at|
|
20
12
|
result = at.results.is_a?(Array) ? at.results.last : at.results.split("\n").last
|
21
13
|
|
22
14
|
if result
|
15
|
+
%w{ test assertion error example pending failure }.each { |x| instance_variable_set "@#{x}s", result[/(\d+) #{x}/, 1].to_i }
|
23
16
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
pendings = result =~ /(\d+) pending/ ? $1.to_i : 0
|
32
|
-
|
33
|
-
# Shared
|
34
|
-
failures = result =~ /(\d+) failure/ ? $1.to_i : 0
|
35
|
-
|
36
|
-
code = 32
|
37
|
-
msg = if result =~ /test/
|
38
|
-
code = 31 if failures > 0 || errors > 0
|
39
|
-
"#{pluralize('test', tests)}, #{pluralize('assertion', assertions)}, #{pluralize('failure', failures)}, #{pluralize('error', errors)}"
|
17
|
+
case result
|
18
|
+
when /test/
|
19
|
+
code = 31 if @failures > 0 || @errors > 0
|
20
|
+
msg = unit_test_message(@tests, @assertions, @failures, @errors)
|
21
|
+
when /example/
|
22
|
+
code = (@failures > 0) ? 31 : (@pendings > 0) ? 33 : 32
|
23
|
+
msg = rspec_message(@examples, @failures, @pendings)
|
40
24
|
else
|
41
|
-
code =
|
42
|
-
"
|
25
|
+
code = 31
|
26
|
+
msg = "1 exception occurred"
|
27
|
+
@failures = 1
|
43
28
|
end
|
44
29
|
|
45
|
-
if failures > 0 || errors > 0
|
46
|
-
notify "FAIL", msg, FAIL_IMAGE, failures, 2
|
30
|
+
if @failures > 0 || @errors > 0
|
31
|
+
notify "FAIL", msg, FAIL_IMAGE, @tests + @examples, @failures + @errors, 2
|
47
32
|
else
|
48
|
-
notify "Pass", msg, SUCCESS_IMAGE,
|
33
|
+
notify "Pass", msg, SUCCESS_IMAGE, @tests + @examples
|
49
34
|
end
|
50
35
|
|
51
36
|
puts "\e[#{code}m#{'=' * 80}\e[0m\n\n"
|
@@ -53,12 +38,15 @@ module AutotestNotification
|
|
53
38
|
end
|
54
39
|
|
55
40
|
class << self
|
56
|
-
def notify(title, msg, img = SUCCESS_IMAGE, failures = 0, pri = 0)
|
41
|
+
def notify(title, msg, img = SUCCESS_IMAGE, total = 1, failures = 0, pri = 0)
|
42
|
+
|
43
|
+
img = Doom.image(total, failures) if DOOM_EDITION
|
44
|
+
|
57
45
|
case RUBY_PLATFORM
|
58
46
|
when /linux/
|
59
|
-
Linux.notify(title, msg, img)
|
47
|
+
Linux.notify(title, msg, img, total, failures)
|
60
48
|
when /darwin/
|
61
|
-
Mac.notify(title, msg, img, failures, pri)
|
49
|
+
Mac.notify(title, msg, img, total, failures, pri)
|
62
50
|
when /cygwin/
|
63
51
|
Cygwin.notify(title, msg, img)
|
64
52
|
when /mswin/
|
@@ -69,6 +57,13 @@ module AutotestNotification
|
|
69
57
|
def pluralize(text, number)
|
70
58
|
"#{number} #{text}#{'s' if number != 1}"
|
71
59
|
end
|
60
|
+
|
61
|
+
def unit_test_message(tests, assertions, failures, errors)
|
62
|
+
"#{pluralize('test', tests)}, #{pluralize('assertion', assertions)}, #{pluralize('failure', failures)}, #{pluralize('error', errors)}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def rspec_message(examples, failures, pendings)
|
66
|
+
"#{pluralize('example', examples)}, #{pluralize('failure', failures)}, #{pendings} pending"
|
67
|
+
end
|
72
68
|
end
|
73
69
|
end
|
74
|
-
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AutotestNotification
|
2
|
+
class Doom
|
3
|
+
class << self
|
4
|
+
def image(total, failures)
|
5
|
+
"#{IMAGES_DIRECTORY}/doom/doom_#{percent(total, failures)}.png"
|
6
|
+
end
|
7
|
+
|
8
|
+
def play_sound(total, failures)
|
9
|
+
sound_file = "#{File.expand_path(File.dirname(__FILE__) + "/../../sounds/doom/")}/#{percent(total, failures)}.wav"
|
10
|
+
|
11
|
+
case RUBY_PLATFORM
|
12
|
+
when /darwin/
|
13
|
+
`#{File.expand_path(File.dirname(__FILE__) + "/../../bin/")}/playsound #{sound_file}`
|
14
|
+
when /linux/
|
15
|
+
system("/usr/bin/mplayer #{sound_file}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
def percent(total, failures)
|
21
|
+
percent = failures.zero? ? 0 : ((5 * failures) / total) + 1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module AutotestNotification
|
2
2
|
class Linux
|
3
3
|
class << self
|
4
|
-
|
4
|
+
|
5
|
+
def notify(title, msg, img, total = 1, failures = 0)
|
5
6
|
if has_notify?
|
6
7
|
notify_send(title, msg, img)
|
7
8
|
elsif has_zenity?
|
@@ -9,43 +10,46 @@ module AutotestNotification
|
|
9
10
|
elsif has_kdialog?
|
10
11
|
kdialog(title, msg, img)
|
11
12
|
end
|
12
|
-
talk(msg)
|
13
|
-
true # true, cause we did everything we could
|
14
|
-
end
|
15
|
-
|
16
|
-
protected
|
17
|
-
def notify_send(title, msg, img)
|
18
|
-
system "notify-send -t #{EXPIRATION_IN_SECONDS * 1000} -i #{img} '#{title}' '#{msg}'"
|
19
|
-
end
|
20
13
|
|
21
|
-
|
22
|
-
system "kdialog --title '#{title}' --passivepopup '#{msg}' #{EXPIRATION_IN_SECONDS}"
|
14
|
+
say(total, failures) if SPEAKING
|
23
15
|
end
|
24
16
|
|
25
|
-
|
26
|
-
system "zenity --info --text='#{msg}' --title='#{title}'"
|
27
|
-
end
|
17
|
+
protected
|
28
18
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
19
|
+
def has_notify?
|
20
|
+
system "which notify-send 2> /dev/null"
|
21
|
+
end
|
22
|
+
|
23
|
+
def has_kdialog?
|
24
|
+
system "which kdialog 2> /dev/null"
|
25
|
+
end
|
26
|
+
|
27
|
+
def has_zenity?
|
28
|
+
system "which zenity 2> /dev/null"
|
29
|
+
end
|
30
|
+
|
31
|
+
def notify_send(title, msg, img)
|
32
|
+
system "notify-send -t #{EXPIRATION_IN_SECONDS * 1000} -i #{img} '#{title}' '#{msg}'"
|
34
33
|
end
|
35
|
-
end
|
36
34
|
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
def kdialog(title, msg, img)
|
36
|
+
system "kdialog --title '#{title}' --passivepopup '#{msg}' #{EXPIRATION_IN_SECONDS}"
|
37
|
+
end
|
40
38
|
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
def zenity(title, msg, img)
|
40
|
+
system "zenity --info --text='#{msg}' --title='#{title}'"
|
41
|
+
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
def say(total, failures)
|
44
|
+
if failures > 0
|
45
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak '#{failures} test#{'s' unless failures == 1} failed'")
|
46
|
+
else
|
47
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("/usr/bin/espeak 'All tests passed successfully'")
|
48
|
+
end
|
49
|
+
rescue
|
50
|
+
puts "You need the #{DOOM_EDITION ? 'mplayer' : 'espeak'} installed to hear the sounds."
|
51
|
+
end
|
52
|
+
|
48
53
|
end
|
49
54
|
end
|
50
55
|
end
|
51
|
-
|
@@ -1,10 +1,24 @@
|
|
1
1
|
module AutotestNotification
|
2
2
|
class Mac
|
3
|
+
@last_test_failed = false
|
4
|
+
|
3
5
|
class << self
|
4
|
-
|
6
|
+
|
7
|
+
def notify(title, msg, img, total = 1, failures = 0, pri = 0)
|
5
8
|
system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title}"
|
6
|
-
|
9
|
+
say(total, failures) if SPEAKING
|
7
10
|
end
|
11
|
+
|
12
|
+
def say(total, failures)
|
13
|
+
if failures > 0
|
14
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("say #{failures} test#{'s' unless failures == 1} failed.")
|
15
|
+
@last_test_failed = true
|
16
|
+
elsif @last_test_failed
|
17
|
+
DOOM_EDITION ? Doom.play_sound(total, failures) : system("say All tests passed successfully.")
|
18
|
+
@last_test_failed = false
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
8
22
|
end
|
9
23
|
end
|
10
24
|
end
|
data/sounds/doom/0.wav
ADDED
Binary file
|
data/sounds/doom/1.wav
ADDED
Binary file
|
data/sounds/doom/2.wav
ADDED
Binary file
|
data/sounds/doom/3.wav
ADDED
Binary file
|
data/sounds/doom/4.wav
ADDED
Binary file
|
data/sounds/doom/5.wav
ADDED
Binary file
|
data/sounds/doom/6.wav
ADDED
Binary file
|
@@ -1,49 +1,76 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
2
|
|
3
3
|
class TestLinux < Test::Unit::TestCase
|
4
|
-
|
4
|
+
|
5
5
|
def setup
|
6
6
|
turn_methods_public AutotestNotification::Linux
|
7
7
|
end
|
8
|
-
|
9
|
-
def
|
8
|
+
|
9
|
+
def test_notify_when_use_notify_without_speak
|
10
|
+
Object.const_set :SPEAKING, false
|
11
|
+
AutotestNotification::Linux.expects(:has_notify?).returns(true)
|
12
|
+
verify_notify(:notify_send)
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_notify_when_use_zenity_without_speak
|
16
|
+
Object.const_set :SPEAKING, false
|
17
|
+
AutotestNotification::Linux.expects(:has_notify?).returns(false)
|
18
|
+
AutotestNotification::Linux.expects(:has_zenity?).returns(true)
|
19
|
+
verify_notify(:zenity)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_notify_when_use_kdialog_without_speak
|
23
|
+
Object.const_set :SPEAKING, false
|
24
|
+
AutotestNotification::Linux.expects(:has_notify?).returns(false)
|
25
|
+
AutotestNotification::Linux.expects(:has_zenity?).returns(false)
|
26
|
+
AutotestNotification::Linux.expects(:has_kdialog?).returns(true)
|
27
|
+
verify_notify(:kdialog)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_notify_when_use_notify_with_speak
|
31
|
+
Object.const_set :SPEAKING, true
|
10
32
|
AutotestNotification::Linux.expects(:has_notify?).returns(true)
|
33
|
+
AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
|
11
34
|
verify_notify(:notify_send)
|
12
35
|
end
|
13
|
-
|
14
|
-
def
|
36
|
+
|
37
|
+
def test_notify_when_use_zenity_with_speak
|
38
|
+
Object.const_set :SPEAKING, true
|
15
39
|
AutotestNotification::Linux.expects(:has_notify?).returns(false)
|
16
40
|
AutotestNotification::Linux.expects(:has_zenity?).returns(true)
|
41
|
+
AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
|
17
42
|
verify_notify(:zenity)
|
18
43
|
end
|
19
|
-
|
20
|
-
def
|
44
|
+
|
45
|
+
def test_notify_when_use_kdialog_with_speak
|
46
|
+
Object.const_set :SPEAKING, true
|
21
47
|
AutotestNotification::Linux.expects(:has_notify?).returns(false)
|
22
48
|
AutotestNotification::Linux.expects(:has_zenity?).returns(false)
|
23
49
|
AutotestNotification::Linux.expects(:has_kdialog?).returns(true)
|
50
|
+
AutotestNotification::Linux.expects(:system).with("/usr/bin/espeak '1 test failed'")
|
24
51
|
verify_notify(:kdialog)
|
25
52
|
end
|
26
|
-
|
53
|
+
|
27
54
|
def test_notify_send
|
28
55
|
AutotestNotification::Linux.expects(:system).with('notify-send -t 3000 -i image \'title\' \'msg\'')
|
29
56
|
AutotestNotification::Linux.notify_send("title", "msg", "image")
|
30
57
|
end
|
31
|
-
|
58
|
+
|
32
59
|
def test_notify_kdialog
|
33
60
|
AutotestNotification::Linux.expects(:system).with('kdialog --title \'title\' --passivepopup \'msg\' 3')
|
34
61
|
AutotestNotification::Linux.kdialog("title", "msg", "image")
|
35
62
|
end
|
36
|
-
|
63
|
+
|
37
64
|
def test_notify_zenity
|
38
65
|
AutotestNotification::Linux.expects(:system).with('zenity --info --text=\'msg\' --title=\'title\'')
|
39
66
|
AutotestNotification::Linux.zenity("title", "msg", "image")
|
40
67
|
end
|
41
|
-
|
68
|
+
|
42
69
|
def test_has_zenity?
|
43
70
|
AutotestNotification::Linux.expects(:system).with('which zenity 2> /dev/null')
|
44
71
|
AutotestNotification::Linux.has_zenity?
|
45
72
|
end
|
46
|
-
|
73
|
+
|
47
74
|
def test_has_notify?
|
48
75
|
AutotestNotification::Linux.expects(:system).with('which notify-send 2> /dev/null')
|
49
76
|
AutotestNotification::Linux.has_notify?
|
@@ -53,12 +80,13 @@ class TestLinux < Test::Unit::TestCase
|
|
53
80
|
AutotestNotification::Linux.expects(:system).with('which kdialog 2> /dev/null')
|
54
81
|
AutotestNotification::Linux.has_kdialog?
|
55
82
|
end
|
56
|
-
|
83
|
+
|
57
84
|
private
|
58
|
-
|
85
|
+
|
59
86
|
def verify_notify(method)
|
60
|
-
AutotestNotification::Linux.expects(method).returns("title", "msg", "image")
|
61
|
-
AutotestNotification::Linux.notify("title", "msg", "image")
|
87
|
+
AutotestNotification::Linux.expects(method).returns("title", "msg", "image", 1)
|
88
|
+
AutotestNotification::Linux.notify("title", "msg", "image",1)
|
62
89
|
end
|
63
|
-
|
90
|
+
|
64
91
|
end
|
92
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper.rb'
|
2
|
+
|
3
|
+
class TestMac < Test::Unit::TestCase
|
4
|
+
|
5
|
+
def test_notify_without_voice
|
6
|
+
Object.const_set :SPEAKING, false
|
7
|
+
AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' title")
|
8
|
+
AutotestNotification::Mac.notify("title", "msg", "image", 1)
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_notify_with_voice
|
12
|
+
Object.const_set :SPEAKING, true
|
13
|
+
AutotestNotification::Mac.expects(:system).with("growlnotify -n autotest --image image -p 0 -m 'msg' title")
|
14
|
+
AutotestNotification::Mac.expects(:system).with("say 1 test failed.")
|
15
|
+
AutotestNotification::Mac.notify("title", "msg", "image", 1)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
@@ -20,12 +20,12 @@ class TestAutotestNotification < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def test_notify_when_os_is_linux
|
23
|
-
AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image)
|
23
|
+
AutotestNotification::Linux.expects(:notify).with(@title, @msg, @image,@pri)
|
24
24
|
verify_to("linux")
|
25
25
|
end
|
26
26
|
|
27
27
|
def test_notify_when_os_is_mac
|
28
|
-
|
28
|
+
AutotestNotification::Mac.expects(:notify).with(@title, @msg, @image, @pri, 0)
|
29
29
|
verify_to("darwin")
|
30
30
|
end
|
31
31
|
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>autotest_notification</h1>
|
34
34
|
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/autotest_notification"; return false'>
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="http://rubyforge.org/projects/autotest_notification" class="numbers">
|
36
|
+
<a href="http://rubyforge.org/projects/autotest_notification" class="numbers">1.4.0</a>
|
37
37
|
</div>
|
38
38
|
<h1>→ ‘autotest_notification’</h1>
|
39
39
|
|
@@ -130,7 +130,7 @@ rake install_gem</pre>
|
|
130
130
|
|
131
131
|
<p>Comments are welcome. Send an email to <a href="mailto:eduardobrando@gmail.com">Carlos Brando</a> via the <a href="http://groups.google.com/group/autotest_notification">forum</a></p>
|
132
132
|
<p class="coda">
|
133
|
-
<a href="FIXME email">FIXME full name</a>,
|
133
|
+
<a href="FIXME email">FIXME full name</a>, 15th June 2008<br>
|
134
134
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
135
135
|
</p>
|
136
136
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urubatan-autotest-notification
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Brando
|
@@ -10,11 +10,13 @@ authors:
|
|
10
10
|
- "Carlos J\xC3\xBAnior"
|
11
11
|
- Davis Zanetti Cabral
|
12
12
|
- "Marcos Tapaj\xC3\xB3s"
|
13
|
+
- Thiago Pradi
|
14
|
+
- "Oz\xC3\xA9ias Sant'ana"
|
13
15
|
autorequire:
|
14
16
|
bindir: bin
|
15
17
|
cert_chain: []
|
16
18
|
|
17
|
-
date: 2008-
|
19
|
+
date: 2008-06-18 00:00:00 -07:00
|
18
20
|
default_executable:
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
@@ -32,6 +34,7 @@ email:
|
|
32
34
|
executables:
|
33
35
|
- an-install
|
34
36
|
- an-uninstall
|
37
|
+
- playsound
|
35
38
|
extensions: []
|
36
39
|
|
37
40
|
extra_rdoc_files:
|
@@ -53,9 +56,10 @@ files:
|
|
53
56
|
- lib/autotest_notification.rb
|
54
57
|
- lib/autotest_notification/version.rb
|
55
58
|
- lib/autotest_notification/linux.rb
|
56
|
-
- lib/autotest_notification/mac.rb
|
57
59
|
- lib/autotest_notification/windows.rb
|
58
60
|
- lib/autotest_notification/cygwin.rb
|
61
|
+
- lib/autotest_notification/mac.rb
|
62
|
+
- lib/autotest_notification/doom.rb
|
59
63
|
- script/console
|
60
64
|
- script/destroy
|
61
65
|
- script/generate
|
@@ -69,6 +73,7 @@ files:
|
|
69
73
|
- test/autotest_notification/test_cygwin.rb
|
70
74
|
- test/autotest_notification/test_linux.rb
|
71
75
|
- test/autotest_notification/test_windows.rb
|
76
|
+
- test/autotest_notification/test_mac.rb
|
72
77
|
- website/index.html
|
73
78
|
- website/index.txt
|
74
79
|
- website/javascripts/rounded_corners_lite.inc.js
|
@@ -76,9 +81,24 @@ files:
|
|
76
81
|
- website/template.html.erb
|
77
82
|
- bin/an-install
|
78
83
|
- bin/an-uninstall
|
84
|
+
- bin/playsound
|
79
85
|
- images/pass.png
|
80
86
|
- images/fail.png
|
81
87
|
- autotest-notification.gemspec
|
88
|
+
- images/doom/doom_0.png
|
89
|
+
- images/doom/doom_1.png
|
90
|
+
- images/doom/doom_2.png
|
91
|
+
- images/doom/doom_3.png
|
92
|
+
- images/doom/doom_4.png
|
93
|
+
- images/doom/doom_5.png
|
94
|
+
- images/doom/doom_6.png
|
95
|
+
- sounds/doom/0.wav
|
96
|
+
- sounds/doom/1.wav
|
97
|
+
- sounds/doom/2.wav
|
98
|
+
- sounds/doom/3.wav
|
99
|
+
- sounds/doom/4.wav
|
100
|
+
- sounds/doom/5.wav
|
101
|
+
- sounds/doom/6.wav
|
82
102
|
has_rdoc: true
|
83
103
|
homepage: http://github.com/carlosbrando/autotest-notification/
|
84
104
|
post_install_message: |+
|
@@ -118,6 +138,7 @@ summary: This gem set the autotest (ZenTest) to send messages to software as Gro
|
|
118
138
|
test_files:
|
119
139
|
- test/autotest_notification/test_cygwin.rb
|
120
140
|
- test/autotest_notification/test_linux.rb
|
141
|
+
- test/autotest_notification/test_mac.rb
|
121
142
|
- test/autotest_notification/test_windows.rb
|
122
143
|
- test/test_autotest_notification.rb
|
123
144
|
- test/test_helper.rb
|