guard-cucumber 1.4.1 → 1.5.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.
@@ -0,0 +1,86 @@
1
+ module Guard
2
+ class Cucumber
3
+ # The Cucumber runner handles the execution of the cucumber binary.
4
+ #
5
+ module Runner
6
+ class << self
7
+ # Run the supplied features.
8
+ #
9
+ # @param [Array<String>] paths the feature files or directories
10
+ # @param [Hash] options the options for the execution
11
+ # @option options [Array<String>] :feature_sets a list of non-standard feature directory/ies
12
+ # @option options [Boolean] :bundler use bundler or not
13
+ # @option options [Array<String>] :rvm a list of rvm version to use for the test
14
+ # @option options [Boolean] :notification show notifications
15
+ # @option options [String] :command_prefix allows adding an additional prefix to the cucumber command. Ideal for running xvfb-run for terminal only cucumber tests.
16
+ # @return [Boolean] the status of the execution
17
+ #
18
+ def run(paths, options = {})
19
+ return false if paths.empty?
20
+
21
+ message = options[:message] || (paths == ["features"] ? "Running all Cucumber features: #{ cucumber_command(paths, options) }" : "Running Cucumber features: #{ cucumber_command(paths, options) }")
22
+ paths = options[:focus_on] ? Focuser.focus(paths, options[:focus_on]) : paths
23
+
24
+ UI.info message, reset: true
25
+
26
+ system(cucumber_command(paths, options))
27
+ end
28
+
29
+ private
30
+
31
+ # Assembles the Cucumber command from the passed options.
32
+ #
33
+ # @param [Array<String>] paths the feature files or directories
34
+ # @param [Hash] options the options for the execution
35
+ # @option options [Boolean] :bundler use bundler or not
36
+ # @option options [Array<String>] :rvm a list of rvm version to use for the test
37
+ # @option options [Boolean] :notification show notifications
38
+ # @option options [String] :command_prefix allows adding an additional prefix to the cucumber command. Ideal for running xvfb-run for terminal only cucumber tests.
39
+ # @return [String] the Cucumber command
40
+ #
41
+ def cucumber_command(paths, options)
42
+ cmd = []
43
+ cmd << options[:command_prefix] if options[:command_prefix]
44
+ cmd << "rvm #{ options[:rvm].join(",") } exec" if options[:rvm].is_a?(Array)
45
+ cmd << "bundle exec" if bundler? && options[:bundler] != false
46
+ cmd << cucumber_exec(options)
47
+ cmd << options[:cli] if options[:cli]
48
+
49
+ if options[:notification] != false
50
+ notification_formatter_path = File.expand_path(File.join(File.dirname(__FILE__), "notification_formatter.rb"))
51
+ cmd << "--require #{ notification_formatter_path }"
52
+ cmd << "--format Guard::Cucumber::NotificationFormatter"
53
+ cmd << "--out #{ null_device }"
54
+ cmd << (options[:feature_sets] || ["features"]).map { |path| "--require #{ path }" }.join(" ")
55
+ end
56
+
57
+ (cmd + paths).join(" ")
58
+ end
59
+
60
+ # Simple test if binstubs prefix should be used.
61
+ #
62
+ # @return [String] Cucumber executable
63
+ #
64
+ def cucumber_exec(options = {})
65
+ options[:binstubs] == true ? "bin/cucumber" : "cucumber"
66
+ end
67
+
68
+ # Simple test if bundler should be used. it just checks for the `Gemfile`.
69
+ #
70
+ # @return [Boolean] bundler exists
71
+ #
72
+ def bundler?
73
+ @bundler ||= File.exist?("#{ Dir.pwd }/Gemfile")
74
+ end
75
+
76
+ # Returns a null device for all OS.
77
+ #
78
+ # @return [String] the name of the null device
79
+ #
80
+ def null_device
81
+ RUBY_PLATFORM.index("mswin") ? "NUL" : "/dev/null"
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,8 @@
1
- guard 'cucumber' do
1
+ guard "cucumber" do
2
2
  watch(%r{^features/.+\.feature$})
3
- watch(%r{^features/support/.+$}) { 'features' }
4
- watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
3
+ watch(%r{^features/support/.+$}) { "features" }
4
+
5
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) do |m|
6
+ Dir[File.join("**/#{m[1]}.feature")][0] || "features"
7
+ end
5
8
  end
@@ -0,0 +1,5 @@
1
+ guard "cucumber" do
2
+ watch(%r{^features/.+\.feature$})
3
+ watch(%r{^features/support/.+$}) { "features" }
4
+ watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || "features" }
5
+ end
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  module CucumberVersion
3
3
  # Guard::Cucumber version that is used for the Gem specification
4
- VERSION = '1.4.1'
4
+ VERSION = "1.5.1"
5
5
  end
6
6
  end
@@ -0,0 +1,6 @@
1
+ module Guard
2
+ module CucumberVersion
3
+ # Guard::Cucumber version that is used for the Gem specification
4
+ VERSION = "1.4.1"
5
+ end
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kessler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-27 00:00:00.000000000 Z
11
+ date: 2014-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.0
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cucumber
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2.0
33
+ version: 1.3.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2.0
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -54,21 +54,27 @@ dependencies:
54
54
  version: '1.1'
55
55
  description: Guard::Cucumber automatically run your features (much like autotest)
56
56
  email:
57
- - michi@netzpiraten.ch
57
+ - michi@flinkfinger.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - LICENSE
63
+ - README.md
64
+ - lib/guard/cucumber.rb
65
+ - lib/guard/cucumber.rb.orig
62
66
  - lib/guard/cucumber/focuser.rb
67
+ - lib/guard/cucumber/focuser.rb.orig
63
68
  - lib/guard/cucumber/inspector.rb
69
+ - lib/guard/cucumber/inspector.rb.orig
64
70
  - lib/guard/cucumber/notification_formatter.rb
71
+ - lib/guard/cucumber/notification_formatter.rb.orig
65
72
  - lib/guard/cucumber/runner.rb
73
+ - lib/guard/cucumber/runner.rb.orig
66
74
  - lib/guard/cucumber/templates/Guardfile
75
+ - lib/guard/cucumber/templates/Guardfile.orig
67
76
  - lib/guard/cucumber/version.rb
68
- - lib/guard/cucumber/version.rbc
69
- - lib/guard/cucumber.rb
70
- - LICENSE
71
- - README.md
77
+ - lib/guard/cucumber/version.rb.orig
72
78
  homepage: http://github.com/netzpirat/guard-cucumber
73
79
  licenses: []
74
80
  metadata: {}
@@ -88,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
94
  version: 1.3.6
89
95
  requirements: []
90
96
  rubyforge_project: guard-cucumber
91
- rubygems_version: 2.1.11
97
+ rubygems_version: 2.4.2
92
98
  signing_key:
93
99
  specification_version: 4
94
100
  summary: Guard plugin for Cucumber
@@ -1,203 +0,0 @@
1
- !RBIX
2
- 9595534255132031488
3
- x
4
- M
5
- 1
6
- n
7
- n
8
- x
9
- 10
10
- __script__
11
- i
12
- 28
13
- 99
14
- 7
15
- 0
16
- 65
17
- 49
18
- 1
19
- 2
20
- 13
21
- 99
22
- 12
23
- 7
24
- 2
25
- 12
26
- 7
27
- 3
28
- 12
29
- 65
30
- 12
31
- 49
32
- 4
33
- 4
34
- 15
35
- 49
36
- 2
37
- 0
38
- 15
39
- 2
40
- 11
41
- I
42
- 6
43
- I
44
- 0
45
- I
46
- 0
47
- I
48
- 0
49
- n
50
- p
51
- 5
52
- x
53
- 5
54
- Guard
55
- x
56
- 11
57
- open_module
58
- x
59
- 15
60
- __module_init__
61
- M
62
- 1
63
- n
64
- n
65
- x
66
- 5
67
- Guard
68
- i
69
- 28
70
- 5
71
- 66
72
- 99
73
- 7
74
- 0
75
- 65
76
- 49
77
- 1
78
- 2
79
- 13
80
- 99
81
- 12
82
- 7
83
- 2
84
- 12
85
- 7
86
- 3
87
- 12
88
- 65
89
- 12
90
- 49
91
- 4
92
- 4
93
- 15
94
- 49
95
- 2
96
- 0
97
- 11
98
- I
99
- 6
100
- I
101
- 0
102
- I
103
- 0
104
- I
105
- 0
106
- n
107
- p
108
- 5
109
- x
110
- 15
111
- CucumberVersion
112
- x
113
- 11
114
- open_module
115
- x
116
- 15
117
- __module_init__
118
- M
119
- 1
120
- n
121
- n
122
- x
123
- 15
124
- CucumberVersion
125
- i
126
- 12
127
- 5
128
- 66
129
- 65
130
- 7
131
- 0
132
- 7
133
- 1
134
- 64
135
- 49
136
- 2
137
- 2
138
- 11
139
- I
140
- 3
141
- I
142
- 0
143
- I
144
- 0
145
- I
146
- 0
147
- n
148
- p
149
- 3
150
- x
151
- 7
152
- VERSION
153
- s
154
- 5
155
- 1.2.0
156
- x
157
- 9
158
- const_set
159
- p
160
- 3
161
- I
162
- 2
163
- I
164
- 4
165
- I
166
- c
167
- x
168
- 70
169
- /Users/michi/Repositories/guard-cucumber/lib/guard/cucumber/version.rb
170
- p
171
- 0
172
- x
173
- 13
174
- attach_method
175
- p
176
- 3
177
- I
178
- 2
179
- I
180
- 2
181
- I
182
- 1c
183
- x
184
- 70
185
- /Users/michi/Repositories/guard-cucumber/lib/guard/cucumber/version.rb
186
- p
187
- 0
188
- x
189
- 13
190
- attach_method
191
- p
192
- 3
193
- I
194
- 0
195
- I
196
- 1
197
- I
198
- 1c
199
- x
200
- 70
201
- /Users/michi/Repositories/guard-cucumber/lib/guard/cucumber/version.rb
202
- p
203
- 0