stack-autotest-notify-osd 0.0.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/Manifest.txt +23 -0
- data/PostInstall.txt +9 -0
- data/README.rdoc +90 -0
- data/Rakefile +26 -0
- data/autotest-notify-osd.gemspec +48 -0
- data/img/error.png +0 -0
- data/img/failed.png +0 -0
- data/img/info.png +0 -0
- data/img/passed.png +0 -0
- data/img/pending.png +0 -0
- data/lib/autotest-notify-osd.rb +10 -0
- data/lib/autotest/notify-osd.rb +166 -0
- data/lib/autotest/result.rb +64 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/autotest-notify-osd_spec.rb +80 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +16 -0
- data/tasks/rspec.rake +21 -0
- metadata +99 -0
data/Manifest.txt
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
autotest-growl.gemspec
|
7
|
+
growl/growlnotify
|
8
|
+
growl/growlnotify.com
|
9
|
+
img/error.png
|
10
|
+
img/failed.png
|
11
|
+
img/info.png
|
12
|
+
img/passed.png
|
13
|
+
img/pending.png
|
14
|
+
lib/autotest-growl.rb
|
15
|
+
lib/autotest/growl.rb
|
16
|
+
lib/autotest/result.rb
|
17
|
+
script/console
|
18
|
+
script/destroy
|
19
|
+
script/generate
|
20
|
+
spec/autotest-growl_spec.rb
|
21
|
+
spec/spec.opts
|
22
|
+
spec/spec_helper.rb
|
23
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
= Autotest Notify OSD
|
2
|
+
|
3
|
+
* Author: Stephen H. Gerstacker (http://shortround.net)
|
4
|
+
* Forked From: http://github.com/svoop/autotest-growl
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
This gem aims to improve support for Notify OSD notification by ZenTest's autotest.
|
9
|
+
It comes with a nice colored Ruby icon set and - for now - supports Cucumber
|
10
|
+
notifications by means of a workaround.
|
11
|
+
|
12
|
+
== REQUIREMENTS:
|
13
|
+
|
14
|
+
* Notify OSD
|
15
|
+
* ZenTest >= 4.1.3
|
16
|
+
|
17
|
+
== INSTALL:
|
18
|
+
|
19
|
+
First install the gem:
|
20
|
+
|
21
|
+
sudo gem install stack-autotest-growl --source=http://gems.github.com
|
22
|
+
|
23
|
+
Then add the following line to your ~/.autotest file:
|
24
|
+
|
25
|
+
require 'autotest/notify-osd'
|
26
|
+
|
27
|
+
Make sure Notify OSD is installed on your computer. You can download it from:
|
28
|
+
|
29
|
+
https://wiki.ubuntu.com/NotifyOSD
|
30
|
+
|
31
|
+
== CONFIGURATION:
|
32
|
+
|
33
|
+
=== Custom Icons
|
34
|
+
|
35
|
+
Using your own set of icons is pretty simple. Just create a directory
|
36
|
+
~/.autotest-notify-osd, copy your icons there and name them passed.png,
|
37
|
+
pending.png, failed.png, error.png and info.png.
|
38
|
+
|
39
|
+
=== Don't Clear the Terminal
|
40
|
+
|
41
|
+
Add the following to your ~/.autotest if you don't want the terminal to
|
42
|
+
be cleared before running a test:
|
43
|
+
|
44
|
+
Autotest::NotifyOSD::clear_terminal = false
|
45
|
+
|
46
|
+
=== Hide the Label
|
47
|
+
|
48
|
+
If you prefer the notifications not to show labels such as "LABEL:
|
49
|
+
All tests have passed", add the following to your ~/.autotest:
|
50
|
+
|
51
|
+
Autotest::NotifyOSD::hide_label = true
|
52
|
+
|
53
|
+
=== One Notifications per Run
|
54
|
+
|
55
|
+
Allow only one test and one feature notification per run by adding the
|
56
|
+
following to your ~/.autotest:
|
57
|
+
|
58
|
+
Autotest::NotifyOSD::one_notification_per_run = true
|
59
|
+
|
60
|
+
=== Show Modified Files
|
61
|
+
|
62
|
+
Add the following to your ~/.autotest if you would like to receive a NotifyOSD
|
63
|
+
notification listing the files modified before tests are re-run.
|
64
|
+
|
65
|
+
Autotest::NotifyOSD::show_modified_files = true
|
66
|
+
|
67
|
+
== LICENSE:
|
68
|
+
|
69
|
+
(The MIT License)
|
70
|
+
|
71
|
+
Copyright (c) 2009 Sven Schwyn
|
72
|
+
|
73
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
74
|
+
a copy of this software and associated documentation files (the
|
75
|
+
'Software'), to deal in the Software without restriction, including
|
76
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
77
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
78
|
+
permit persons to whom the Software is furnished to do so, subject to
|
79
|
+
the following conditions:
|
80
|
+
|
81
|
+
The above copyright notice and this permission notice shall be
|
82
|
+
included in all copies or substantial portions of the Software.
|
83
|
+
|
84
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
85
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
86
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
87
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
88
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
89
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
90
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/autotest-notify-osd'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
$hoe = Hoe.spec 'autotest-notify-osd' do
|
12
|
+
self.developer 'Sven Schwyn', 'ruby@bitcetera.com'
|
13
|
+
self.summary = %q{Notify OSD notification support for ZenTest's autotest.}
|
14
|
+
self.description = %q{This gem aims to improve support for Notify OSD 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://shortround,net}
|
16
|
+
self.post_install_message = "\n\e[1;32m" + File.read('PostInstall.txt') + "\e[0m\n"
|
17
|
+
self.rubyforge_name = self.name
|
18
|
+
self.extra_deps = [
|
19
|
+
['ZenTest','>= 4.1.3'],
|
20
|
+
]
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'newgem/tasks'
|
24
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
25
|
+
|
26
|
+
task :default => [:spec]
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{autotest-notify-osd}
|
5
|
+
s.version = "0.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Stephen H. Gerstacker"]
|
9
|
+
s.date = %q{2009-08-26}
|
10
|
+
s.description = %q{This gem aims to improve support for Notify OSD 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 = ["stephen@shortround.net"]
|
12
|
+
s.extra_rdoc_files = ["PostInstall.txt"]
|
13
|
+
s.files = ["Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "autotest-notify-osd.gemspec", "img/error.png", "img/failed.png", "img/info.png", "img/passed.png", "img/pending.png", "lib/autotest-notify-osd.rb", "lib/autotest/notify-osd.rb", "lib/autotest/result.rb", "script/console", "script/destroy", "script/generate", "spec/autotest-notify-osd_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
|
14
|
+
s.homepage = %q{http://shortround.net}
|
15
|
+
s.post_install_message = %q{
|
16
|
+
[1;32mIn order to use autotest-notify-osd, the following line has to be added to your
|
17
|
+
~/.autotest file:
|
18
|
+
|
19
|
+
require 'autotest/notify-osd'
|
20
|
+
|
21
|
+
Make sure Notify OSD is installed on your computer. Download it from:
|
22
|
+
|
23
|
+
https://wiki.ubuntu.com/NotifyOSD
|
24
|
+
|
25
|
+
[0m
|
26
|
+
}
|
27
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
s.rubyforge_project = %q{autotest-notify-osd}
|
30
|
+
s.rubygems_version = %q{1.3.5}
|
31
|
+
s.summary = %q{Notify OSD notification support for ZenTest's autotest.}
|
32
|
+
|
33
|
+
if s.respond_to? :specification_version then
|
34
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
35
|
+
s.specification_version = 3
|
36
|
+
|
37
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
38
|
+
s.add_runtime_dependency(%q<ZenTest>, [">= 4.1.3"])
|
39
|
+
s.add_development_dependency(%q<hoe>, [">= 2.3.3"])
|
40
|
+
else
|
41
|
+
s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
|
42
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
43
|
+
end
|
44
|
+
else
|
45
|
+
s.add_dependency(%q<ZenTest>, [">= 4.1.3"])
|
46
|
+
s.add_dependency(%q<hoe>, [">= 2.3.3"])
|
47
|
+
end
|
48
|
+
end
|
data/img/error.png
ADDED
Binary file
|
data/img/failed.png
ADDED
Binary file
|
data/img/info.png
ADDED
Binary file
|
data/img/passed.png
ADDED
Binary file
|
data/img/pending.png
ADDED
Binary file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require File.join(File.dirname(__FILE__), 'autotest', 'notify-osd')
|
5
|
+
|
6
|
+
module AutotestNotifyOSD
|
7
|
+
|
8
|
+
VERSION = '0.0.1'
|
9
|
+
|
10
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'autotest'
|
3
|
+
require File.join(File.dirname(__FILE__), 'result')
|
4
|
+
|
5
|
+
##
|
6
|
+
# Autotest::NotifyOSD
|
7
|
+
#
|
8
|
+
# == FEATUERS:
|
9
|
+
# * Display autotest results as NotifyOSD notifications.
|
10
|
+
# * Clean the terminal on every test cycle while maintaining scrollback.
|
11
|
+
#
|
12
|
+
# == SYNOPSIS:
|
13
|
+
# ~/.autotest
|
14
|
+
# require 'autotest/notify-osd'
|
15
|
+
module Autotest::NotifyOSD
|
16
|
+
|
17
|
+
GEM_PATH = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
18
|
+
|
19
|
+
@label = ''
|
20
|
+
@modified_files = []
|
21
|
+
@ran_tests = false
|
22
|
+
@ran_features = false
|
23
|
+
|
24
|
+
@@remote_notification = false
|
25
|
+
@@one_notification_per_run = false
|
26
|
+
@@clear_terminal = true
|
27
|
+
@@hide_label = false
|
28
|
+
@@show_modified_files = false
|
29
|
+
|
30
|
+
##
|
31
|
+
# Whether to use remote or local notificaton (default).
|
32
|
+
def self.remote_notification=(boolean)
|
33
|
+
@@remote_notification = boolean
|
34
|
+
end
|
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
|
+
|
42
|
+
##
|
43
|
+
# Whether to clear the terminal before running tests (default) or not.
|
44
|
+
def self.clear_terminal=(boolean)
|
45
|
+
@@clear_terminal = boolean
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Whether to display the label (default) or not.
|
50
|
+
def self.hide_label=(boolean)
|
51
|
+
@@hide_label = boolean
|
52
|
+
end
|
53
|
+
|
54
|
+
##
|
55
|
+
# Whether to display the modified files or not (default).
|
56
|
+
def self.show_modified_files=(boolean)
|
57
|
+
@@show_modified_files = boolean
|
58
|
+
end
|
59
|
+
|
60
|
+
##
|
61
|
+
# Display a message through Growl.
|
62
|
+
def self.notify_osd(title, message, icon, priority=0, stick="")
|
63
|
+
image = File.join(ENV['HOME'], '.autotest-notify-osd', "#{icon}.png")
|
64
|
+
image = File.join(GEM_PATH, 'img', "#{icon}.png") unless File.exists?(image)
|
65
|
+
|
66
|
+
# Translate the priority
|
67
|
+
case priority
|
68
|
+
when 1
|
69
|
+
pri = 'normal'
|
70
|
+
when 2
|
71
|
+
pri = 'critical'
|
72
|
+
else
|
73
|
+
pri = 'low'
|
74
|
+
end
|
75
|
+
|
76
|
+
system %(notify-send -i '#{image}' -u #{pri} '#{title}' '#{message}')
|
77
|
+
end
|
78
|
+
|
79
|
+
##
|
80
|
+
# Display the modified files.
|
81
|
+
Autotest.add_hook :updated do |autotest, modified|
|
82
|
+
@ran_tests = @ran_features = false
|
83
|
+
if @@show_modified_files
|
84
|
+
if modified != @last_modified
|
85
|
+
notify_osd @label + 'Modifications detected.', modified.collect {|m| m[0]}.join(', '), 'info', 0
|
86
|
+
@last_modified = modified
|
87
|
+
end
|
88
|
+
end
|
89
|
+
false
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Set the label and clear the terminal.
|
94
|
+
Autotest.add_hook :run_command do
|
95
|
+
@label = File.basename(Dir.pwd).upcase + ': ' if !@@hide_label
|
96
|
+
print "\n"*2 + '-'*80 + "\n"*2
|
97
|
+
print "\e[2J\e[f" if @@clear_terminal
|
98
|
+
false
|
99
|
+
end
|
100
|
+
|
101
|
+
##
|
102
|
+
# Parse the RSpec and Test::Unit results and send them to Growl.
|
103
|
+
Autotest.add_hook :ran_command do |autotest|
|
104
|
+
unless @@one_notification_per_run && @ran_tests
|
105
|
+
result = Result.new(autotest)
|
106
|
+
if result.exists?
|
107
|
+
case result.framework
|
108
|
+
when 'test-unit'
|
109
|
+
if result.has?('test-error')
|
110
|
+
notify_osd @label + 'Cannot run some unit tests.', "#{result.get('test-error')} in #{result.get('test')}", 'error', 2
|
111
|
+
elsif result.has?('test-failed')
|
112
|
+
notify_osd @label + 'Some unit tests failed.', "#{result['test-failed']} of #{result.get('test-assertion')} in #{result.get('test')} failed", 'failed', 2
|
113
|
+
else
|
114
|
+
notify_osd @label + 'All unit tests passed.', "#{result.get('test-assertion')} in #{result.get('test')}", 'passed', -2
|
115
|
+
end
|
116
|
+
when 'rspec'
|
117
|
+
if result.has?('example-failed')
|
118
|
+
notify_osd @label + 'Some RSpec examples failed.', "#{result['example-failed']} of #{result.get('example')} failed", 'failed', 2
|
119
|
+
elsif result.has?('example-pending')
|
120
|
+
notify_osd @label + 'Some RSpec examples are pending.', "#{result['example-pending']} of #{result.get('example')} pending", 'pending', -1
|
121
|
+
else
|
122
|
+
notify_osd @label + 'All RSpec examples passed.', "#{result.get('example')}", 'passed', -2
|
123
|
+
end
|
124
|
+
end
|
125
|
+
else
|
126
|
+
notify_osd @label + 'Could not run tests.', '', 'error', 2
|
127
|
+
end
|
128
|
+
@ran_test = true
|
129
|
+
end
|
130
|
+
false
|
131
|
+
end
|
132
|
+
|
133
|
+
##
|
134
|
+
# Parse the Cucumber results and sent them to Growl.
|
135
|
+
Autotest.add_hook :ran_features do |autotest|
|
136
|
+
unless @@one_notification_per_run && @ran_features
|
137
|
+
result = Result.new(autotest)
|
138
|
+
if result.exists?
|
139
|
+
case result.framework
|
140
|
+
when 'cucumber'
|
141
|
+
explanation = []
|
142
|
+
if result.has?('scenario-undefined') || result.has?('step-undefined')
|
143
|
+
explanation << "#{result['scenario-undefined']} of #{result.get('scenario')} not defined" if result['scenario-undefined']
|
144
|
+
explanation << "#{result['step-undefined']} of #{result.get('step')} not defined" if result['step-undefined']
|
145
|
+
notify_osd @label + 'Some Cucumber scenarios are not defined.', "#{explanation.join("\n")}", 'pending', -1
|
146
|
+
elsif result.has?('scenario-failed') || result.has?('step-failed')
|
147
|
+
explanation << "#{result['scenario-failed']} of #{result.get('scenario')} failed" if result['scenario-failed']
|
148
|
+
explanation << "#{result['step-failed']} of #{result.get('step')} failed" if result['step-failed']
|
149
|
+
notify_osd @label + 'Some Cucumber scenarios failed.', "#{explanation.join("\n")}", 'failed', 2
|
150
|
+
elsif result.has?('scenario-pending') || result.has?('step-pending')
|
151
|
+
explanation << "#{result['scenario-pending']} of #{result.get('scenario')} pending" if result['scenario-pending']
|
152
|
+
explanation << "#{result['step-pending']} of #{result.get('step')} pending" if result['step-pending']
|
153
|
+
notify_osd @label + 'Some Cucumber scenarios are pending.', "#{explanation.join("\n")}", 'pending', -1
|
154
|
+
else
|
155
|
+
notify_osd @label + 'All Cucumber features passed.', '', 'passed', -2
|
156
|
+
end
|
157
|
+
end
|
158
|
+
else
|
159
|
+
notify_osd @label + 'Could not run features.', '', 'error', 2
|
160
|
+
end
|
161
|
+
@ran_features = true
|
162
|
+
end
|
163
|
+
false
|
164
|
+
end
|
165
|
+
|
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'] then 'test-unit'
|
29
|
+
when @numbers['example'] then 'rspec'
|
30
|
+
when @numbers['scenario'] then '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
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/notify-osd.rb'}"
|
9
|
+
puts "Loading autotest-notify-osd 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,80 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe "handling results" do
|
4
|
+
before do
|
5
|
+
@autotest = Autotest.new
|
6
|
+
@autotest.hook(:updated)
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "for RSpec" do
|
10
|
+
it "should show a 'passed' notification" do
|
11
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('passed')
|
12
|
+
@autotest.results = ["10 examples, 0 failures"]
|
13
|
+
@autotest.hook(:ran_command)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should show a 'failed' notification" do
|
17
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('failed')
|
18
|
+
@autotest.results = ["10 examples, 1 failures"]
|
19
|
+
@autotest.hook(:ran_command)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should show a 'pending' notification" do
|
23
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('pending')
|
24
|
+
@autotest.results = ["10 examples, 0 failures, 1 pending"]
|
25
|
+
@autotest.hook(:ran_command)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should show an 'error' notification" do
|
29
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('error')
|
30
|
+
@autotest.results = []
|
31
|
+
@autotest.hook(:ran_command)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "for Test::Unit" do
|
36
|
+
it "should show a 'passed' notification" do
|
37
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('passed')
|
38
|
+
@autotest.results = ["1 tests, 1 assertions, 0 failures, 0 errors"]
|
39
|
+
@autotest.hook(:ran_command)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should show a 'failed' notification" do
|
43
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('failed')
|
44
|
+
@autotest.results = ["1 tests, 1 assertions, 1 failures, 0 errors"]
|
45
|
+
@autotest.hook(:ran_command)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should show an 'error' notification" do
|
49
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).and_return('error')
|
50
|
+
@autotest.results = ["1 tests, 1 assertions, 0 failures, 1 errors"]
|
51
|
+
@autotest.hook(:ran_command)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "for Cucumber" do
|
56
|
+
it "should show a 'passed' notification" do
|
57
|
+
Autotest::NotifyOSD.should_receive(:notify_osd).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::NotifyOSD.should_receive(:notify_osd).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::NotifyOSD.should_receive(:notify_osd).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::NotifyOSD.should_receive(:notify_osd).and_return('error')
|
76
|
+
@autotest.results = []
|
77
|
+
@autotest.hook(:ran_features)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
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/notify-osd'
|
11
|
+
|
12
|
+
module Autotest::Growl
|
13
|
+
def self.notify_osd(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,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stack-autotest-notify-osd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen H. Gerstacker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-26 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.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.3.3
|
34
|
+
version:
|
35
|
+
description: This gem aims to improve support for Notify OSD notification by ZenTest's autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber by means of a workaround.
|
36
|
+
email:
|
37
|
+
- stephen@shortround.net
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- PostInstall.txt
|
44
|
+
files:
|
45
|
+
- Manifest.txt
|
46
|
+
- PostInstall.txt
|
47
|
+
- README.rdoc
|
48
|
+
- Rakefile
|
49
|
+
- autotest-notify-osd.gemspec
|
50
|
+
- img/error.png
|
51
|
+
- img/failed.png
|
52
|
+
- img/info.png
|
53
|
+
- img/passed.png
|
54
|
+
- img/pending.png
|
55
|
+
- lib/autotest-notify-osd.rb
|
56
|
+
- lib/autotest/notify-osd.rb
|
57
|
+
- lib/autotest/result.rb
|
58
|
+
- script/console
|
59
|
+
- script/destroy
|
60
|
+
- script/generate
|
61
|
+
- spec/autotest-notify-osd_spec.rb
|
62
|
+
- spec/spec.opts
|
63
|
+
- spec/spec_helper.rb
|
64
|
+
- tasks/rspec.rake
|
65
|
+
has_rdoc: false
|
66
|
+
homepage: http://shortround.net
|
67
|
+
post_install_message: "\n\
|
68
|
+
\e[1;32mIn order to use autotest-notify-osd, the following line has to be added to your\n\
|
69
|
+
~/.autotest file:\n\n\
|
70
|
+
require 'autotest/notify-osd'\n\n\
|
71
|
+
Make sure Notify OSD is installed on your computer. Download it from:\n\n\
|
72
|
+
https://wiki.ubuntu.com/NotifyOSD\n\n\
|
73
|
+
\e[0m\n"
|
74
|
+
rdoc_options:
|
75
|
+
- --main
|
76
|
+
- README.rdoc
|
77
|
+
require_paths:
|
78
|
+
- lib
|
79
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: "0"
|
84
|
+
version:
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: "0"
|
90
|
+
version:
|
91
|
+
requirements: []
|
92
|
+
|
93
|
+
rubyforge_project: autotest-notify-osd
|
94
|
+
rubygems_version: 1.2.0
|
95
|
+
signing_key:
|
96
|
+
specification_version: 3
|
97
|
+
summary: Notify OSD notification support for ZenTest's autotest.
|
98
|
+
test_files: []
|
99
|
+
|