guard-ecukes 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +151 -0
- data/lib/guard/ecukes.rb +84 -0
- data/lib/guard/ecukes/inspector.rb +75 -0
- data/lib/guard/ecukes/runner.rb +46 -0
- data/lib/guard/ecukes/templates/Guardfile +5 -0
- data/lib/guard/ecukes/version.rb +6 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7bc03ba288039da3677e10cbf783be5ab18021f
|
4
|
+
data.tar.gz: a79a1878d260b9715e365da00aef773b309b4db1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0310a40a5745bfa39e7fa4b375418785f16897cc9ef0a9a3702bee81743e3af80c34b9d9c447c1adda15d61e5ec5a763281b38b0f18af713a978b649529384a8
|
7
|
+
data.tar.gz: 54a1ac552640419a4561ec124e295df3a83ada746d649f49a5b21f8857849b6f706560ca32a57c3a7b25a63326210d5259dbe25fd428b5d70faba0aad006191d
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010-2013 Michael Kessler
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
# Guard::Ecukes [![Build Status](https://secure.travis-ci.org/dillonkearns/guard-ecukes.png)](http://travis-ci.org/dillonkearns/guard-ecukes)
|
2
|
+
|
3
|
+
Guard::Ecukes allows you to automatically run [Ecukes](http://ecukes.info/) features when files are modified.
|
4
|
+
|
5
|
+
Tested on MRI Ruby 1.8.7, 1.9.2, 1.9.3, REE and the latest versions of JRuby & Rubinius.
|
6
|
+
|
7
|
+
If you have any questions please join us on our [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
|
8
|
+
|
9
|
+
## Install
|
10
|
+
|
11
|
+
The simplest way to install Guard is to use [Bundler](http://gembundler.com/).
|
12
|
+
Please make sure to have [Guard](https://github.com/guard/guard) installed before continue.
|
13
|
+
|
14
|
+
Add Guard::Ecukes to your `Gemfile`:
|
15
|
+
|
16
|
+
```bash
|
17
|
+
group :development do
|
18
|
+
gem 'guard-ecukes
|
19
|
+
end
|
20
|
+
```
|
21
|
+
|
22
|
+
Add the default Guard::Ecukes template to your `Guardfile` by running:
|
23
|
+
|
24
|
+
```bash
|
25
|
+
$ guard init ecukes
|
26
|
+
```
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
Please read the [Guard usage documentation](https://github.com/guard/guard#readme).
|
31
|
+
|
32
|
+
## Guardfile
|
33
|
+
|
34
|
+
Guard::Ecukes can be adapted to all kind of projects and comes with a default template that looks like this:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
guard 'ecukes' do
|
38
|
+
watch(%r{^features/.+\.feature$})
|
39
|
+
watch(%r{^([^\/]*\.el|features/support/.+\.el)$}) { 'features' }
|
40
|
+
watch(%r{^features/step_definitions/(.+)_steps\.el$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
Expressed in plain English, this configuration tells Guard::Ecukes:
|
45
|
+
|
46
|
+
1. When a file within the features directory that ends in feature is modified, just run that single feature.
|
47
|
+
2. When any file within features/support directory is modified, run all features.
|
48
|
+
3. When a file within the features/step_definitions directory that ends in \_steps.rb is modified,
|
49
|
+
run the first feature that matches the name (\_steps.rb replaced by .feature) and when no feature is found,
|
50
|
+
then run all features.
|
51
|
+
|
52
|
+
Please read the [Guard documentation](http://github.com/guard/guard#readme) for more information about the Guardfile DSL.
|
53
|
+
|
54
|
+
## Options
|
55
|
+
|
56
|
+
You can pass any of the standard Ecukes CLI options using the :cli option:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
guard 'ecukes', :cli => '--reporter magnars --timeout 10'
|
60
|
+
```
|
61
|
+
|
62
|
+
### List of available options
|
63
|
+
|
64
|
+
```ruby
|
65
|
+
:cli => '--reporter magnars --timeout 10' # Pass arbitrary Ecukes CLI arguments,
|
66
|
+
# default: none
|
67
|
+
|
68
|
+
:all_after_pass => false # Don't run all features after changed features pass
|
69
|
+
# default: true
|
70
|
+
|
71
|
+
:all_on_start => false # Don't run all the features at startup
|
72
|
+
# default: true
|
73
|
+
|
74
|
+
:run_all => { :cli => "-r progress" } # Override any option when running all specs
|
75
|
+
# default: {}
|
76
|
+
|
77
|
+
:command_prefix => 'xvfb-run' # Add a prefix to the ecukes command such as 'xvfb-run' or any
|
78
|
+
# other shell script.
|
79
|
+
# The example generates: 'xvfb-run bundle exec ecukes ...'
|
80
|
+
# default: nil
|
81
|
+
```
|
82
|
+
|
83
|
+
Issues
|
84
|
+
------
|
85
|
+
|
86
|
+
You can report issues and feature requests to [GitHub Issues](https://github.com/dillonkearns/guard-ecukes/issues). Try to figure out
|
87
|
+
where the issue belongs to: Is it an issue with Guard itself or with Guard::Ecukes? Please don't
|
88
|
+
ask question in the issue tracker, instead join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
89
|
+
`#guard` (irc.freenode.net).
|
90
|
+
|
91
|
+
When you file an issue, please try to follow to these simple rules if applicable:
|
92
|
+
|
93
|
+
* Make sure you run Guard with `bundle exec` first.
|
94
|
+
* Add debug information to the issue by running Guard with the `--debug` option.
|
95
|
+
* Add your `Guardfile` and `Gemfile` to the issue.
|
96
|
+
* Make sure that the issue is reproducible with your description.
|
97
|
+
|
98
|
+
## Development
|
99
|
+
|
100
|
+
- Source hosted at [GitHub](https://github.com/dillonkearns/guard-ecukes).
|
101
|
+
|
102
|
+
Pull requests are very welcome! Please try to follow these simple rules if applicable:
|
103
|
+
|
104
|
+
* Please create a topic branch for every separate change you make.
|
105
|
+
* Make sure your patches are well tested.
|
106
|
+
* Update the README.
|
107
|
+
* Please **do not change** the version number.
|
108
|
+
|
109
|
+
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
110
|
+
`#guard` (irc.freenode.net).
|
111
|
+
|
112
|
+
## Author
|
113
|
+
|
114
|
+
Forked from [@netzpirat](https://twitter.com/#!/netzpirat)'s [guard-cucumber](https://github.com/netzpirat/guard-cucumber), developed by Michael Kessler, sponsored by [mksoft.ch](https://mksoft.ch).
|
115
|
+
|
116
|
+
## Contributors
|
117
|
+
|
118
|
+
See the GitHub list of [contributors](https://github.com/dillonkearns/guard-ecukes/contributors).
|
119
|
+
|
120
|
+
## Acknowledgment
|
121
|
+
|
122
|
+
The [Guard Team](https://github.com/guard/guard/contributors) for giving us such a nice pice of software
|
123
|
+
that is so easy to extend, one *has* to make a plugin for it!
|
124
|
+
|
125
|
+
All the authors of the numerous [Guards](http://github.com/guard) available for making the Guard ecosystem
|
126
|
+
so much growing and comprehensive.
|
127
|
+
|
128
|
+
## License
|
129
|
+
|
130
|
+
(The MIT License)
|
131
|
+
|
132
|
+
Copyright (c) 2010-2013 Michael Kessler
|
133
|
+
|
134
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
135
|
+
a copy of this software and associated documentation files (the
|
136
|
+
'Software'), to deal in the Software without restriction, including
|
137
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
138
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
139
|
+
permit persons to whom the Software is furnished to do so, subject to
|
140
|
+
the following conditions:
|
141
|
+
|
142
|
+
The above copyright notice and this permission notice shall be
|
143
|
+
included in all copies or substantial portions of the Software.
|
144
|
+
|
145
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
146
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
147
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
148
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
149
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
150
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
151
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/guard/ecukes.rb
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'guard'
|
2
|
+
require 'guard/guard'
|
3
|
+
require 'guard/ecukes/version'
|
4
|
+
|
5
|
+
module Guard
|
6
|
+
|
7
|
+
# The Ecukes guard that gets notifications about the following
|
8
|
+
# Guard events: `start`, `stop`, `reload`, `run_all` and `run_on_change`.
|
9
|
+
#
|
10
|
+
class Ecukes < Guard
|
11
|
+
|
12
|
+
autoload :Runner, 'guard/ecukes/runner'
|
13
|
+
autoload :Inspector, 'guard/ecukes/inspector'
|
14
|
+
autoload :Focuser, 'guard/ecukes/focuser'
|
15
|
+
|
16
|
+
# Initialize Guard::Ecukes.
|
17
|
+
#
|
18
|
+
# @param [Array<Guard::Watcher>] watchers the watchers in the Guard block
|
19
|
+
# @param [Hash] options the options for the Guard
|
20
|
+
# @option options [String] :cli any arbitrary Ecukes CLI arguments
|
21
|
+
# @option options [Boolean] :all_after_pass run all features after changed features pass
|
22
|
+
# @option options [Boolean] :all_on_start run all the features at startup
|
23
|
+
# @option options [Boolean] :run_all run override any option when running all specs
|
24
|
+
#
|
25
|
+
def initialize(watchers = [], options = {})
|
26
|
+
super
|
27
|
+
|
28
|
+
@options = {
|
29
|
+
:all_after_pass => true,
|
30
|
+
:all_on_start => true,
|
31
|
+
}.update(options)
|
32
|
+
|
33
|
+
@last_failed = false
|
34
|
+
end
|
35
|
+
|
36
|
+
# Gets called once when Guard starts.
|
37
|
+
#
|
38
|
+
# @raise [:task_has_failed] when stop has failed
|
39
|
+
#
|
40
|
+
def start
|
41
|
+
run_all if @options[:all_on_start]
|
42
|
+
end
|
43
|
+
|
44
|
+
# Gets called when all specs should be run.
|
45
|
+
#
|
46
|
+
# @raise [:task_has_failed] when stop has failed
|
47
|
+
#
|
48
|
+
def run_all
|
49
|
+
passed = Runner.run(['features'], @options.merge(@options[:run_all] || {}).merge(:message => 'Running all features'))
|
50
|
+
|
51
|
+
@last_failed = !passed
|
52
|
+
|
53
|
+
throw :task_has_failed unless passed
|
54
|
+
end
|
55
|
+
|
56
|
+
# Gets called when the Guard should reload itself.
|
57
|
+
#
|
58
|
+
# @raise [:task_has_failed] when stop has failed
|
59
|
+
#
|
60
|
+
def reload
|
61
|
+
end
|
62
|
+
|
63
|
+
# Gets called when watched paths and files have changes.
|
64
|
+
#
|
65
|
+
# @param [Array<String>] paths the changed paths and files
|
66
|
+
# @raise [:task_has_failed] when stop has failed
|
67
|
+
#
|
68
|
+
def run_on_changes(paths)
|
69
|
+
paths = Inspector.clean(paths)
|
70
|
+
passed = Runner.run(paths, paths.include?('features') ? @options.merge({ :message => 'Running all features' }) : @options)
|
71
|
+
|
72
|
+
if passed
|
73
|
+
# run all the specs if the changed specs failed, like autotest
|
74
|
+
run_all if @last_failed && @options[:all_after_pass]
|
75
|
+
else
|
76
|
+
# track whether the changed feature failed for the next change
|
77
|
+
@last_failed = true
|
78
|
+
end
|
79
|
+
|
80
|
+
throw :task_has_failed unless passed
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Guard
|
2
|
+
class Ecukes
|
3
|
+
|
4
|
+
# The inspector verifies of the changed paths are valid
|
5
|
+
# for Guard::Ecukes.
|
6
|
+
#
|
7
|
+
module Inspector
|
8
|
+
class << self
|
9
|
+
|
10
|
+
# Clean the changed paths and return only valid
|
11
|
+
# Ecukes features.
|
12
|
+
#
|
13
|
+
# @param [Array<String>] paths the changed paths
|
14
|
+
# @return [Array<String>] the valid feature files
|
15
|
+
#
|
16
|
+
def clean(paths)
|
17
|
+
paths.uniq!
|
18
|
+
paths.compact!
|
19
|
+
paths = paths.select { |p| ecukes_file?(p) || ecukes_folder?(p) }
|
20
|
+
paths = paths.delete_if { |p| included_in_other_path?(p, paths) }
|
21
|
+
clear_ecukes_files_list
|
22
|
+
paths
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
# Tests if the file is the features folder.
|
28
|
+
#
|
29
|
+
# @param [String] path the file
|
30
|
+
# @return [Boolean] when the file is the feature folder
|
31
|
+
#
|
32
|
+
def ecukes_folder?(path)
|
33
|
+
path.match(/^\/?features/) && !path.match(/\..+$/)
|
34
|
+
end
|
35
|
+
|
36
|
+
# Tests if the file is valid.
|
37
|
+
#
|
38
|
+
# @param [String] path the file
|
39
|
+
# @return [Boolean] when the file valid
|
40
|
+
#
|
41
|
+
def ecukes_file?(path)
|
42
|
+
ecukes_files.include?(path.split(':').first)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Scans the project and keeps a list of all
|
46
|
+
# feature files in the `features` directory.
|
47
|
+
#
|
48
|
+
# @see #clear_jasmine_specs
|
49
|
+
# @return [Array<String>] the valid files
|
50
|
+
#
|
51
|
+
def ecukes_files
|
52
|
+
@ecukes_files ||= Dir.glob("features/**/*.feature")
|
53
|
+
end
|
54
|
+
|
55
|
+
# Clears the list of features in this project.
|
56
|
+
#
|
57
|
+
def clear_ecukes_files_list
|
58
|
+
@ecukes_files = nil
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks if the given path is already contained
|
62
|
+
# in the paths list.
|
63
|
+
#
|
64
|
+
# @param [Sting] path the path to test
|
65
|
+
# @param [Array<String>] paths the list of paths
|
66
|
+
#
|
67
|
+
def included_in_other_path?(path, paths)
|
68
|
+
paths = paths.select { |p| p != path }
|
69
|
+
massaged = path[0...(path.index(':') || path.size)]
|
70
|
+
paths.any? { |p| (path.include?(p) && (path.gsub(p, '')).include?('/')) || massaged.include?(p) }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Guard
|
2
|
+
class Ecukes
|
3
|
+
|
4
|
+
# The Ecukes runner handles the execution of the ecukes binary.
|
5
|
+
#
|
6
|
+
module Runner
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# Run the supplied features.
|
10
|
+
#
|
11
|
+
# @param [Array<String>] paths the feature files or directories
|
12
|
+
# @param [Hash] options the options for the execution
|
13
|
+
# @option options [String] :command_prefix allows adding an additional prefix to the ecukes command.
|
14
|
+
# @return [Boolean] the status of the execution
|
15
|
+
#
|
16
|
+
def run(paths, options = { })
|
17
|
+
return false if paths.empty?
|
18
|
+
|
19
|
+
message = options[:message] || (paths == ['features'] ? "Running all Ecukes features: #{ ecukes_command(paths, options) }" : "Running Ecukes features: #{ ecukes_command(paths, options) }")
|
20
|
+
|
21
|
+
UI.info message, :reset => true
|
22
|
+
|
23
|
+
system(ecukes_command(paths, options))
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
# Assembles the Ecukes command from the passed options.
|
29
|
+
#
|
30
|
+
# @param [Array<String>] paths the feature files or directories
|
31
|
+
# @param [Hash] options the options for the execution
|
32
|
+
# @option options [String] :command_prefix allows adding an additional prefix to the ecukes command.
|
33
|
+
# @return [String] the Ecukes command
|
34
|
+
#
|
35
|
+
def ecukes_command(paths, options)
|
36
|
+
cmd = []
|
37
|
+
cmd << options[:command_prefix] if options[:command_prefix]
|
38
|
+
cmd << 'cask exec ecukes'
|
39
|
+
cmd << options[:cli] if options[:cli]
|
40
|
+
(cmd + paths).join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-ecukes
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dillon Kearns
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: guard
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.1'
|
41
|
+
description: Guard::Ecukes automatically runs your features (much like autotest)
|
42
|
+
email:
|
43
|
+
- dillon@dillonkearns.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/guard/ecukes/inspector.rb
|
49
|
+
- lib/guard/ecukes/runner.rb
|
50
|
+
- lib/guard/ecukes/templates/Guardfile
|
51
|
+
- lib/guard/ecukes/version.rb
|
52
|
+
- lib/guard/ecukes.rb
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
55
|
+
homepage: http://github.com/dillonkearns/guard-ecukes
|
56
|
+
licenses: []
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 1.3.6
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.0.3
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Guard plugin for the Emacs Ecukes integration testing framework
|
78
|
+
test_files: []
|
79
|
+
has_rdoc:
|