cucumber-notify 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/.gitignore +6 -0
- data/Gemfile +4 -0
- data/LICENSE.rdoc +23 -0
- data/README.md +68 -0
- data/README.rdoc +40 -0
- data/Rakefile +8 -0
- data/cucumber-notify.gemspec +33 -0
- data/images/fail.png +0 -0
- data/images/pass.png +0 -0
- data/images/pending.png +0 -0
- data/images/undefined.png +0 -0
- data/lib/cucumber-notify.rb +2 -0
- data/lib/cucumber-notify/cucumber-notify.rb +94 -0
- data/lib/cucumber-notify/version.rb +4 -0
- metadata +91 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
== The MIT License
|
2
|
+
|
3
|
+
* Code: Copyright (c) Matt Buck, 2008 - 2012
|
4
|
+
* Gem: Copyright (c) Pavel Argentov, 2012
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
'Software'), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
20
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
21
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
22
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
23
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Cucumber notifier for autotest
|
2
|
+
|
3
|
+
This gem's homepage is currently at
|
4
|
+
<https://github.com/argent-smith/autotest-cucumber-notification/tree/gem>
|
5
|
+
|
6
|
+
The original code and documentation used in this gem can be found at <https://github.com/techpeace/autotest-cucumber-notification>
|
7
|
+
|
8
|
+
This is a module for autotest that will provide notification for the results of your Cucumber features.
|
9
|
+
|
10
|
+
## Requirements
|
11
|
+
|
12
|
+
1. Autotest (ZenTest) configured to run your Cucumber features
|
13
|
+
2. libnotify -- This module only works on linux with the libnotify package right now. I'll work on adding support for other notification frameworks in the future
|
14
|
+
|
15
|
+
## Using the gem
|
16
|
+
|
17
|
+
1. Install the gem:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
$ gem install cucumber-notify
|
21
|
+
```
|
22
|
+
2. Edit your `.autotest` to include the module. If you downloaded it to your home folder, do something like this:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
require 'rubygems'
|
26
|
+
require 'cucumber-notify'
|
27
|
+
```
|
28
|
+
|
29
|
+
3. That's it. Just run Autotest with your Cucumber features like normal.
|
30
|
+
|
31
|
+
## Credits
|
32
|
+
|
33
|
+
The original code this gem is based upon is compiled by [Matt Buck](https://github.com/techpeace).
|
34
|
+
|
35
|
+
This is largely based on the work done by [carlosbrando](https://github.com/carlosbrando), and his work on
|
36
|
+
[the autotest-notification gem](https://github.com/carlosbrando/autotest-notification/tree/master),
|
37
|
+
many thanks to him.
|
38
|
+
|
39
|
+
The cool icons came from the [Buuf icon set](http://mattahan.deviantart.com/art/Buuf-37966044)
|
40
|
+
by [Paul Davey](http://mattahan.deviantart.com/).
|
41
|
+
|
42
|
+
## License
|
43
|
+
|
44
|
+
```
|
45
|
+
The MIT License
|
46
|
+
|
47
|
+
* Code: Copyright (c) Matt Buck, 2008 - 2012
|
48
|
+
* Gem: Copyright (c) Pavel Argentov, 2012
|
49
|
+
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
51
|
+
a copy of this software and associated documentation files (the
|
52
|
+
'Software'), to deal in the Software without restriction, including
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
56
|
+
the following conditions:
|
57
|
+
|
58
|
+
The above copyright notice and this permission notice shall be
|
59
|
+
included in all copies or substantial portions of the Software.
|
60
|
+
|
61
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
64
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
65
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
66
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
67
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
68
|
+
```
|
data/README.rdoc
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
= Cucumber notifier for autotest
|
2
|
+
|
3
|
+
This gem's homepage is currently at
|
4
|
+
https://github.com/argent-smith/autotest-cucumber-notification/tree/gem
|
5
|
+
|
6
|
+
The original code and documentation used in this gem can be found at https://github.com/techpeace/autotest-cucumber-notification
|
7
|
+
|
8
|
+
This is a module for autotest that will provide notification for the results of your Cucumber features.
|
9
|
+
|
10
|
+
== Requirements
|
11
|
+
|
12
|
+
1. Autotest (ZenTest) configured to run your Cucumber features
|
13
|
+
2. libnotify -- This module only works on linux with the libnotify package right now. I'll work on adding support for other notification frameworks in the future
|
14
|
+
|
15
|
+
== Using the gem
|
16
|
+
|
17
|
+
1. Install the gem:
|
18
|
+
|
19
|
+
$ gem install cucumber-notify
|
20
|
+
|
21
|
+
2. Edit your .autotest to include the module. If you downloaded it to your home folder, do something like this:
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'cucumber-notify'
|
25
|
+
|
26
|
+
3. That's it. Just run Autotest with your Cucumber features like normal.
|
27
|
+
|
28
|
+
== Credits
|
29
|
+
|
30
|
+
The original code this gem is based upon is compiled by Matt Buck,
|
31
|
+
https://github.com/techpeace
|
32
|
+
|
33
|
+
This is largely based on the work done by
|
34
|
+
carlosbrando, https://github.com/carlosbrando, and his work on
|
35
|
+
the autotest-notification gem,
|
36
|
+
https://github.com/carlosbrando/autotest-notification/tree/master,
|
37
|
+
many thanks to him.
|
38
|
+
|
39
|
+
The cool icons came from the Buuf icon set, http://mattahan.deviantart.com/art/Buuf-37966044
|
40
|
+
by Paul Davey http://mattahan.deviantart.com/ .
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "cucumber-notify/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "cucumber-notify"
|
7
|
+
s.version = CucumberNotify::VERSION
|
8
|
+
s.authors = ["Pavel Argentov", "Matt Buck"]
|
9
|
+
s.email = ["argentoff@gmail.com", "github@matthewbuck.com"]
|
10
|
+
s.homepage = "https://github.com/argent-smith/autotest-cucumber-notification/tree/gem"
|
11
|
+
s.summary = %q{Gem port of Matt Buck's autotest-cucumber-notification module.}
|
12
|
+
s.description = %q{This is a module for autotest that will provide notification for the results of your Cucumber features.}
|
13
|
+
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"LICENSE.rdoc",
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
|
19
|
+
s.rdoc_options = [
|
20
|
+
'--title', 'Cucumber notifier for autotest',
|
21
|
+
'--main', 'README.rdoc'
|
22
|
+
]
|
23
|
+
|
24
|
+
s.files = `git ls-files`.split("\n")
|
25
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
|
+
s.require_paths = ["lib"]
|
28
|
+
|
29
|
+
# specify any dependencies here; for example:
|
30
|
+
# s.add_development_dependency "rspec"
|
31
|
+
s.add_runtime_dependency "cucumber"
|
32
|
+
s.add_runtime_dependency "ZenTest"
|
33
|
+
end
|
data/images/fail.png
ADDED
Binary file
|
data/images/pass.png
ADDED
Binary file
|
data/images/pending.png
ADDED
Binary file
|
Binary file
|
@@ -0,0 +1,94 @@
|
|
1
|
+
# Usage:: see README
|
2
|
+
module CucumberNotify
|
3
|
+
|
4
|
+
# Notifier configuration helpers and defaults.
|
5
|
+
class Config
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_reader :images_directory
|
9
|
+
attr_accessor :success_image, :fail_image, :pending_image, :undefined_image, :expiration_in_seconds,
|
10
|
+
:failure, :success, :pending, :undefined, :fade_timeout
|
11
|
+
|
12
|
+
def images_directory=(path)
|
13
|
+
@images_directory = File.expand_path(path)
|
14
|
+
@success_image = "#{@images_directory}/pass.png"
|
15
|
+
@fail_image = "#{@images_directory}/fail.png"
|
16
|
+
@pending_image = "#{@images_directory}/pending.png"
|
17
|
+
@undefined_image = "#{@images_directory}/undefined.png"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
self.images_directory = File.expand_path('../../images', File.dirname(__FILE__))
|
22
|
+
self.fade_timeout = 5000
|
23
|
+
self.failure = "Features Failure"
|
24
|
+
self.success = "Features Success"
|
25
|
+
self.pending = "Features Pending"
|
26
|
+
self.undefined = "Features Undefined"
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
Autotest.add_hook :ran_features do |at|
|
31
|
+
result = at.results.is_a?(String) ? at.results : at.results.to_s
|
32
|
+
|
33
|
+
if result
|
34
|
+
@scenarios = result[/(\d+) scenarios?/,1].to_i
|
35
|
+
@steps = result[/(\d+) steps?/,1].to_i
|
36
|
+
@scenario_stats = Hash.new
|
37
|
+
@step_stats = Hash.new
|
38
|
+
|
39
|
+
%w{ failed skipped passed pending undefined }.each do |x|
|
40
|
+
@scenario_stats.merge!({ "#{x}" => result[/\d+ scenarios?.*?(\d+) #{x}.*\)/,1].to_i })
|
41
|
+
@step_stats.merge!({ "#{x}" => result[/\d+ steps?.*?(\d+) #{x}.*\)/,1].to_i })
|
42
|
+
end
|
43
|
+
|
44
|
+
if @scenario_stats["failed"] > 0 || @step_stats["failed"] > 0
|
45
|
+
notify Config.failure, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.fail_image
|
46
|
+
elsif @scenario_stats["pending"] > 0 || @step_stats["pending"] > 0
|
47
|
+
notify Config.pending, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.pending_image
|
48
|
+
elsif @scenario_stats["undefined"] > 0 || @step_stats["undefined"] > 0
|
49
|
+
notify Config.undefined, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.undefined_image
|
50
|
+
elsif @scenario_stats["passed"] > 0 && @step_stats["passed"] > 0
|
51
|
+
notify Config.success, assemble_msg(@scenarios,@steps,@scenario_stats,@step_stats), Config.success_image
|
52
|
+
else
|
53
|
+
notify Config.failure, "Errors Ecountered", Config.fail_image
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
class << self
|
59
|
+
|
60
|
+
def notify(title, msg, img = Config.success_image)
|
61
|
+
system "notify-send -i #{img} '#{title}' '#{msg}' -t #{Config.fade_timeout}"
|
62
|
+
end
|
63
|
+
|
64
|
+
def pluralize(text, number)
|
65
|
+
"#{number} #{text}#{'s' if number != 1}"
|
66
|
+
end
|
67
|
+
|
68
|
+
def assemble_msg(scenarios, steps, scenario_stats = {}, step_stats = {})
|
69
|
+
msg = ""
|
70
|
+
if scenarios > 0
|
71
|
+
msg += "#{pluralize('scenario',scenarios)}"
|
72
|
+
msg += "\n#{stat_string(scenario_stats)}"
|
73
|
+
msg += "\n\n" if steps > 0
|
74
|
+
end
|
75
|
+
if steps > 0
|
76
|
+
msg += "#{pluralize('step',steps)}"
|
77
|
+
msg += "\n#{stat_string(step_stats)}"
|
78
|
+
end
|
79
|
+
return msg
|
80
|
+
end
|
81
|
+
|
82
|
+
def stat_string(hash)
|
83
|
+
stat_str = "("
|
84
|
+
hash.each do |key,value|
|
85
|
+
if value > 0
|
86
|
+
stat_str += "#{value} #{key},"
|
87
|
+
end
|
88
|
+
end
|
89
|
+
stat_str += ")"
|
90
|
+
stat_str.gsub!(",\)",")")
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cucumber-notify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Pavel Argentov
|
9
|
+
- Matt Buck
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2012-01-20 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: cucumber
|
17
|
+
requirement: &342121610 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *342121610
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: ZenTest
|
28
|
+
requirement: &342121000 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *342121000
|
37
|
+
description: This is a module for autotest that will provide notification for the
|
38
|
+
results of your Cucumber features.
|
39
|
+
email:
|
40
|
+
- argentoff@gmail.com
|
41
|
+
- github@matthewbuck.com
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files:
|
45
|
+
- LICENSE.rdoc
|
46
|
+
- README.rdoc
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.rdoc
|
51
|
+
- README.md
|
52
|
+
- README.rdoc
|
53
|
+
- Rakefile
|
54
|
+
- cucumber-notify.gemspec
|
55
|
+
- images/fail.png
|
56
|
+
- images/pass.png
|
57
|
+
- images/pending.png
|
58
|
+
- images/undefined.png
|
59
|
+
- lib/cucumber-notify.rb
|
60
|
+
- lib/cucumber-notify/cucumber-notify.rb
|
61
|
+
- lib/cucumber-notify/version.rb
|
62
|
+
homepage: https://github.com/argent-smith/autotest-cucumber-notification/tree/gem
|
63
|
+
licenses: []
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options:
|
66
|
+
- --title
|
67
|
+
- Cucumber notifier for autotest
|
68
|
+
- --main
|
69
|
+
- README.rdoc
|
70
|
+
require_paths:
|
71
|
+
- lib
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 1.8.15
|
87
|
+
signing_key:
|
88
|
+
specification_version: 3
|
89
|
+
summary: Gem port of Matt Buck's autotest-cucumber-notification module.
|
90
|
+
test_files: []
|
91
|
+
has_rdoc:
|