autotest-growl 0.1.2 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,22 @@
1
+ == 0.1.5 2009-07-27
2
+
3
+ * 1 major improvement
4
+ * More reliable growlnotify call
5
+
6
+ == 0.1.4 2009-07-23
7
+
8
+ * 1 major improvement
9
+ * Support for Windows (Karl O'Keeffe)
10
+
11
+ == 0.1.3 2009-07-22
12
+
13
+ * 1 major improvement
14
+ * Better result analysis and more readable notifications
15
+ * 3 minor improvement
16
+ * Move Cucumber notification to :ran_features hook (Karl O'Keeffe)
17
+ * Add one_notification_per_run configuration option
18
+ * Notification for undefined Cucumber scenarios/steps
19
+
1
20
  == 0.1.2 2009-06-12
2
21
 
3
22
  * 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.
@@ -13,11 +14,3 @@ for assistance.
13
14
  For more information, feedback and bug submissions, please visit:
14
15
 
15
16
  http://www.bitcetera.com/products/autotest-growl
16
-
17
- +-------------------------------------------------------------------------+
18
- | IMPORTANT NOTE FOR UPGRADES FROM VERSION 0.1.0 |
19
- | ZenTest no longer comes with bundled Growl support and therefore the |
20
- | require in your ~/.autotest must not contain the absolute path to this |
21
- | gem anymore. Please update your ~/.autotest to contain the require line |
22
- | mentioned above. Make sure no ZenTest version <=4.0.0 is installed. |
23
- +-------------------------------------------------------------------------+
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,8 @@ might take a while though as autotest itself is currently misbehaving on Ruby
32
32
 
33
33
  == REQUIREMENTS:
34
34
 
35
- * Growl >= 1.1.4
36
- * ZenTest >= 4.1.0
35
+ * Growl >= 1.1.5 (Mac OS X) or >= 2.0b18 (Windows)
36
+ * ZenTest >= 4.1.3
37
37
 
38
38
  == INSTALL:
39
39
 
@@ -47,7 +47,8 @@ Then add the following line to your ~/.autotest file:
47
47
 
48
48
  Make sure Growl is installed on your computer. You can download it from:
49
49
 
50
- http://growl.info
50
+ Mac OS X: http://growl.info
51
+ Windows: http://growlforwindows.com
51
52
 
52
53
  == CONFIGURATION:
53
54
 
@@ -71,6 +72,13 @@ All tests have passed", add the following to your ~/.autotest:
71
72
 
72
73
  Autotest::Growl::hide_label = true
73
74
 
75
+ === One Notifications per Run
76
+
77
+ Allow only one test and one feature notification per run by adding the
78
+ following to your ~/.autotest:
79
+
80
+ Autotest::Growl::one_notification_per_run = true
81
+
74
82
  === Show Modified Files
75
83
 
76
84
  Add the following to your ~/.autotest if you would like to receive a Growl
@@ -95,16 +103,10 @@ Or remove all outdated versions of all installed gems:
95
103
 
96
104
  sudo gem cleanup
97
105
 
98
- === Missing Cucumber Notifications
106
+ === Unreliable Growl Notifications on Mac OS X
99
107
 
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
105
-
106
- Under some circumstances, Growl notifications seem to be swallowed randomly.
107
- If this happens to you, try the following.
108
+ Under some circumstances, Growl notifications seem to be swallowed randomly
109
+ on Mac OS X. If this happens to you, try the following.
108
110
 
109
111
  Add this to your ~/.autotest:
110
112
 
@@ -129,6 +131,11 @@ You can install the bleeding-edge version as follows:
129
131
  sudo gem uninstall autotest-growl
130
132
  sudo gem install svoop-autotest-growl --source http://gems.github.com
131
133
 
134
+ Bleeding-edge gems contains a fourth version digit group (e.g. the .8 in
135
+ 0.1.5.8) to make sure Github builds the gem whenever new code is committed.
136
+ If there is no fourth version digit group, the edge version is identical
137
+ to the stable version from Rubyforge.
138
+
132
139
  Please submit issues on:
133
140
 
134
141
  https://forge.bitcetera.com/projects/show/autotest-growl
@@ -144,6 +151,7 @@ Thanks to the following folks who have contributed to this project:
144
151
 
145
152
  * Michael Moen
146
153
  * Graham Savage
154
+ * Karl O'Keeffe
147
155
 
148
156
  == LICENSE:
149
157
 
data/Rakefile CHANGED
@@ -1,29 +1,27 @@
1
- require 'rubygems' unless ENV['NO_RUBYGEMS']
2
- %w[rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
- require File.dirname(__FILE__) + '/lib/autotest-growl'
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+ require './lib/autotest-growl'
4
6
 
5
- $hoe = Hoe.new('autotest-growl', AutotestGrowl::VERSION) do |p|
6
- p.developer('Sven Schwyn', 'ruby@bitcetera.com')
7
- p.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
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
- p.clean_globs |= %w[**/.DS_Store tmp *.log]
21
- path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
22
- p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
23
- p.rsync_args = '-av --delete --ignore-errors'
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
+ ]
24
22
  end
25
23
 
26
24
  require 'newgem/tasks'
27
25
  Dir['tasks/**/*.rake'].each { |t| load t }
28
26
 
29
- task :default => [:spec]
27
+ task :default => [:spec]
@@ -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.1"
5
+ s.version = "0.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sven Schwyn"]
9
- s.date = %q{2009-06-03}
9
+ s.date = %q{2009-07-27}
10
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", "README.rdoc"]
13
- s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "autotest-growl.gemspec", "growl/growlnotify", "img/error.png", "img/failed.png", "img/passed.png", "img/pending.png", "lib/autotest-growl.rb", "lib/autotest/growl.rb", "script/console", "script/destroy", "script/generate", "spec/autotest-growl_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
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
  In 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.
@@ -28,20 +29,12 @@ for assistance.
28
29
  For more information, feedback and bug submissions, please visit:
29
30
 
30
31
  http://www.bitcetera.com/products/autotest-growl
31
-
32
- +-------------------------------------------------------------------------+
33
- | IMPORTANT NOTE FOR UPGRADES FROM VERSION 0.1.0 |
34
- | ZenTest no longer comes with bundled Growl support and therefore the |
35
- | require in your ~/.autotest must not contain the absolute path to this |
36
- | gem anymore. Please update your ~/.autotest to contain the require line |
37
- | mentioned above. |
38
- +-------------------------------------------------------------------------+
39
32
  
40
33
  }
41
34
  s.rdoc_options = ["--main", "README.rdoc"]
42
35
  s.require_paths = ["lib"]
43
36
  s.rubyforge_project = %q{autotest-growl}
44
- s.rubygems_version = %q{1.3.3}
37
+ s.rubygems_version = %q{1.3.4}
45
38
  s.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
46
39
 
47
40
  if s.respond_to? :specification_version then
@@ -49,17 +42,14 @@ http://www.bitcetera.com/products/autotest-growl
49
42
  s.specification_version = 3
50
43
 
51
44
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
- s.add_runtime_dependency(%q<ZenTest>, [">= 4.1.0"])
53
- s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
54
- s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
45
+ s.add_runtime_dependency(%q<ZenTest>, [">= 4.1.3"])
46
+ s.add_development_dependency(%q<hoe>, [">= 2.3.2"])
55
47
  else
56
- s.add_dependency(%q<ZenTest>, [">= 4.1.0"])
57
- s.add_dependency(%q<newgem>, [">= 1.4.1"])
58
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
48
+ s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
49
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
59
50
  end
60
51
  else
61
- s.add_dependency(%q<ZenTest>, [">= 4.1.0"])
62
- s.add_dependency(%q<newgem>, [">= 1.4.1"])
63
- s.add_dependency(%q<hoe>, [">= 1.8.0"])
52
+ s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
53
+ s.add_dependency(%q<hoe>, [">= 2.3.2"])
64
54
  end
65
55
  end
data/growl/growlnotify CHANGED
Binary file
Binary file
@@ -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__) + '/autotest/growl'
4
+ require File.join(File.dirname(__FILE__), 'autotest', 'growl')
5
5
 
6
6
  module AutotestGrowl
7
7
 
8
- VERSION = '0.1.2'
8
+ VERSION = '0.1.5'
9
9
 
10
10
  end
@@ -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)
@@ -49,20 +59,29 @@ module Autotest::Growl
49
59
 
50
60
  ##
51
61
  # Display a message through Growl.
52
- def self.growl title, message, icon, priority=0, stick=""
62
+ def self.growl(title, message, icon, priority=0, stick="")
53
63
  growl = File.join(GEM_PATH, 'growl', 'growlnotify')
54
64
  image = File.join(ENV['HOME'], '.autotest-growl', "#{icon}.png")
55
65
  image = File.join(GEM_PATH, 'img', "#{icon}.png") unless File.exists?(image)
56
- if @@remote_notification
57
- system "#{growl} -H localhost -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
66
+ case RUBY_PLATFORM
67
+ when /mswin/
68
+ growl += '.com'
69
+ system %(#{growl} #{message.inspect} /a:"Autotest" /r:"Autotest" /n:"Autotest" /i:"#{image}" /p:#{priority} /t:"#{title}")
70
+ when /darwin/
71
+ if @@remote_notification
72
+ system %(#{growl} -H localhost -n Autotest --image '#{image}' -p #{priority} -m '#{message}' '#{title}' #{stick} &)
73
+ else
74
+ system %(#{growl} -w -n Autotest --image '#{image}' -p #{priority} -m '#{message}' '#{title}' #{stick} &)
75
+ end
58
76
  else
59
- system "#{growl} -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
77
+ raise "#{RUBY_PLATFORM} is not supported by autotest-growl"
60
78
  end
61
79
  end
62
80
 
63
81
  ##
64
82
  # Display the modified files.
65
83
  Autotest.add_hook :updated do |autotest, modified|
84
+ @ran_tests = @ran_features = false
66
85
  if @@show_modified_files
67
86
  if modified != @last_modified
68
87
  growl @label + 'Modifications detected.', modified.collect {|m| m[0]}.join(', '), 'info', 0
@@ -76,47 +95,72 @@ module Autotest::Growl
76
95
  # Set the label and clear the terminal.
77
96
  Autotest.add_hook :run_command do
78
97
  @label = File.basename(Dir.pwd).upcase + ': ' if !@@hide_label
79
- @run_scenarios = false
80
98
  print "\n"*2 + '-'*80 + "\n"*2
81
99
  print "\e[2J\e[f" if @@clear_terminal
82
100
  false
83
101
  end
84
102
 
85
103
  ##
86
- # Parse the test results and send them to Growl.
104
+ # Parse the RSpec and Test::Unit results and send them to Growl.
87
105
  Autotest.add_hook :ran_command do |autotest|
88
- gist = autotest.results.grep(/\d+\s+(example|test)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
89
- if gist == ''
90
- growl @label + 'Cannot run tests.', '', 'error', 2
91
- else
92
- if gist =~ /[1-9]\d*\s+(failure|error)/
93
- growl @label + 'Some tests have failed.', gist, 'failed', 2
94
- elsif gist =~ /pending/
95
- growl @label + 'Some tests are pending.', gist, 'pending', -1
96
- @run_scenarios = true
106
+ unless @@one_notification_per_run && @ran_tests
107
+ result = Result.new(autotest)
108
+ if result.exists?
109
+ case result.framework
110
+ when 'test-unit'
111
+ if result.has?('test-error')
112
+ growl @label + 'Cannot run some unit tests.', "#{result.get('test-error')} in #{result.get('test')}", 'error', 2
113
+ elsif result.has?('test-failed')
114
+ growl @label + 'Some unit tests failed.', "#{result['test-failed']} of #{result.get('test-assertion')} in #{result.get('test')} failed", 'failed', 2
115
+ else
116
+ growl @label + 'All unit tests passed.', "#{result.get('test-assertion')} in #{result.get('test')}", 'passed', -2
117
+ end
118
+ when 'rspec'
119
+ if result.has?('example-failed')
120
+ growl @label + 'Some RSpec examples failed.', "#{result['example-failed']} of #{result.get('example')} failed", 'failed', 2
121
+ elsif result.has?('example-pending')
122
+ growl @label + 'Some RSpec examples are pending.', "#{result['example-pending']} of #{result.get('example')} pending", 'pending', -1
123
+ else
124
+ growl @label + 'All RSpec examples passed.', "#{result.get('example')}", 'passed', -2
125
+ end
126
+ end
97
127
  else
98
- growl @label + 'All tests have passed.', gist, 'passed', -2
99
- @run_scenarios = true
128
+ growl @label + 'Could not run tests.', '', 'error', 2
100
129
  end
130
+ @ran_test = true
101
131
  end
102
132
  false
103
133
  end
104
134
 
105
- # FIXME: This is a temporary workaround until Cucumber is properly integrated!
106
- Autotest.add_hook :waiting do |autotest|
107
- if @run_scenarios && !autotest.results.grep(/^\d+ scenario/).empty?
108
- gist = autotest.results.grep(/\d+\s+(scenario|step)s?/).map {|s| s.gsub(/(\e.*?m|\n)/, '') }.join(" / ")
109
- if gist == ''
110
- growl @label + 'Cannot run scenarios.', '', 'error', 2
111
- else
112
- if gist =~ /failed/
113
- growl @label + 'Some scenarios have failed.', gist, 'failed', 2
114
- elsif gist =~ /undefined/
115
- growl @label + 'Some scenarios are undefined.', gist, 'pending', -1
116
- else
117
- growl @label + 'All scenarios have passed.', gist, 'passed', -2
135
+ ##
136
+ # Parse the Cucumber results and sent them to Growl.
137
+ Autotest.add_hook :ran_features do |autotest|
138
+ unless @@one_notification_per_run && @ran_features
139
+ result = Result.new(autotest)
140
+ if result.exists?
141
+ case result.framework
142
+ when 'cucumber'
143
+ explanation = []
144
+ if result.has?('scenario-undefined') || result.has?('step-undefined')
145
+ explanation << "#{result['scenario-undefined']} of #{result.get('scenario')} not defined" if result['scenario-undefined']
146
+ explanation << "#{result['step-undefined']} of #{result.get('step')} not defined" if result['step-undefined']
147
+ growl @label + 'Some Cucumber scenarios are not defined.', "#{explanation.join("\n")}", 'pending', -1
148
+ elsif result.has?('scenario-failed') || result.has?('step-failed')
149
+ explanation << "#{result['scenario-failed']} of #{result.get('scenario')} failed" if result['scenario-failed']
150
+ explanation << "#{result['step-failed']} of #{result.get('step')} failed" if result['step-failed']
151
+ growl @label + 'Some Cucumber scenarios failed.', "#{explanation.join("\n")}", 'failed', 2
152
+ elsif result.has?('scenario-pending') || result.has?('step-pending')
153
+ explanation << "#{result['scenario-pending']} of #{result.get('scenario')} pending" if result['scenario-pending']
154
+ explanation << "#{result['step-pending']} of #{result.get('step')} pending" if result['step-pending']
155
+ growl @label + 'Some Cucumber scenarios are pending.', "#{explanation.join("\n")}", 'pending', -1
156
+ else
157
+ growl @label + 'All Cucumber features passed.', '', 'passed', -2
158
+ end
118
159
  end
160
+ else
161
+ growl @label + 'Could not run features.', '', 'error', 2
119
162
  end
163
+ @ran_features = true
120
164
  end
121
165
  false
122
166
  end
@@ -0,0 +1,64 @@
1
+ class Result
2
+
3
+ ##
4
+ # Analyze test result lines and return the numbers in a hash.
5
+ def initialize(autotest)
6
+ @numbers = {}
7
+ lines = autotest.results.map {|s| s.gsub(/(\e.*?m|\n)/, '') } # remove escape sequences
8
+ lines.reject! {|line| !line.match(/\d+\s+(example|test|scenario|step)s?/) } # isolate result numbers
9
+ lines.each do |line|
10
+ prefix = nil
11
+ line.scan(/([1-9]\d*)\s(\w+)/) do |number, kind|
12
+ kind.sub!(/s$/, '') # singularize
13
+ kind.sub!(/failure/, 'failed') # homogenize
14
+ if prefix
15
+ @numbers["#{prefix}-#{kind}"] = number.to_i
16
+ else
17
+ @numbers[kind] = number.to_i
18
+ prefix = kind
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ ##
25
+ # Determine the testing framework used.
26
+ def framework
27
+ case
28
+ when @numbers['test']: 'test-unit'
29
+ when @numbers['example']: 'rspec'
30
+ when @numbers['scenario']: 'cucumber'
31
+ end
32
+ end
33
+
34
+ ##
35
+ # Determine whether a result exists at all.
36
+ def exists?
37
+ !@numbers.empty?
38
+ end
39
+
40
+ ##
41
+ # Check whether a specific result is present.
42
+ def has?(kind)
43
+ @numbers.has_key?(kind)
44
+ end
45
+
46
+ ##
47
+ # Get a plain result number.
48
+ def [](kind)
49
+ @numbers[kind]
50
+ end
51
+
52
+ ##
53
+ # Get a labelled result number. The prefix is removed and the label pluralized if necessary.
54
+ def get(kind)
55
+ "#{@numbers[kind]} #{kind.sub(/^.*-/, '')}#{'s' if @numbers[kind] != 1 && !kind.match(/(ed|ing)$/)}" if @numbers[kind]
56
+ end
57
+
58
+ ##
59
+ # Get the fatal error if any.
60
+ def fatal_error
61
+
62
+ end
63
+
64
+ 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/autotest-growl.rb'}"
9
- puts "Loading autotest-growl gem"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/testli.rb'}"
9
+ puts "Loading testli gem"
10
10
  exec "#{irb} #{libs} --simple-prompt"
@@ -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 passing Growl notification" do
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 failing Growl notification" do
16
- Autotest::Growl.should_receive(:growl).and_return('passed')
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 Growl notification" do
22
- Autotest::Growl.should_receive(:growl).and_return('passed')
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 passing Growl notification" do
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 failing Growl notification" do
36
- Autotest::Growl.should_receive(:growl).twice.and_return('passed')
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 passing Growl notification"
47
- it "should show a failing Growl notification"
48
- it "should show a pending Growl notification"
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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autotest-growl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sven Schwyn
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-12 00:00:00 +02:00
12
+ date: 2009-07-27 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -20,17 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 4.1.0
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: newgem
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: 1.4.1
23
+ version: 4.1.3
34
24
  version:
35
25
  - !ruby/object:Gem::Dependency
36
26
  name: hoe
@@ -40,7 +30,7 @@ dependencies:
40
30
  requirements:
41
31
  - - ">="
42
32
  - !ruby/object:Gem::Version
43
- version: 1.8.0
33
+ version: 2.3.2
44
34
  version:
45
35
  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.
46
36
  email:
@@ -53,7 +43,6 @@ extra_rdoc_files:
53
43
  - History.txt
54
44
  - Manifest.txt
55
45
  - PostInstall.txt
56
- - README.rdoc
57
46
  files:
58
47
  - History.txt
59
48
  - Manifest.txt
@@ -62,6 +51,7 @@ files:
62
51
  - Rakefile
63
52
  - autotest-growl.gemspec
64
53
  - growl/growlnotify
54
+ - growl/growlnotify.com
65
55
  - img/error.png
66
56
  - img/failed.png
67
57
  - img/info.png
@@ -69,6 +59,7 @@ files:
69
59
  - img/pending.png
70
60
  - lib/autotest-growl.rb
71
61
  - lib/autotest/growl.rb
62
+ - lib/autotest/result.rb
72
63
  - script/console
73
64
  - script/destroy
74
65
  - script/generate
@@ -85,18 +76,12 @@ post_install_message: "\n\
85
76
  ~/.autotest file:\n\n\
86
77
  require 'autotest/growl'\n\n\
87
78
  Make sure Growl is installed on your computer. Download it from:\n\n\
88
- http://growl.info\n\n\
79
+ http://growl.info (Mac OS X)\n\
80
+ http://growlforwindows.com (Windows)\n\n\
89
81
  If Growl notifications are not always displayed, take a look at the README\n\
90
82
  for assistance.\n\n\
91
83
  For more information, feedback and bug submissions, please visit:\n\n\
92
- http://www.bitcetera.com/products/autotest-growl\n\n\
93
- +-------------------------------------------------------------------------+\n\
94
- | IMPORTANT NOTE FOR UPGRADES FROM VERSION 0.1.0 |\n\
95
- | ZenTest no longer comes with bundled Growl support and therefore the |\n\
96
- | require in your ~/.autotest must not contain the absolute path to this |\n\
97
- | gem anymore. Please update your ~/.autotest to contain the require line |\n\
98
- | mentioned above. Make sure no ZenTest version <=4.0.0 is installed. |\n\
99
- +-------------------------------------------------------------------------+\n\
84
+ http://www.bitcetera.com/products/autotest-growl\n\
100
85
  \e[0;30m\n"
101
86
  rdoc_options:
102
87
  - --main
@@ -118,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
103
  requirements: []
119
104
 
120
105
  rubyforge_project: autotest-growl
121
- rubygems_version: 1.3.3
106
+ rubygems_version: 1.3.4
122
107
  signing_key:
123
108
  specification_version: 3
124
109
  summary: Next generation Growl notification support for ZenTest's autotest.