karl-autotest-growl 0.1.1
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 +17 -0
- data/Manifest.txt +21 -0
- data/PostInstall.txt +23 -0
- data/README.rdoc +171 -0
- data/Rakefile +29 -0
- data/autotest-growl.gemspec +65 -0
- data/growl/growlnotify +0 -0
- data/img/error.png +0 -0
- data/img/failed.png +0 -0
- data/img/passed.png +0 -0
- data/img/pending.png +0 -0
- data/lib/autotest/growl.rb +123 -0
- data/lib/autotest-growl.rb +10 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/autotest-growl_spec.rb +50 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/rspec.rake +21 -0
- metadata +123 -0
data/History.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
== 0.1.2 2009-06-12
|
2
|
+
|
3
|
+
* 3 major improvements
|
4
|
+
* Add priorities to notifications (Michael Moen)
|
5
|
+
* Add clear_terminal configuration option (Michael Moen)
|
6
|
+
* Add show_modified_files configuration option (Graham Savage)
|
7
|
+
|
8
|
+
== 0.1.1 2009-06-02
|
9
|
+
|
10
|
+
* 1 major improvement
|
11
|
+
* Suppress Cucumber notification if not used
|
12
|
+
|
13
|
+
== 0.1.0 2009-05-28
|
14
|
+
|
15
|
+
* Initial release
|
16
|
+
* Growl notifications for Test::Unit, RSpec and Cucumber (workaround)
|
17
|
+
* Formerly part of autotest-mac which is now deprecated
|
data/Manifest.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
autotest-growl.gemspec
|
7
|
+
growl/growlnotify
|
8
|
+
img/error.png
|
9
|
+
img/failed.png
|
10
|
+
img/info.png
|
11
|
+
img/passed.png
|
12
|
+
img/pending.png
|
13
|
+
lib/autotest-growl.rb
|
14
|
+
lib/autotest/growl.rb
|
15
|
+
script/console
|
16
|
+
script/destroy
|
17
|
+
script/generate
|
18
|
+
spec/autotest-growl_spec.rb
|
19
|
+
spec/spec.opts
|
20
|
+
spec/spec_helper.rb
|
21
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
In order to use autotest-growl, the following line has to be added to your
|
2
|
+
~/.autotest file:
|
3
|
+
|
4
|
+
require 'autotest/growl'
|
5
|
+
|
6
|
+
Make sure Growl is installed on your computer. Download it from:
|
7
|
+
|
8
|
+
http://growl.info
|
9
|
+
|
10
|
+
If Growl notifications are not always displayed, take a look at the README
|
11
|
+
for assistance.
|
12
|
+
|
13
|
+
For more information, feedback and bug submissions, please visit:
|
14
|
+
|
15
|
+
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
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
= Autotest Growl
|
2
|
+
|
3
|
+
* Author: Sven Schwyn (http://www.bitcetera.com)
|
4
|
+
* Homepage: http://www.bitcetera.com/products/autotest-growl
|
5
|
+
* Issues and forum: https://forge.bitcetera.com/projects/show/autotest-growl
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
This gem aims to improve support for Growl notification by ZenTest's autotest.
|
10
|
+
It comes with a nice colored Ruby icon set and supports Cucumber
|
11
|
+
notifications.
|
12
|
+
|
13
|
+
The priority of a notification is set according to the actual result so you
|
14
|
+
can configure Growl to style the notifications differently based on these
|
15
|
+
priorities:
|
16
|
+
|
17
|
+
* 2 for error or failed
|
18
|
+
* 0 for info
|
19
|
+
* -1 for pending or unknown
|
20
|
+
* -2 for passed
|
21
|
+
|
22
|
+
Furthermore the terminal running autotest is cleared on every cycle (unless
|
23
|
+
configured otherwise). Don't worry though, it's still possible to scroll up
|
24
|
+
to see the output of previous cycles - at least on the Terminal.app from
|
25
|
+
Apple.
|
26
|
+
|
27
|
+
=== Ruby 1.9.1 Note
|
28
|
+
|
29
|
+
For the moment, autotest growl doesn't seem to work on Ruby 1.9.1. Fixing this
|
30
|
+
might take a while though as autotest itself is currently misbehaving on Ruby
|
31
|
+
1.9 - at least on my setup.
|
32
|
+
|
33
|
+
== REQUIREMENTS:
|
34
|
+
|
35
|
+
* Growl >= 1.1.4
|
36
|
+
* ZenTest >= 4.1.0
|
37
|
+
|
38
|
+
== INSTALL:
|
39
|
+
|
40
|
+
First install the gem:
|
41
|
+
|
42
|
+
sudo gem install autotest-growl
|
43
|
+
|
44
|
+
Then add the following line to your ~/.autotest file:
|
45
|
+
|
46
|
+
require 'autotest/growl'
|
47
|
+
|
48
|
+
Make sure Growl is installed on your computer. You can download it from:
|
49
|
+
|
50
|
+
http://growl.info
|
51
|
+
|
52
|
+
== CONFIGURATION:
|
53
|
+
|
54
|
+
=== Custom Icons
|
55
|
+
|
56
|
+
Using your own set of icons is pretty simple. Just create a directory
|
57
|
+
~/.autotest-growl, copy your icons there and name them passed.png,
|
58
|
+
pending.png, failed.png, error.png and info.png.
|
59
|
+
|
60
|
+
=== Don't Clear the Terminal
|
61
|
+
|
62
|
+
Add the following to your ~/.autotest if you don't want the terminal to
|
63
|
+
be cleared before running a test:
|
64
|
+
|
65
|
+
Autotest::Growl::clear_terminal = false
|
66
|
+
|
67
|
+
=== Hide the Label
|
68
|
+
|
69
|
+
If you prefer the Growl notifications not to show labels such as "LABEL:
|
70
|
+
All tests have passed", add the following to your ~/.autotest:
|
71
|
+
|
72
|
+
Autotest::Growl::hide_label = true
|
73
|
+
|
74
|
+
=== Show Modified Files
|
75
|
+
|
76
|
+
Add the following to your ~/.autotest if you would like to receive a Growl
|
77
|
+
notification listing the files modified before tests are re-run.
|
78
|
+
|
79
|
+
Autotest::Growl::show_modified_files = true
|
80
|
+
|
81
|
+
== TROUBLESHOOTING:
|
82
|
+
|
83
|
+
=== Loading the Plugin Seems to Fail
|
84
|
+
|
85
|
+
Most likely you still have an old version of ZenTest <= 4.0.0 installed,
|
86
|
+
check it with:
|
87
|
+
|
88
|
+
gem list ZenTest
|
89
|
+
|
90
|
+
To uninstall a specific version (e.g. 4.0.0), type:
|
91
|
+
|
92
|
+
sudo gem uninstall ZenTest --version=4.0.0
|
93
|
+
|
94
|
+
Or remove all outdated versions of all installed gems:
|
95
|
+
|
96
|
+
sudo gem cleanup
|
97
|
+
|
98
|
+
=== Missing Cucumber Notifications
|
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
|
105
|
+
|
106
|
+
Under some circumstances, Growl notifications seem to be swallowed randomly.
|
107
|
+
If this happens to you, try the following.
|
108
|
+
|
109
|
+
Add this to your ~/.autotest:
|
110
|
+
|
111
|
+
Autotest::Growl::remote_notification = true
|
112
|
+
|
113
|
+
Now open "System Preferences -> Growl -> Network" and set the checkboxes
|
114
|
+
"Listen for incoming notifications" and "Allow remote application
|
115
|
+
registration”. Try whether remote notifications work with the following
|
116
|
+
test:
|
117
|
+
|
118
|
+
find /Library/Ruby /usr -name growlnotify -exec {} -H localhost -n autotest -m ok \;
|
119
|
+
|
120
|
+
If you get a NSPortTimeoutException, you should restart Growl and check
|
121
|
+
whether a firewall is blocking the connection. Once the notification is
|
122
|
+
displayed, go back to the System Preferences and disable the checkbox
|
123
|
+
"Allow remote application registration" again.
|
124
|
+
|
125
|
+
== DEVELOPMENT:
|
126
|
+
|
127
|
+
You can install the bleeding-edge version as follows:
|
128
|
+
|
129
|
+
sudo gem uninstall autotest-growl
|
130
|
+
sudo gem install svoop-autotest-growl --source http://gems.github.com
|
131
|
+
|
132
|
+
Please submit issues on:
|
133
|
+
|
134
|
+
https://forge.bitcetera.com/projects/show/autotest-growl
|
135
|
+
|
136
|
+
To contribute code, fork the project on Github, add your code and submit a
|
137
|
+
pull request:
|
138
|
+
|
139
|
+
http://github.com/guides/fork-a-project-and-submit-your-modifications
|
140
|
+
|
141
|
+
== CONTRIBUTIONS:
|
142
|
+
|
143
|
+
Thanks to the following folks who have contributed to this project:
|
144
|
+
|
145
|
+
* Michael Moen
|
146
|
+
* Graham Savage
|
147
|
+
|
148
|
+
== LICENSE:
|
149
|
+
|
150
|
+
(The MIT License)
|
151
|
+
|
152
|
+
Copyright (c) 2009 Sven Schwyn
|
153
|
+
|
154
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
155
|
+
a copy of this software and associated documentation files (the
|
156
|
+
'Software'), to deal in the Software without restriction, including
|
157
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
158
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
159
|
+
permit persons to whom the Software is furnished to do so, subject to
|
160
|
+
the following conditions:
|
161
|
+
|
162
|
+
The above copyright notice and this permission notice shall be
|
163
|
+
included in all copies or substantial portions of the Software.
|
164
|
+
|
165
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
166
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
167
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
168
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
169
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
170
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
171
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
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'
|
4
|
+
|
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
|
+
]
|
19
|
+
|
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'
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'newgem/tasks'
|
27
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
28
|
+
|
29
|
+
task :default => [:spec]
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{autotest-growl}
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
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-06-03}
|
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
|
+
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"]
|
14
|
+
s.homepage = %q{http://www.bitcetera.com/products/autotest-growl}
|
15
|
+
s.post_install_message = %q{
|
16
|
+
[1;32mIn order to use autotest-growl, the following line has to be added to your
|
17
|
+
~/.autotest file:
|
18
|
+
|
19
|
+
require 'autotest/growl'
|
20
|
+
|
21
|
+
Make sure Growl is installed on your computer. Download it from:
|
22
|
+
|
23
|
+
http://growl.info
|
24
|
+
|
25
|
+
If Growl notifications are not always displayed, take a look at the README
|
26
|
+
for assistance.
|
27
|
+
|
28
|
+
For more information, feedback and bug submissions, please visit:
|
29
|
+
|
30
|
+
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
|
+
[0;30m
|
40
|
+
}
|
41
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubyforge_project = %q{autotest-growl}
|
44
|
+
s.rubygems_version = %q{1.3.3}
|
45
|
+
s.summary = %q{Next generation Growl notification support for ZenTest's autotest.}
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
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"])
|
55
|
+
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"])
|
59
|
+
end
|
60
|
+
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"])
|
64
|
+
end
|
65
|
+
end
|
data/growl/growlnotify
ADDED
Binary file
|
data/img/error.png
ADDED
Binary file
|
data/img/failed.png
ADDED
Binary file
|
data/img/passed.png
ADDED
Binary file
|
data/img/pending.png
ADDED
Binary file
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'autotest'
|
3
|
+
|
4
|
+
##
|
5
|
+
# Autotest::Growl
|
6
|
+
#
|
7
|
+
# == FEATUERS:
|
8
|
+
# * Display autotest results as local or remote Growl notifications.
|
9
|
+
# * Clean the terminal on every test cycle while maintaining scrollback.
|
10
|
+
#
|
11
|
+
# == SYNOPSIS:
|
12
|
+
# ~/.autotest
|
13
|
+
# require 'autotest/growl'
|
14
|
+
module Autotest::Growl
|
15
|
+
|
16
|
+
GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '../..'))
|
17
|
+
|
18
|
+
@label = ''
|
19
|
+
@modified_files = []
|
20
|
+
|
21
|
+
@@remote_notification = false
|
22
|
+
@@clear_terminal = true
|
23
|
+
@@hide_label = false
|
24
|
+
@@show_modified_files = false
|
25
|
+
|
26
|
+
##
|
27
|
+
# Whether to use remote or local notificaton (default).
|
28
|
+
def self.remote_notification=(boolean)
|
29
|
+
@@remote_notification = boolean
|
30
|
+
end
|
31
|
+
|
32
|
+
##
|
33
|
+
# Whether to clear the terminal before running tests (default) or not.
|
34
|
+
def self.clear_terminal=(boolean)
|
35
|
+
@@clear_terminal = boolean
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Whether to display the label (default) or not.
|
40
|
+
def self.hide_label=(boolean)
|
41
|
+
@@hide_label = boolean
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Whether to display the modified files or not (default).
|
46
|
+
def self.show_modified_files=(boolean)
|
47
|
+
@@show_modified_files = boolean
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Display a message through Growl.
|
52
|
+
def self.growl title, message, icon, priority=0, stick=""
|
53
|
+
growl = File.join(GEM_PATH, 'growl', 'growlnotify')
|
54
|
+
image = File.join(ENV['HOME'], '.autotest-growl', "#{icon}.png")
|
55
|
+
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}"
|
58
|
+
else
|
59
|
+
system "#{growl} -n autotest --image '#{image}' -p #{priority} -m #{message.inspect} '#{title}' #{stick}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Display the modified files.
|
65
|
+
Autotest.add_hook :updated do |autotest, modified|
|
66
|
+
if @@show_modified_files
|
67
|
+
if modified != @last_modified
|
68
|
+
growl @label + 'Modifications detected.', modified.collect {|m| m[0]}.join(', '), 'info', 0
|
69
|
+
@last_modified = modified
|
70
|
+
end
|
71
|
+
end
|
72
|
+
false
|
73
|
+
end
|
74
|
+
|
75
|
+
##
|
76
|
+
# Set the label and clear the terminal.
|
77
|
+
Autotest.add_hook :run_command do
|
78
|
+
@label = File.basename(Dir.pwd).upcase + ': ' if !@@hide_label
|
79
|
+
@run_scenarios = false
|
80
|
+
print "\n"*2 + '-'*80 + "\n"*2
|
81
|
+
print "\e[2J\e[f" if @@clear_terminal
|
82
|
+
false
|
83
|
+
end
|
84
|
+
|
85
|
+
##
|
86
|
+
# Parse the test results and send them to Growl.
|
87
|
+
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
|
97
|
+
else
|
98
|
+
growl @label + 'All tests have passed.', gist, 'passed', -2
|
99
|
+
@run_scenarios = true
|
100
|
+
end
|
101
|
+
end
|
102
|
+
false
|
103
|
+
end
|
104
|
+
|
105
|
+
# Growl results of Cucumber
|
106
|
+
Autotest.add_hook :ran_features do |autotest|
|
107
|
+
|
108
|
+
gist = autotest.results.grep(/\d+\s+scenario.*\)/).join(" / ").strip()
|
109
|
+
if gist == ''
|
110
|
+
growl @label + 'Cannot run scenarios.', '', 'error'
|
111
|
+
else
|
112
|
+
if gist =~ /[1-9]\d*\s+(failed)/
|
113
|
+
growl @label + 'Some scenarios have failed.', gist, 'failed'
|
114
|
+
elsif gist =~ /pending/
|
115
|
+
growl @label + 'Some scenarios are skipped.', gist, 'skipped'
|
116
|
+
else
|
117
|
+
growl @label + 'All scenarios have passed.', gist, 'passed'
|
118
|
+
end
|
119
|
+
end
|
120
|
+
false
|
121
|
+
end
|
122
|
+
|
123
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
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"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "handling results" do
|
4
|
+
before do
|
5
|
+
@autotest = Autotest.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "for RSpec" do
|
9
|
+
it "should show a passing Growl notification" do
|
10
|
+
Autotest::Growl.should_receive(:growl).and_return('passed')
|
11
|
+
@autotest.results = ["10 examples, 0 failures"]
|
12
|
+
@autotest.hook(:ran_command)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should show a failing Growl notification" do
|
16
|
+
Autotest::Growl.should_receive(:growl).and_return('passed')
|
17
|
+
@autotest.results = ["10 examples, 1 failures"]
|
18
|
+
@autotest.hook(:ran_command)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should show a pending Growl notification" do
|
22
|
+
Autotest::Growl.should_receive(:growl).and_return('passed')
|
23
|
+
@autotest.results = ["10 examples, 0 failures, 1 pending"]
|
24
|
+
@autotest.hook(:ran_command)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "for Test::Unit" do
|
29
|
+
it "should show a passing Growl notification" do
|
30
|
+
Autotest::Growl.should_receive(:growl).and_return('passed')
|
31
|
+
@autotest.results = ["1 tests, 1 assertions, 0 failures, 0 errors"]
|
32
|
+
@autotest.hook(:ran_command)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should show a failing Growl notification" do
|
36
|
+
Autotest::Growl.should_receive(:growl).twice.and_return('passed')
|
37
|
+
@autotest.results = ["1 tests, 1 assertions, 1 failures, 0 errors"]
|
38
|
+
@autotest.hook(:ran_command)
|
39
|
+
@autotest.results = ["1 tests, 1 assertions, 0 failures, 1 errors"]
|
40
|
+
@autotest.hook(:ran_command)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# FIXME: This is a temporary workaround until Cucumber is properly integrated!
|
45
|
+
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"
|
49
|
+
end
|
50
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
|
+
require 'autotest/growl'
|
11
|
+
|
12
|
+
module Autotest::Growl
|
13
|
+
def self.growl(title, message, icon, priority=0, stick="")
|
14
|
+
icon
|
15
|
+
end
|
16
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: karl-autotest-growl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sven Schwyn
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-03 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ZenTest
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
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
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hoe
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.8.0
|
44
|
+
version:
|
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.
|
46
|
+
email:
|
47
|
+
- ruby@bitcetera.com
|
48
|
+
executables: []
|
49
|
+
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- History.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- PostInstall.txt
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- History.txt
|
59
|
+
- Manifest.txt
|
60
|
+
- PostInstall.txt
|
61
|
+
- README.rdoc
|
62
|
+
- Rakefile
|
63
|
+
- autotest-growl.gemspec
|
64
|
+
- growl/growlnotify
|
65
|
+
- img/error.png
|
66
|
+
- img/failed.png
|
67
|
+
- img/passed.png
|
68
|
+
- img/pending.png
|
69
|
+
- lib/autotest-growl.rb
|
70
|
+
- lib/autotest/growl.rb
|
71
|
+
- script/console
|
72
|
+
- script/destroy
|
73
|
+
- script/generate
|
74
|
+
- spec/autotest-growl_spec.rb
|
75
|
+
- spec/spec.opts
|
76
|
+
- spec/spec_helper.rb
|
77
|
+
- tasks/rspec.rake
|
78
|
+
has_rdoc: false
|
79
|
+
homepage: http://www.bitcetera.com/products/autotest-growl
|
80
|
+
post_install_message: "\n\
|
81
|
+
\e[1;32mIn order to use autotest-growl, the following line has to be added to your\n\
|
82
|
+
~/.autotest file:\n\n\
|
83
|
+
require 'autotest/growl'\n\n\
|
84
|
+
Make sure Growl is installed on your computer. Download it from:\n\n\
|
85
|
+
http://growl.info\n\n\
|
86
|
+
If Growl notifications are not always displayed, take a look at the README\n\
|
87
|
+
for assistance.\n\n\
|
88
|
+
For more information, feedback and bug submissions, please visit:\n\n\
|
89
|
+
http://www.bitcetera.com/products/autotest-growl\n\n\
|
90
|
+
+-------------------------------------------------------------------------+\n\
|
91
|
+
| IMPORTANT NOTE FOR UPGRADES FROM VERSION 0.1.0 |\n\
|
92
|
+
| ZenTest no longer comes with bundled Growl support and therefore the |\n\
|
93
|
+
| require in your ~/.autotest must not contain the absolute path to this |\n\
|
94
|
+
| gem anymore. Please update your ~/.autotest to contain the require line |\n\
|
95
|
+
| mentioned above. |\n\
|
96
|
+
+-------------------------------------------------------------------------+\n\
|
97
|
+
\e[0;30m\n"
|
98
|
+
rdoc_options:
|
99
|
+
- --main
|
100
|
+
- README.rdoc
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
version:
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
114
|
+
version:
|
115
|
+
requirements: []
|
116
|
+
|
117
|
+
rubyforge_project: autotest-growl
|
118
|
+
rubygems_version: 1.2.0
|
119
|
+
signing_key:
|
120
|
+
specification_version: 3
|
121
|
+
summary: Next generation Growl notification support for ZenTest's autotest.
|
122
|
+
test_files: []
|
123
|
+
|