karl-autotest-growl 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +14 -0
- data/Manifest.txt +2 -0
- data/PostInstall.txt +2 -1
- data/README.rdoc +17 -13
- data/Rakefile +21 -22
- data/autotest-growl.gemspec +19 -18
- data/growl/growlnotify +0 -0
- data/img/info.png +0 -0
- data/lib/autotest/growl.rb +80 -44
- data/lib/autotest/result.rb +66 -0
- data/lib/autotest-growl.rb +2 -2
- data/script/console +2 -2
- data/spec/autotest-growl_spec.rb +42 -12
- metadata +13 -13
- data/growl/growlnotify.exe +0 -0
data/History.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
== 0.1.4 2009-07-23
|
2
|
+
|
3
|
+
* 1 major improvement
|
4
|
+
* Support for Windows (Karl O'Keeffe)
|
5
|
+
|
6
|
+
== 0.1.3 2009-07-22
|
7
|
+
|
8
|
+
* 1 major improvement
|
9
|
+
* Better result analysis and more readable notifications
|
10
|
+
* 3 minor improvement
|
11
|
+
* Move Cucumber notification to :ran_features hook (Karl O'Keeffe)
|
12
|
+
* Add one_notification_per_run configuration option
|
13
|
+
* Notification for undefined Cucumber scenarios/steps
|
14
|
+
|
1
15
|
== 0.1.2 2009-06-12
|
2
16
|
|
3
17
|
* 3 major improvements
|
data/Manifest.txt
CHANGED
@@ -5,6 +5,7 @@ README.rdoc
|
|
5
5
|
Rakefile
|
6
6
|
autotest-growl.gemspec
|
7
7
|
growl/growlnotify
|
8
|
+
growl/growlnotify.com
|
8
9
|
img/error.png
|
9
10
|
img/failed.png
|
10
11
|
img/info.png
|
@@ -12,6 +13,7 @@ img/passed.png
|
|
12
13
|
img/pending.png
|
13
14
|
lib/autotest-growl.rb
|
14
15
|
lib/autotest/growl.rb
|
16
|
+
lib/autotest/result.rb
|
15
17
|
script/console
|
16
18
|
script/destroy
|
17
19
|
script/generate
|
data/PostInstall.txt
CHANGED
@@ -5,7 +5,8 @@ require 'autotest/growl'
|
|
5
5
|
|
6
6
|
Make sure Growl is installed on your computer. Download it from:
|
7
7
|
|
8
|
-
http://growl.info
|
8
|
+
http://growl.info (Mac OS X)
|
9
|
+
http://growlforwindows.com (Windows)
|
9
10
|
|
10
11
|
If Growl notifications are not always displayed, take a look at the README
|
11
12
|
for assistance.
|
data/README.rdoc
CHANGED
@@ -16,7 +16,7 @@ priorities:
|
|
16
16
|
|
17
17
|
* 2 for error or failed
|
18
18
|
* 0 for info
|
19
|
-
* -1 for pending or unknown
|
19
|
+
* -1 for pending, undefined or unknown
|
20
20
|
* -2 for passed
|
21
21
|
|
22
22
|
Furthermore the terminal running autotest is cleared on every cycle (unless
|
@@ -32,8 +32,9 @@ might take a while though as autotest itself is currently misbehaving on Ruby
|
|
32
32
|
|
33
33
|
== REQUIREMENTS:
|
34
34
|
|
35
|
-
* Growl >= 1.1.
|
36
|
-
* ZenTest >= 4.1.
|
35
|
+
* Growl >= 1.1.5 (Mac OS X) or >= 2.0b18 (Windows)
|
36
|
+
* ZenTest >= 4.1.3
|
37
|
+
* extensions >= 0.6.0
|
37
38
|
|
38
39
|
== INSTALL:
|
39
40
|
|
@@ -47,7 +48,8 @@ Then add the following line to your ~/.autotest file:
|
|
47
48
|
|
48
49
|
Make sure Growl is installed on your computer. You can download it from:
|
49
50
|
|
50
|
-
http://growl.info
|
51
|
+
Mac OS X: http://growl.info
|
52
|
+
Windows: http://growlforwindows.com
|
51
53
|
|
52
54
|
== CONFIGURATION:
|
53
55
|
|
@@ -71,6 +73,13 @@ All tests have passed", add the following to your ~/.autotest:
|
|
71
73
|
|
72
74
|
Autotest::Growl::hide_label = true
|
73
75
|
|
76
|
+
=== One Notifications per Run
|
77
|
+
|
78
|
+
Allow only one test and one feature notification per run by adding the
|
79
|
+
following to your ~/.autotest:
|
80
|
+
|
81
|
+
Autotest::Growl::one_notification_per_run = true
|
82
|
+
|
74
83
|
=== Show Modified Files
|
75
84
|
|
76
85
|
Add the following to your ~/.autotest if you would like to receive a Growl
|
@@ -95,16 +104,10 @@ Or remove all outdated versions of all installed gems:
|
|
95
104
|
|
96
105
|
sudo gem cleanup
|
97
106
|
|
98
|
-
===
|
99
|
-
|
100
|
-
If you are using autotest-fsevent as well, the require statements are not
|
101
|
-
ordered correctly. The require for autotest-fsevent must come after all
|
102
|
-
other requires in your ~/.autotest.
|
103
|
-
|
104
|
-
=== Unreliable Growl Notifications
|
107
|
+
=== Unreliable Growl Notifications on Mac OS X
|
105
108
|
|
106
|
-
Under some circumstances, Growl notifications seem to be swallowed randomly
|
107
|
-
If this happens to you, try the following.
|
109
|
+
Under some circumstances, Growl notifications seem to be swallowed randomly
|
110
|
+
on Mac OS X. If this happens to you, try the following.
|
108
111
|
|
109
112
|
Add this to your ~/.autotest:
|
110
113
|
|
@@ -144,6 +147,7 @@ Thanks to the following folks who have contributed to this project:
|
|
144
147
|
|
145
148
|
* Michael Moen
|
146
149
|
* Graham Savage
|
150
|
+
* Karl O'Keeffe
|
147
151
|
|
148
152
|
== LICENSE:
|
149
153
|
|
data/Rakefile
CHANGED
@@ -1,29 +1,28 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/autotest-growl'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
p.description = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
|
9
|
-
p.url = %q{http://www.bitcetera.com/products/autotest-growl}
|
10
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
11
|
-
p.post_install_message = "\n\e[1;32m" + File.read('PostInstall.txt') + "\e[0;30m\n"
|
12
|
-
p.rubyforge_name = p.name
|
13
|
-
p.extra_deps = [
|
14
|
-
['ZenTest','>= 4.1.0'],
|
15
|
-
]
|
16
|
-
p.extra_dev_deps = [
|
17
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
18
|
-
]
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
19
10
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
11
|
+
$hoe = Hoe.spec 'autotest-growl' do
|
12
|
+
self.developer 'Sven Schwyn', 'ruby@bitcetera.com'
|
13
|
+
self.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
|
14
|
+
self.description = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
|
15
|
+
self.url = %q{http://www.bitcetera.com/products/autotest-growl}
|
16
|
+
# self.changes = self.paragraphs_of("History.txt", 0..1).join("\n\n")
|
17
|
+
self.post_install_message = "\n\e[1;32m" + File.read('PostInstall.txt') + "\e[0;30m\n"
|
18
|
+
self.rubyforge_name = self.name
|
19
|
+
self.extra_deps = [
|
20
|
+
['ZenTest','>= 4.1.3'],
|
21
|
+
['extensions', '>= 0.6.0']
|
22
|
+
]
|
24
23
|
end
|
25
24
|
|
26
25
|
require 'newgem/tasks'
|
27
26
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
28
27
|
|
29
|
-
task :default => [:spec]
|
28
|
+
task :default => [:spec]
|
data/autotest-growl.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{autotest-growl}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.7"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Sven Schwyn"
|
9
|
-
s.date = %q{2009-
|
10
|
-
s.description = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and supports Cucumber.}
|
8
|
+
s.authors = ["Sven Schwyn"]
|
9
|
+
s.date = %q{2009-07-24}
|
10
|
+
s.description = %q{This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.}
|
11
11
|
s.email = ["ruby@bitcetera.com"]
|
12
|
-
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"
|
13
|
-
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "autotest-growl.gemspec", "growl/growlnotify", "growl/growlnotify.com", "
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "autotest-growl.gemspec", "growl/growlnotify", "growl/growlnotify.com", "img/error.png", "img/failed.png", "img/info.png", "img/passed.png", "img/pending.png", "lib/autotest-growl.rb", "lib/autotest/growl.rb", "lib/autotest/result.rb", "script/console", "script/destroy", "script/generate", "spec/autotest-growl_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
|
14
14
|
s.homepage = %q{http://www.bitcetera.com/products/autotest-growl}
|
15
15
|
s.post_install_message = %q{
|
16
16
|
[1;32mIn order to use autotest-growl, the following line has to be added to your
|
@@ -20,7 +20,8 @@ require 'autotest/growl'
|
|
20
20
|
|
21
21
|
Make sure Growl is installed on your computer. Download it from:
|
22
22
|
|
23
|
-
http://growl.info
|
23
|
+
http://growl.info (Mac OS X)
|
24
|
+
http://growlforwindows.com (Windows)
|
24
25
|
|
25
26
|
If Growl notifications are not always displayed, take a look at the README
|
26
27
|
for assistance.
|
@@ -34,14 +35,14 @@ http://www.bitcetera.com/products/autotest-growl
|
|
34
35
|
| ZenTest no longer comes with bundled Growl support and therefore the |
|
35
36
|
| require in your ~/.autotest must not contain the absolute path to this |
|
36
37
|
| gem anymore. Please update your ~/.autotest to contain the require line |
|
37
|
-
| mentioned above.
|
38
|
+
| mentioned above. Make sure no ZenTest version <=4.0.0 is installed. |
|
38
39
|
+-------------------------------------------------------------------------+
|
39
40
|
[0;30m
|
40
41
|
}
|
41
42
|
s.rdoc_options = ["--main", "README.rdoc"]
|
42
43
|
s.require_paths = ["lib"]
|
43
44
|
s.rubyforge_project = %q{autotest-growl}
|
44
|
-
s.rubygems_version = %q{1.3.
|
45
|
+
s.rubygems_version = %q{1.3.5}
|
45
46
|
s.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
|
46
47
|
|
47
48
|
if s.respond_to? :specification_version then
|
@@ -49,17 +50,17 @@ http://www.bitcetera.com/products/autotest-growl
|
|
49
50
|
s.specification_version = 3
|
50
51
|
|
51
52
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_runtime_dependency(%q<ZenTest>, [">= 4.1.
|
53
|
-
s.
|
54
|
-
s.add_development_dependency(%q<hoe>, [">=
|
53
|
+
s.add_runtime_dependency(%q<ZenTest>, [">= 4.1.3"])
|
54
|
+
s.add_runtime_dependency(%q<extensions>, [">= 0.6.0"])
|
55
|
+
s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
|
55
56
|
else
|
56
|
-
s.add_dependency(%q<ZenTest>, [">= 4.1.
|
57
|
-
s.add_dependency(%q<
|
58
|
-
s.add_dependency(%q<hoe>, [">=
|
57
|
+
s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
|
58
|
+
s.add_dependency(%q<extensions>, [">= 0.6.0"])
|
59
|
+
s.add_dependency(%q<hoe>, [">= 2.3.2"])
|
59
60
|
end
|
60
61
|
else
|
61
|
-
s.add_dependency(%q<ZenTest>, [">= 4.1.
|
62
|
-
s.add_dependency(%q<
|
63
|
-
s.add_dependency(%q<hoe>, [">=
|
62
|
+
s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
|
63
|
+
s.add_dependency(%q<extensions>, [">= 0.6.0"])
|
64
|
+
s.add_dependency(%q<hoe>, [">= 2.3.2"])
|
64
65
|
end
|
65
66
|
end
|
data/growl/growlnotify
CHANGED
Binary file
|
data/img/info.png
ADDED
Binary file
|
data/lib/autotest/growl.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'autotest'
|
3
|
+
require File.join(File.dirname(__FILE__), 'result')
|
3
4
|
|
4
5
|
##
|
5
6
|
# Autotest::Growl
|
@@ -13,12 +14,15 @@ require 'autotest'
|
|
13
14
|
# require 'autotest/growl'
|
14
15
|
module Autotest::Growl
|
15
16
|
|
16
|
-
GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '
|
17
|
+
GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
17
18
|
|
18
19
|
@label = ''
|
19
20
|
@modified_files = []
|
21
|
+
@ran_tests = false
|
22
|
+
@ran_features = false
|
20
23
|
|
21
24
|
@@remote_notification = false
|
25
|
+
@@one_notification_per_run = false
|
22
26
|
@@clear_terminal = true
|
23
27
|
@@hide_label = false
|
24
28
|
@@show_modified_files = false
|
@@ -29,6 +33,12 @@ module Autotest::Growl
|
|
29
33
|
@@remote_notification = boolean
|
30
34
|
end
|
31
35
|
|
36
|
+
##
|
37
|
+
# Whether to limit the number of notifications per run to one or not (default).
|
38
|
+
def self.one_notification_per_run=(boolean)
|
39
|
+
@@one_notification_per_run = boolean
|
40
|
+
end
|
41
|
+
|
32
42
|
##
|
33
43
|
# Whether to clear the terminal before running tests (default) or not.
|
34
44
|
def self.clear_terminal=(boolean)
|
@@ -54,28 +64,31 @@ module Autotest::Growl
|
|
54
64
|
|
55
65
|
##
|
56
66
|
# Display a message through Growl.
|
57
|
-
def self.growl
|
67
|
+
def self.growl(title, message, icon, priority=0, stick="")
|
58
68
|
growl = File.join(GEM_PATH, 'growl', 'growlnotify')
|
59
69
|
image = File.join(ENV['HOME'], '.autotest-growl', "#{icon}.png")
|
60
70
|
image = File.join(GEM_PATH, 'img', "#{icon}.png") unless File.exists?(image)
|
61
71
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
72
|
+
case RUBY_PLATFORM
|
73
|
+
when /mswin/
|
74
|
+
growl += '.com'
|
75
|
+
system %(#{growl} #{message.inspect} /a:"autotest" /r:"Autotest" /n:"Autotest" /i:"#{image}" /p:#{priority} /t:"#{title}")
|
76
|
+
when /darwin/
|
77
|
+
if @@remote_notification
|
78
|
+
system %(#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m '#{message}' '#{title}' #{stick})
|
79
|
+
else
|
80
|
+
system %(#{growl} -n autotest --image '#{image}' -p #{priority} -m '#{message}' '#{title}' #{stick})
|
81
|
+
end
|
82
|
+
else
|
83
|
+
raise "#{RUBY_PLATFORM} is not supported by autotest-growl"
|
84
|
+
end
|
85
|
+
|
74
86
|
end
|
75
87
|
|
76
88
|
##
|
77
89
|
# Display the modified files.
|
78
90
|
Autotest.add_hook :updated do |autotest, modified|
|
91
|
+
@ran_tests = @ran_features = false
|
79
92
|
if @@show_modified_files
|
80
93
|
if modified != @last_modified
|
81
94
|
growl @label + 'Modifications detected.', modified.collect {|m| m[0]}.join(', '), 'info', 0
|
@@ -89,50 +102,73 @@ module Autotest::Growl
|
|
89
102
|
# Set the label and clear the terminal.
|
90
103
|
Autotest.add_hook :run_command do
|
91
104
|
@label = File.basename(Dir.pwd).upcase + ': ' if !@@hide_label
|
92
|
-
@run_scenarios = false
|
93
105
|
print "\n"*2 + '-'*80 + "\n"*2
|
94
106
|
print "\e[2J\e[f" if @@clear_terminal
|
95
107
|
false
|
96
108
|
end
|
97
109
|
|
98
110
|
##
|
99
|
-
# Parse the
|
111
|
+
# Parse the RSpec and Test::Unit results and send them to Growl.
|
100
112
|
Autotest.add_hook :ran_command do |autotest|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
113
|
+
unless @@one_notification_per_run && @ran_tests
|
114
|
+
result = Result.new(autotest)
|
115
|
+
if result.exists?
|
116
|
+
case result.framework
|
117
|
+
when 'test-unit'
|
118
|
+
if result.has?('test-error')
|
119
|
+
growl @label + 'Cannot run some unit tests.', "#{result.get('test-error')} in #{result.get('test')}", 'error', 2
|
120
|
+
elsif result.has?('test-failed')
|
121
|
+
growl @label + 'Some unit tests failed.', "#{result['test-failed']} of #{result.get('test-assertion')} in #{result.get('test')} failed", 'failed', 2
|
122
|
+
else
|
123
|
+
growl @label + 'All unit tests passed.', "#{result.get('test-assertion')} in #{result.get('test')}", 'passed', -2
|
124
|
+
end
|
125
|
+
when 'rspec'
|
126
|
+
if result.has?('example-failed')
|
127
|
+
growl @label + 'Some RSpec examples failed.', "#{result['example-failed']} of #{result.get('example')} failed", 'failed', 2
|
128
|
+
elsif result.has?('example-pending')
|
129
|
+
growl @label + 'Some RSpec examples are pending.', "#{result['example-pending']} of #{result.get('example')} pending", 'pending', -1
|
130
|
+
else
|
131
|
+
growl @label + 'All RSpec examples passed.', "#{result.get('example')}", 'passed', -2
|
132
|
+
end
|
133
|
+
end
|
110
134
|
else
|
111
|
-
growl @label + '
|
112
|
-
@run_scenarios = true
|
135
|
+
growl @label + 'Could not run tests.', '', 'error', 2
|
113
136
|
end
|
137
|
+
@ran_test = true
|
114
138
|
end
|
115
139
|
false
|
116
140
|
end
|
117
141
|
|
118
|
-
|
142
|
+
##
|
143
|
+
# Parse the Cucumber results and sent them to Growl.
|
119
144
|
Autotest.add_hook :ran_features do |autotest|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
145
|
+
unless @@one_notification_per_run && @ran_features
|
146
|
+
result = Result.new(autotest)
|
147
|
+
if result.exists?
|
148
|
+
case result.framework
|
149
|
+
when 'cucumber'
|
150
|
+
explanation = []
|
151
|
+
if result.has?('scenario-undefined') || result.has?('step-undefined')
|
152
|
+
explanation << "#{result['scenario-undefined']} of #{result.get('scenario')} not defined" if result['scenario-undefined']
|
153
|
+
explanation << "#{result['step-undefined']} of #{result.get('step')} not defined" if result['step-undefined']
|
154
|
+
growl @label + 'Some Cucumber scenarios are not defined.', "#{explanation.join("\n")}", 'pending', -1
|
155
|
+
elsif result.has?('scenario-failed') || result.has?('step-failed')
|
156
|
+
explanation << "#{result['scenario-failed']} of #{result.get('scenario')} failed" if result['scenario-failed']
|
157
|
+
explanation << "#{result['step-failed']} of #{result.get('step')} failed" if result['step-failed']
|
158
|
+
growl @label + 'Some Cucumber scenarios failed.', "#{explanation.join("\n")}", 'failed', 2
|
159
|
+
elsif result.has?('scenario-pending') || result.has?('step-pending')
|
160
|
+
explanation << "#{result['scenario-pending']} of #{result.get('scenario')} pending" if result['scenario-pending']
|
161
|
+
explanation << "#{result['step-pending']} of #{result.get('step')} pending" if result['step-pending']
|
162
|
+
growl @label + 'Some Cucumber scenarios are pending.', "#{explanation.join("\n")}", 'pending', -1
|
163
|
+
else
|
164
|
+
growl @label + 'All Cucumber features passed.', '', 'passed', -2
|
165
|
+
end
|
166
|
+
end
|
167
|
+
else
|
168
|
+
growl @label + 'Could not run features.', '', 'error', 2
|
169
|
+
end
|
170
|
+
@ran_features = true
|
171
|
+
end
|
136
172
|
false
|
137
173
|
end
|
138
174
|
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'extensions/string'
|
2
|
+
|
3
|
+
class Result
|
4
|
+
|
5
|
+
##
|
6
|
+
# Analyze test result lines and return the numbers in a hash.
|
7
|
+
def initialize(autotest)
|
8
|
+
@numbers = {}
|
9
|
+
lines = autotest.results.map {|s| s.gsub(/(\e.*?m|\n)/, '') } # remove escape sequences
|
10
|
+
lines.reject! {|line| !line.match(/\d+\s+(example|test|scenario|step)s?/) } # isolate result numbers
|
11
|
+
lines.each do |line|
|
12
|
+
prefix = nil
|
13
|
+
line.scan(/([1-9]\d*)\s(\w+)/) do |number, kind|
|
14
|
+
kind.sub!(/s$/, '') # singularize
|
15
|
+
kind.sub!(/failure/, 'failed') # homogenize
|
16
|
+
if prefix
|
17
|
+
@numbers["#{prefix}-#{kind}"] = number.to_i
|
18
|
+
else
|
19
|
+
@numbers[kind] = number.to_i
|
20
|
+
prefix = kind
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Determine the testing framework used.
|
28
|
+
def framework
|
29
|
+
case
|
30
|
+
when @numbers['test']: 'test-unit'
|
31
|
+
when @numbers['example']: 'rspec'
|
32
|
+
when @numbers['scenario']: 'cucumber'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# Determine whether a result exists at all.
|
38
|
+
def exists?
|
39
|
+
!@numbers.empty?
|
40
|
+
end
|
41
|
+
|
42
|
+
##
|
43
|
+
# Check whether a specific result is present.
|
44
|
+
def has?(kind)
|
45
|
+
@numbers.has_key?(kind)
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Get a plain result number.
|
50
|
+
def [](kind)
|
51
|
+
@numbers[kind]
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Get a labelled result number. The prefix is removed and the label pluralized if necessary.
|
56
|
+
def get(kind)
|
57
|
+
"#{@numbers[kind]} #{kind.sub(/^.*-/, '')}#{'s' if @numbers[kind] != 1 && !(kind.ends_with?('ed') || kind.ends_with?('ing') )}" if @numbers[kind]
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Get the fatal error if any.
|
62
|
+
def fatal_error
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
data/lib/autotest-growl.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
$:.unshift(File.dirname(__FILE__)) unless
|
2
2
|
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
3
|
|
4
|
-
require File.dirname(__FILE__)
|
4
|
+
require File.join(File.dirname(__FILE__), 'autotest', 'growl')
|
5
5
|
|
6
6
|
module AutotestGrowl
|
7
7
|
|
8
|
-
VERSION = '0.1.
|
8
|
+
VERSION = '0.1.7'
|
9
9
|
|
10
10
|
end
|
data/script/console
CHANGED
@@ -5,6 +5,6 @@ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
|
5
5
|
libs = " -r irb/completion"
|
6
6
|
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
7
|
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/
|
9
|
-
puts "Loading
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/testli.rb'}"
|
9
|
+
puts "Loading testli gem"
|
10
10
|
exec "#{irb} #{libs} --simple-prompt"
|
data/spec/autotest-growl_spec.rb
CHANGED
@@ -3,48 +3,78 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
|
|
3
3
|
describe "handling results" do
|
4
4
|
before do
|
5
5
|
@autotest = Autotest.new
|
6
|
+
@autotest.hook(:updated)
|
6
7
|
end
|
7
8
|
|
8
9
|
describe "for RSpec" do
|
9
|
-
it "should show a
|
10
|
+
it "should show a 'passed' notification" do
|
10
11
|
Autotest::Growl.should_receive(:growl).and_return('passed')
|
11
12
|
@autotest.results = ["10 examples, 0 failures"]
|
12
13
|
@autotest.hook(:ran_command)
|
13
14
|
end
|
14
15
|
|
15
|
-
it "should show a
|
16
|
-
Autotest::Growl.should_receive(:growl).and_return('
|
16
|
+
it "should show a 'failed' notification" do
|
17
|
+
Autotest::Growl.should_receive(:growl).and_return('failed')
|
17
18
|
@autotest.results = ["10 examples, 1 failures"]
|
18
19
|
@autotest.hook(:ran_command)
|
19
20
|
end
|
20
21
|
|
21
|
-
it "should show a pending
|
22
|
-
Autotest::Growl.should_receive(:growl).and_return('
|
22
|
+
it "should show a 'pending' notification" do
|
23
|
+
Autotest::Growl.should_receive(:growl).and_return('pending')
|
23
24
|
@autotest.results = ["10 examples, 0 failures, 1 pending"]
|
24
25
|
@autotest.hook(:ran_command)
|
25
26
|
end
|
27
|
+
|
28
|
+
it "should show an 'error' notification" do
|
29
|
+
Autotest::Growl.should_receive(:growl).and_return('error')
|
30
|
+
@autotest.results = []
|
31
|
+
@autotest.hook(:ran_command)
|
32
|
+
end
|
26
33
|
end
|
27
34
|
|
28
35
|
describe "for Test::Unit" do
|
29
|
-
it "should show a
|
36
|
+
it "should show a 'passed' notification" do
|
30
37
|
Autotest::Growl.should_receive(:growl).and_return('passed')
|
31
38
|
@autotest.results = ["1 tests, 1 assertions, 0 failures, 0 errors"]
|
32
39
|
@autotest.hook(:ran_command)
|
33
40
|
end
|
34
41
|
|
35
|
-
it "should show a
|
36
|
-
Autotest::Growl.should_receive(:growl).
|
42
|
+
it "should show a 'failed' notification" do
|
43
|
+
Autotest::Growl.should_receive(:growl).and_return('failed')
|
37
44
|
@autotest.results = ["1 tests, 1 assertions, 1 failures, 0 errors"]
|
38
45
|
@autotest.hook(:ran_command)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should show an 'error' notification" do
|
49
|
+
Autotest::Growl.should_receive(:growl).and_return('error')
|
39
50
|
@autotest.results = ["1 tests, 1 assertions, 0 failures, 1 errors"]
|
40
51
|
@autotest.hook(:ran_command)
|
41
52
|
end
|
42
53
|
end
|
43
54
|
|
44
|
-
# FIXME: This is a temporary workaround until Cucumber is properly integrated!
|
45
55
|
describe "for Cucumber" do
|
46
|
-
it "should show a
|
47
|
-
|
48
|
-
|
56
|
+
it "should show a 'passed' notification" do
|
57
|
+
Autotest::Growl.should_receive(:growl).and_return('passed')
|
58
|
+
@autotest.results = ["1 scenario (1 passed)", "1 step (1 passed)"]
|
59
|
+
@autotest.hook(:ran_features)
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should show a 'failed' notification" do
|
63
|
+
Autotest::Growl.should_receive(:growl).and_return('failed')
|
64
|
+
@autotest.results = ["2 scenarios (1 failed, 1 passed)", "2 steps (1 failed, 1 passed)"]
|
65
|
+
@autotest.hook(:ran_features)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should show a 'pending' notification" do
|
69
|
+
Autotest::Growl.should_receive(:growl).and_return('pending')
|
70
|
+
@autotest.results = ["2 scenarios (1 undefined, 1 passed)", "2 steps (1 undefined, 1 passed)"]
|
71
|
+
@autotest.hook(:ran_features)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should show an 'error' notification" do
|
75
|
+
Autotest::Growl.should_receive(:growl).and_return('error')
|
76
|
+
@autotest.results = []
|
77
|
+
@autotest.hook(:ran_features)
|
78
|
+
end
|
49
79
|
end
|
50
80
|
end
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karl-autotest-growl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sven Schwyn
|
8
|
-
- Karl O'Keeffe
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
11
|
|
13
|
-
date: 2009-
|
12
|
+
date: 2009-07-24 00:00:00 -07:00
|
14
13
|
default_executable:
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
@@ -21,17 +20,17 @@ dependencies:
|
|
21
20
|
requirements:
|
22
21
|
- - ">="
|
23
22
|
- !ruby/object:Gem::Version
|
24
|
-
version: 4.1.
|
23
|
+
version: 4.1.3
|
25
24
|
version:
|
26
25
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
type: :
|
26
|
+
name: extensions
|
27
|
+
type: :runtime
|
29
28
|
version_requirement:
|
30
29
|
version_requirements: !ruby/object:Gem::Requirement
|
31
30
|
requirements:
|
32
31
|
- - ">="
|
33
32
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
33
|
+
version: 0.6.0
|
35
34
|
version:
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
36
|
name: hoe
|
@@ -41,9 +40,9 @@ dependencies:
|
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
43
|
+
version: 2.3.2
|
45
44
|
version:
|
46
|
-
description: This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and supports Cucumber.
|
45
|
+
description: This gem aims to improve support for Growl notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.
|
47
46
|
email:
|
48
47
|
- ruby@bitcetera.com
|
49
48
|
executables: []
|
@@ -54,7 +53,6 @@ extra_rdoc_files:
|
|
54
53
|
- History.txt
|
55
54
|
- Manifest.txt
|
56
55
|
- PostInstall.txt
|
57
|
-
- README.rdoc
|
58
56
|
files:
|
59
57
|
- History.txt
|
60
58
|
- Manifest.txt
|
@@ -64,13 +62,14 @@ files:
|
|
64
62
|
- autotest-growl.gemspec
|
65
63
|
- growl/growlnotify
|
66
64
|
- growl/growlnotify.com
|
67
|
-
- growl/growlnotify.exe
|
68
65
|
- img/error.png
|
69
66
|
- img/failed.png
|
67
|
+
- img/info.png
|
70
68
|
- img/passed.png
|
71
69
|
- img/pending.png
|
72
70
|
- lib/autotest-growl.rb
|
73
71
|
- lib/autotest/growl.rb
|
72
|
+
- lib/autotest/result.rb
|
74
73
|
- script/console
|
75
74
|
- script/destroy
|
76
75
|
- script/generate
|
@@ -85,7 +84,8 @@ post_install_message: "\n\
|
|
85
84
|
~/.autotest file:\n\n\
|
86
85
|
require 'autotest/growl'\n\n\
|
87
86
|
Make sure Growl is installed on your computer. Download it from:\n\n\
|
88
|
-
http://growl.info\n\
|
87
|
+
http://growl.info (Mac OS X)\n\
|
88
|
+
http://growlforwindows.com (Windows)\n\n\
|
89
89
|
If Growl notifications are not always displayed, take a look at the README\n\
|
90
90
|
for assistance.\n\n\
|
91
91
|
For more information, feedback and bug submissions, please visit:\n\n\
|
@@ -95,7 +95,7 @@ post_install_message: "\n\
|
|
95
95
|
| ZenTest no longer comes with bundled Growl support and therefore the |\n\
|
96
96
|
| require in your ~/.autotest must not contain the absolute path to this |\n\
|
97
97
|
| gem anymore. Please update your ~/.autotest to contain the require line |\n\
|
98
|
-
| mentioned above.
|
98
|
+
| mentioned above. Make sure no ZenTest version <=4.0.0 is installed. |\n\
|
99
99
|
+-------------------------------------------------------------------------+\n\
|
100
100
|
\e[0;30m\n"
|
101
101
|
rdoc_options:
|
data/growl/growlnotify.exe
DELETED
Binary file
|