cuke_commander 1.0.0 → 1.1.0

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 CHANGED
@@ -1,22 +1,22 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- *.bundle
19
- *.so
20
- *.o
21
- *.a
22
- mkmf.log
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in cuke_commander.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cuke_commander.gemspec
4
+ gemspec
@@ -0,0 +1,8 @@
1
+ === Version 1.1.0 / 2015-05-05
2
+
3
+ * Command lines can now be generated using the longer forms of options (e.g. '--tags' instead of '-t').
4
+
5
+
6
+ === Version 1.0.0 / 2015-03-20
7
+
8
+ * Initial release
@@ -1,22 +1,22 @@
1
- Copyright (c) 2015 Grange Insurance
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2015 Grange Insurance
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,50 +1,52 @@
1
- # CukeCommander
2
-
3
- The cuke_commander gem provides an easy and programmatic way to build a command line for running Cucumber.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'cuke_commander'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install cuke_commander
18
-
19
- ## Usage
20
-
21
- require 'cuke_commander'
22
-
23
- # Choose your Cucumber options
24
- cucumber_options = {tags: ['@tag1', '@tag2,@tag3'],
25
- formatters: {json: 'json_output.txt',
26
- pretty: ''},
27
- options: ['-r features']}
28
-
29
- # Use the generator to create an appropriate Cucumber command line
30
- clg = CukeCommander::CLGenerator.new
31
- command_line = clg.generate_command_line(cucumber_options)
32
-
33
- puts command_line
34
- # This will produce something along the lines of
35
- # cucumber -t @tag1 -t @tag2,@tag3 -f json -o json_output.txt -f pretty -r features
36
-
37
- # Use the command line to kick off Cucumber
38
- system(command_line)
39
-
40
- Simple!
41
-
42
- (see documentation for all implemented Cucumber options)
43
-
44
- ## Contributing
45
-
46
- 1. Fork it ( https://github.com/[my-github-username]/cuke_commander/fork )
47
- 2. Create your feature branch (`git checkout -b my-new-feature`)
48
- 3. Commit your changes (`git commit -am 'Add some feature'`)
49
- 4. Push to the branch (`git push origin my-new-feature`)
50
- 5. Create a new Pull Request
1
+ # CukeCommander
2
+
3
+ <a href="http://badge.fury.io/rb/cuke_commander"><img src="https://badge.fury.io/rb/cuke_commander.svg" alt="Gem Version" height="18"></a>
4
+
5
+ The cuke_commander gem provides an easy and programmatic way to build a command line for running Cucumber.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'cuke_commander'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install cuke_commander
20
+
21
+ ## Usage
22
+
23
+ require 'cuke_commander'
24
+
25
+ # Choose your Cucumber options
26
+ cucumber_options = {tags: ['@tag1', '@tag2,@tag3'],
27
+ formatters: {json: 'json_output.txt',
28
+ pretty: ''},
29
+ options: ['-r features']}
30
+
31
+ # Use the generator to create an appropriate Cucumber command line
32
+ clg = CukeCommander::CLGenerator.new
33
+ command_line = clg.generate_command_line(cucumber_options)
34
+
35
+ puts command_line
36
+ # This will produce something along the lines of
37
+ # cucumber -t @tag1 -t @tag2,@tag3 -f json -o json_output.txt -f pretty -r features
38
+
39
+ # Use the command line to kick off Cucumber
40
+ system(command_line)
41
+
42
+ Simple!
43
+
44
+ (see documentation for all implemented Cucumber options)
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it ( https://github.com/[my-github-username]/cuke_commander/fork )
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create a new Pull Request
data/Rakefile CHANGED
@@ -1,45 +1,45 @@
1
- require "bundler/gem_tasks"
2
- require 'cucumber/rake/task'
3
- require 'rspec/core/rake_task'
4
-
5
-
6
- def set_cucumber_options(options)
7
- ENV['CUCUMBER_OPTS'] = options
8
- end
9
-
10
- def combine_options(set_1, set_2)
11
- set_2 ? "#{set_1} #{set_2}" : set_1
12
- end
13
-
14
-
15
- namespace 'cuke_commander' do
16
-
17
- task :clear_coverage do
18
- puts 'Clearing old code coverage results...'
19
-
20
- # Remove previous coverage results so that they don't get merged into the new results
21
- code_coverage_directory = File.join(File.dirname(__FILE__), 'coverage')
22
- FileUtils.remove_dir(code_coverage_directory, true) if File.exists?(code_coverage_directory)
23
- end
24
-
25
- desc 'Run all of the Cucumber features for the gem'
26
- task :features, [:command_options] do |_t, args|
27
- set_cucumber_options(combine_options('-t ~@wip -t ~@off', args[:command_options]))
28
- end
29
- Cucumber::Rake::Task.new(:features)
30
-
31
- desc 'Run all of the RSpec specifications for the gem'
32
- RSpec::Core::RakeTask.new(:specs, :command_options) do |t, args|
33
- t.rspec_opts = "-t ~wip -t ~off "
34
- t.rspec_opts << args[:command_options] if args[:command_options]
35
- end
36
-
37
- desc 'Test All The Things'
38
- task :test_everything, [:command_options] => [:clear_coverage] do |_t, args|
39
- Rake::Task['cuke_commander:specs'].invoke(args[:command_options])
40
- Rake::Task['cuke_commander:features'].invoke(args[:command_options])
41
- end
42
-
43
- end
44
-
45
- task :default => 'cuke_commander:test_everything'
1
+ require "bundler/gem_tasks"
2
+ require 'cucumber/rake/task'
3
+ require 'rspec/core/rake_task'
4
+
5
+
6
+ def set_cucumber_options(options)
7
+ ENV['CUCUMBER_OPTS'] = options
8
+ end
9
+
10
+ def combine_options(set_1, set_2)
11
+ set_2 ? "#{set_1} #{set_2}" : set_1
12
+ end
13
+
14
+
15
+ namespace 'cuke_commander' do
16
+
17
+ task :clear_coverage do
18
+ puts 'Clearing old code coverage results...'
19
+
20
+ # Remove previous coverage results so that they don't get merged into the new results
21
+ code_coverage_directory = File.join(File.dirname(__FILE__), 'coverage')
22
+ FileUtils.remove_dir(code_coverage_directory, true) if File.exists?(code_coverage_directory)
23
+ end
24
+
25
+ desc 'Run all of the Cucumber features for the gem'
26
+ task :features, [:command_options] do |_t, args|
27
+ set_cucumber_options(combine_options('-t ~@wip -t ~@off', args[:command_options]))
28
+ end
29
+ Cucumber::Rake::Task.new(:features)
30
+
31
+ desc 'Run all of the RSpec specifications for the gem'
32
+ RSpec::Core::RakeTask.new(:specs, :command_options) do |t, args|
33
+ t.rspec_opts = "-t ~wip -t ~off "
34
+ t.rspec_opts << args[:command_options] if args[:command_options]
35
+ end
36
+
37
+ desc 'Test All The Things'
38
+ task :test_everything, [:command_options] => [:clear_coverage] do |_t, args|
39
+ Rake::Task['cuke_commander:specs'].invoke(args[:command_options])
40
+ Rake::Task['cuke_commander:features'].invoke(args[:command_options])
41
+ end
42
+
43
+ end
44
+
45
+ task :default => 'cuke_commander:test_everything'
@@ -1,26 +1,26 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cuke_commander/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "cuke_commander"
8
- spec.version = CukeCommander::VERSION
9
- spec.authors = ["Eric Kessler", 'Donavan Stanley']
10
- spec.email = ["morrow748@gmail.com", 'stanleyd@grangeinsurance.com']
11
- spec.description = %q{Command Cucumber}
12
- spec.summary = %q{Provides an easy way to build a cucumber commandline.}
13
- spec.homepage = "https://github.com/grange-insurance/cuke_commander"
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.6"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency 'cucumber'
24
- spec.add_development_dependency 'rspec'
25
- spec.add_development_dependency 'simplecov'
26
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cuke_commander/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "cuke_commander"
8
+ spec.version = CukeCommander::VERSION
9
+ spec.authors = ["Eric Kessler", 'Donavan Stanley']
10
+ spec.email = ["morrow748@gmail.com", 'stanleyd@grangeinsurance.com']
11
+ spec.summary = %q{Command Cucumber}
12
+ spec.description = %q{Provides an easy way to build a cucumber commandline.}
13
+ spec.homepage = "https://github.com/grange-insurance/cuke_commander"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency 'cucumber'
24
+ spec.add_development_dependency 'rspec'
25
+ spec.add_development_dependency 'simplecov'
26
+ end
@@ -13,32 +13,56 @@ Feature: Command line formatting
13
13
  Then I am given the following cucumber command line
14
14
  | cucumber |
15
15
 
16
- Scenario: Profile flag format
17
- When I ask for a cucumber command line with the following profiles
16
+ Scenario: Flags default to short flags
17
+ When I want a cucumber command line with the following tags
18
+ | @tag_1 |
19
+ And I ask for the command line without specifying a flag type
20
+ Then I am given the following cucumber command line
21
+ | cucumber -t @tag_1 |
22
+
23
+ Scenario Outline: Profile flag format
24
+ When I want a cucumber command line with the following profiles
18
25
  | profile_1 |
26
+ And I ask for the command line with "<short_long>" flags
19
27
  Then I am given the following cucumber command line
20
- | cucumber -p profile_1 |
21
- When I ask for a cucumber command line with the following profiles
28
+ | cucumber <profile> profile_1 |
29
+ When I want a cucumber command line with the following profiles
22
30
  | profile_2 |
23
31
  | profile_3 |
32
+ And I ask for the command line with "<short_long>" flags
24
33
  Then I am given the following cucumber command line
25
- | cucumber -p profile_2 -p profile_3 |
34
+ | cucumber <profile> profile_2 <profile> profile_3 |
35
+ Examples:
36
+ | short_long | profile |
37
+ | short | -p |
38
+ | long | --profile |
26
39
 
27
- Scenario: No-profile flag format
28
- When I ask for a cucumber command line with a no-profile flag
40
+ Scenario Outline: No-profile flag format
41
+ When I want a cucumber command line with a no-profile flag
42
+ And I ask for the command line with "<short_long>" flags
29
43
  Then I am given the following cucumber command line
30
- | cucumber -P |
44
+ | cucumber <flag> |
45
+ Examples:
46
+ | short_long | flag |
47
+ | short | -P |
48
+ | long | --no-profile |
31
49
 
32
- Scenario: Tag flag format
33
- When I ask for a cucumber command line with the following tags
50
+ Scenario Outline: Tag flag format
51
+ When I want a cucumber command line with the following tags
34
52
  | @tag_1 |
53
+ And I ask for the command line with "<short_long>" flags
35
54
  Then I am given the following cucumber command line
36
- | cucumber -t @tag_1 |
37
- When I ask for a cucumber command line with the following tags
55
+ | cucumber <flag> @tag_1 |
56
+ When I want a cucumber command line with the following tags
38
57
  | @tag_2 |
39
58
  | @tag_3,@tag4 |
59
+ And I ask for the command line with "<short_long>" flags
40
60
  Then I am given the following cucumber command line
41
- | cucumber -t @tag_2 -t @tag_3,@tag4 |
61
+ | cucumber <flag> @tag_2 <flag> @tag_3,@tag4 |
62
+ Examples:
63
+ | short_long | flag |
64
+ | short | -t |
65
+ | long | --tags |
42
66
 
43
67
  Scenario: File-path flag format
44
68
  When I ask for a cucumber command line with the following file-paths
@@ -51,116 +75,206 @@ Feature: Command line formatting
51
75
  Then I am given the following cucumber command line
52
76
  | cucumber features/some_dir features/some_other_dir |
53
77
 
54
- Scenario: Exclude pattern flag format
55
- When I ask for a cucumber command line with the following exclude patterns
78
+ Scenario Outline: Exclude pattern flag format
79
+ When I want a cucumber command line with the following exclude patterns
56
80
  | pattern_1 |
81
+ And I ask for the command line with "<short_long>" flags
57
82
  Then I am given the following cucumber command line
58
- | cucumber -e pattern_1 |
59
- When I ask for a cucumber command line with the following exclude patterns
83
+ | cucumber <flag> pattern_1 |
84
+ When I want a cucumber command line with the following exclude patterns
60
85
  | pattern_2 |
61
86
  | pattern_3 |
87
+ And I ask for the command line with "<short_long>" flags
62
88
  Then I am given the following cucumber command line
63
- | cucumber -e pattern_2 -e pattern_3 |
89
+ | cucumber <flag> pattern_2 <flag> pattern_3 |
90
+ Examples:
91
+ | short_long | flag |
92
+ | short | -e |
93
+ | long | --exclude |
64
94
 
65
- Scenario: No-source flag format
66
- When I ask for a cucumber command line with a no-source flag
95
+ Scenario Outline: No-source flag format
96
+ When I want a cucumber command line with a no-source flag
97
+ And I ask for the command line with "<short_long>" flags
67
98
  Then I am given the following cucumber command line
68
- | cucumber -s |
99
+ | cucumber <flag> |
100
+ Examples:
101
+ | short_long | flag |
102
+ | short | -s |
103
+ | long | --no-source |
69
104
 
70
- Scenario: No-color flag format
71
- When I ask for a cucumber command line with a no-color flag
105
+ Scenario Outline: No-color flag format
106
+ When I want a cucumber command line with a no-color flag
107
+ And I ask for the command line with "<short_long>" flags
72
108
  Then I am given the following cucumber command line
73
- | cucumber --no-color |
109
+ | cucumber <flag> |
110
+ Examples:
111
+ | short_long | flag |
112
+ | short | --no-color |
113
+ | long | --no-color |
74
114
 
75
- Scenario: Color flag format
76
- When I ask for a cucumber command line with a color flag
115
+ Scenario Outline: Color flag format
116
+ When I want a cucumber command line with a color flag
117
+ And I ask for the command line with "<short_long>" flags
77
118
  Then I am given the following cucumber command line
78
- | cucumber --color |
119
+ | cucumber <flag> |
120
+ Examples:
121
+ | short_long | flag |
122
+ | short | -c |
123
+ | long | --color |
79
124
 
80
- Scenario: Formatter flag format
81
- When I ask for a cucumber command line with the following formatters
125
+ Scenario Outline: Formatter flag format
126
+ When I want a cucumber command line with the following formatters
82
127
  | formatter | output_location |
83
128
  | json | STDOUT |
129
+ And I ask for the command line with "<short_long>" flags
84
130
  Then I am given the following cucumber command line
85
- | cucumber -f json -o STDOUT |
86
- When I ask for a cucumber command line with the following formatters
131
+ | cucumber <format_flag> json <output_flag> STDOUT |
132
+ When I want a cucumber command line with the following formatters
87
133
  | formatter | output_location |
88
134
  | pretty | |
89
135
  | html | output.html |
136
+ And I ask for the command line with "<short_long>" flags
90
137
  Then I am given the following cucumber command line
91
- | cucumber -f pretty -f html -o output.html |
138
+ | cucumber <format_flag> pretty <format_flag> html <output_flag> output.html |
139
+ Examples:
140
+ | short_long | format_flag | output_flag |
141
+ | short | -f | -o |
142
+ | long | --format | --out |
92
143
 
93
- Scenario: Backtrace flag format
94
- When I ask for a cucumber command line with a backtrace flag
144
+ Scenario Outline: Backtrace flag format
145
+ When I want a cucumber command line with a backtrace flag
146
+ And I ask for the command line with "<short_long>" flags
95
147
  Then I am given the following cucumber command line
96
- | cucumber -b |
148
+ | cucumber <flag> |
149
+ Examples:
150
+ | short_long | flag |
151
+ | short | -b |
152
+ | long | --backtrace |
97
153
 
98
- Scenario: Dry run flag format
99
- When I ask for a cucumber command line with a dry run flag
154
+ Scenario Outline: Dry run flag format
155
+ When I want a cucumber command line with a dry run flag
156
+ And I ask for the command line with "<short_long>" flags
100
157
  Then I am given the following cucumber command line
101
- | cucumber -d |
158
+ | cucumber <flag> |
159
+ Examples:
160
+ | short_long | flag |
161
+ | short | -d |
162
+ | long | --dry-run |
102
163
 
103
- Scenario: Guess flag format
104
- When I ask for a cucumber command line with a guess flag
164
+ Scenario Outline: Guess flag format
165
+ When I want a cucumber command line with a guess flag
166
+ And I ask for the command line with "<short_long>" flags
105
167
  Then I am given the following cucumber command line
106
- | cucumber -g |
168
+ | cucumber <flag> |
169
+ Examples:
170
+ | short_long | flag |
171
+ | short | -g |
172
+ | long | --guess |
107
173
 
108
- Scenario: WIP flag format
109
- When I ask for a cucumber command line with a wip flag
174
+ Scenario Outline: WIP flag format
175
+ When I want a cucumber command line with a wip flag
176
+ And I ask for the command line with "<short_long>" flags
110
177
  Then I am given the following cucumber command line
111
- | cucumber -w |
178
+ | cucumber <flag> |
179
+ Examples:
180
+ | short_long | flag |
181
+ | short | -w |
182
+ | long | --wip |
112
183
 
113
- Scenario: Quiet flag format
114
- When I ask for a cucumber command line with a quiet flag
184
+ Scenario Outline: Quiet flag format
185
+ When I want a cucumber command line with a quiet flag
186
+ And I ask for the command line with "<short_long>" flags
115
187
  Then I am given the following cucumber command line
116
- | cucumber -q |
188
+ | cucumber <flag> |
189
+ Examples:
190
+ | short_long | flag |
191
+ | short | -q |
192
+ | long | --quiet |
117
193
 
118
- Scenario: Help flag format
119
- When I ask for a cucumber command line with a help flag
194
+ Scenario Outline: Help flag format
195
+ When I want a cucumber command line with a help flag
196
+ And I ask for the command line with "<short_long>" flags
120
197
  Then I am given the following cucumber command line
121
- | cucumber -h |
198
+ | cucumber <flag> |
199
+ Examples:
200
+ | short_long | flag |
201
+ | short | -h |
202
+ | long | --help |
122
203
 
123
- Scenario: Version flag format
124
- When I ask for a cucumber command line with a version flag
204
+ Scenario Outline: Version flag format
205
+ When I want a cucumber command line with a version flag
206
+ And I ask for the command line with "<short_long>" flags
125
207
  Then I am given the following cucumber command line
126
- | cucumber --version |
208
+ | cucumber <flag> |
209
+ Examples:
210
+ | short_long | flag |
211
+ | short | --version |
212
+ | long | --version |
213
+
127
214
 
128
- Scenario: Strict flag format
129
- When I ask for a cucumber command line with a strict flag
215
+ Scenario Outline: Strict flag format
216
+ When I want a cucumber command line with a strict flag
217
+ And I ask for the command line with "<short_long>" flags
130
218
  Then I am given the following cucumber command line
131
- | cucumber -S |
219
+ | cucumber <flag> |
220
+ Examples:
221
+ | short_long | flag |
222
+ | short | -S |
223
+ | long | --strict |
132
224
 
133
- Scenario: Verbose flag format
134
- When I ask for a cucumber command line with a verbose flag
225
+ Scenario Outline: Verbose flag format
226
+ When I want a cucumber command line with a verbose flag
227
+ And I ask for the command line with "<short_long>" flags
135
228
  Then I am given the following cucumber command line
136
- | cucumber -v |
229
+ | cucumber <flag> |
230
+ Examples:
231
+ | short_long | flag |
232
+ | short | -v |
233
+ | long | --verbose |
137
234
 
138
- Scenario: Expand flag format
139
- When I ask for a cucumber command line with an expand flag
235
+ Scenario Outline: Expand flag format
236
+ When I want a cucumber command line with a expand flag
237
+ And I ask for the command line with "<short_long>" flags
140
238
  Then I am given the following cucumber command line
141
- | cucumber -x |
239
+ | cucumber <flag> |
240
+ Examples:
241
+ | short_long | flag |
242
+ | short | -x |
243
+ | long | --expand |
142
244
 
143
- Scenario: Name flag format
144
- When I ask for a cucumber command line with the name patterns
245
+ Scenario Outline: Name flag format
246
+ When I want a cucumber command line with the following names
145
247
  | pattern_1 |
248
+ And I ask for the command line with "<short_long>" flags
146
249
  Then I am given the following cucumber command line
147
- | cucumber -n pattern_1 |
148
- When I ask for a cucumber command line with the name patterns
250
+ | cucumber <flag> pattern_1 |
251
+ When I want a cucumber command line with the following names
149
252
  | pattern_2 |
150
253
  | pattern_3 |
254
+ And I ask for the command line with "<short_long>" flags
151
255
  Then I am given the following cucumber command line
152
- | cucumber -n pattern_2 -n pattern_3 |
256
+ | cucumber <flag> pattern_2 <flag> pattern_3 |
257
+ Examples:
258
+ | short_long | flag |
259
+ | short | -n |
260
+ | long | --name |
153
261
 
154
- Scenario: Require flag format
155
- When I ask for a cucumber command line with the following required files
262
+ Scenario Outline: Require flag format
263
+ When I want a cucumber command line with the following requires
156
264
  | features/foo.rb |
265
+ And I ask for the command line with "<short_long>" flags
157
266
  Then I am given the following cucumber command line
158
- | cucumber -r features/foo.rb |
159
- When I ask for a cucumber command line with the following required files
267
+ | cucumber <flag> features/foo.rb |
268
+ When I want a cucumber command line with the following requires
160
269
  | features/bar.rb |
161
270
  | features/bar/baz.rb |
271
+ And I ask for the command line with "<short_long>" flags
162
272
  Then I am given the following cucumber command line
163
- | cucumber -r features/bar.rb -r features/bar/baz.rb |
273
+ | cucumber <flag> features/bar.rb <flag> features/bar/baz.rb |
274
+ Examples:
275
+ | short_long | flag |
276
+ | short | -r |
277
+ | long | --require |
164
278
 
165
279
  Scenario: Additional options format
166
280
 
@@ -29,6 +29,7 @@ Feature: Cucumber options
29
29
  | guess |
30
30
  | no_profile |
31
31
  | options |
32
+ | long_flags |
32
33
 
33
34
  Scenario: Generator will accept known options
34
35
  Given a command line generator
@@ -6,54 +6,11 @@ When(/^I ask for a cucumber command line with no additional options$/) do
6
6
  @command_line = @commander.generate_command_line
7
7
  end
8
8
 
9
- When(/^I ask for a cucumber command line with the following profiles$/) do |profiles|
10
- options = {profiles: profiles.raw.flatten}
11
- @command_line = @commander.generate_command_line(options)
12
- end
13
-
14
- When(/^I ask for a cucumber command line with a no\-profile flag$/) do
15
- @options = {no_profile: true}
16
- @command_line = @commander.generate_command_line(@options)
17
- end
18
-
19
- When(/^I ask for a cucumber command line with the following tags$/) do |tags|
20
- @options = {tags: tags.raw.flatten}
21
- @command_line = @commander.generate_command_line(@options)
22
- end
23
-
24
9
  When(/^I ask for a cucumber command line with the following file-paths$/) do |table|
25
10
  @options = {file_paths: table.raw.flatten}
26
11
  @command_line = @commander.generate_command_line(@options)
27
12
  end
28
13
 
29
- When(/^I ask for a cucumber command line with the following exclude patterns$/) do |table|
30
- @options = {excludes: table.raw.flatten}
31
- @command_line = @commander.generate_command_line(@options)
32
- end
33
-
34
- When(/^I ask for a cucumber command line with a no-source flag$/) do
35
- @options = {no_source: true}
36
- @command_line = @commander.generate_command_line(@options)
37
- end
38
-
39
- When(/^I ask for a cucumber command line with a no-color flag$/) do
40
- @options = {no_color: true}
41
- @command_line = @commander.generate_command_line(@options)
42
- end
43
-
44
- When(/^I ask for a cucumber command line with a color flag$/) do
45
- @options = {color: true}
46
- @command_line = @commander.generate_command_line(@options)
47
- end
48
-
49
- When(/^I ask for a cucumber command line with the following formatters$/) do |table|
50
- table = table.raw
51
- table.shift
52
-
53
- @options = {formatters: Hash[table]}
54
- @command_line = @commander.generate_command_line(@options)
55
- end
56
-
57
14
  When(/^I ask for a Cucumber command line with an invalid option value$/) do
58
15
  options = {:tags => :bad_tag_value}
59
16
 
@@ -95,62 +52,10 @@ When(/I ask for a cucumber command line with the following additional options$/)
95
52
  @command_line = @commander.generate_command_line(@options)
96
53
  end
97
54
 
98
- When(/^I ask for a cucumber command line with a backtrace flag$/) do
99
- @options = {backtrace: true}
100
- @command_line = @commander.generate_command_line(@options)
101
- end
102
-
103
- When(/^I ask for a cucumber command line with a dry run flag$/) do
104
- @options = {dry_run: true}
105
- @command_line = @commander.generate_command_line(@options)
106
- end
107
-
108
- When(/^I ask for a cucumber command line with a guess flag$/) do
109
- @options = {guess: true}
110
- @command_line = @commander.generate_command_line(@options)
111
- end
112
-
113
- When(/^I ask for a cucumber command line with a wip flag$/) do
114
- @options = {wip: true}
115
- @command_line = @commander.generate_command_line(@options)
116
- end
117
-
118
- When(/^I ask for a cucumber command line with a quiet flag$/) do
119
- @options = {quiet: true}
120
- @command_line = @commander.generate_command_line(@options)
121
- end
122
-
123
- When(/^I ask for a cucumber command line with a help flag$/) do
124
- @options = {help: true}
125
- @command_line = @commander.generate_command_line(@options)
126
- end
127
-
128
- When(/^I ask for a cucumber command line with a version flag$/) do
129
- @options = {version: true}
130
- @command_line = @commander.generate_command_line(@options)
131
- end
132
-
133
- When(/^I ask for a cucumber command line with a strict flag$/) do
134
- @options = {strict: true}
135
- @command_line = @commander.generate_command_line(@options)
136
- end
137
-
138
- When(/^I ask for a cucumber command line with a verbose flag$/) do
139
- @options = {verbose: true}
140
- @command_line = @commander.generate_command_line(@options)
141
- end
142
-
143
- When(/^I ask for a cucumber command line with an expand flag$/) do
144
- @options = {expand: true}
145
- @command_line = @commander.generate_command_line(@options)
146
- end
147
-
148
- When(/^I ask for a cucumber command line with the name patterns$/) do |names|
149
- options = {names: names.raw.flatten}
150
- @command_line = @commander.generate_command_line(options)
151
- end
152
-
153
- When(/^I ask for a cucumber command line with the following required files$/) do |requires|
154
- options = {requires: requires.raw.flatten}
155
- @command_line = @commander.generate_command_line(options)
156
- end
55
+ And(/^I ask for the command line with "([^"]*)" flags$/) do |short_long|
56
+ if short_long == 'long'
57
+ @command_line = @commander.generate_command_line(@options.merge({:long_flags => true}))
58
+ else
59
+ @command_line = @commander.generate_command_line(@options.merge({:long_flags => false}))
60
+ end
61
+ end
@@ -1,3 +1,26 @@
1
1
  Given(/^a command line generator$/) do
2
2
  @commander = CukeCommander::CLGenerator.new
3
3
  end
4
+
5
+ When(/^I want a cucumber command line with the following (?!formatters)([^ ]*)$/) do |option, values|
6
+ @options = {option.to_sym => values.raw.flatten}
7
+ end
8
+
9
+ When(/^I want a cucumber command line with a (.*) flag$/) do |option|
10
+ @options = {option.sub(/ |-/,'_').to_sym => true}
11
+ end
12
+
13
+ And(/^I ask for the command line without specifying a flag type$/) do
14
+ @command_line = @commander.generate_command_line(@options)
15
+ end
16
+
17
+ When(/^I want a cucumber command line with the following exclude patterns$/) do |table|
18
+ @options = {excludes: table.raw.flatten}
19
+ end
20
+
21
+ When(/^I want a cucumber command line with the following formatters$/) do |table|
22
+ table = table.raw
23
+ table.shift
24
+
25
+ @options = {formatters: Hash[table]}
26
+ end
@@ -6,5 +6,5 @@ require "cuke_commander/cl_generator"
6
6
  module CukeCommander
7
7
 
8
8
  # The Cucumber options that are currently supported by the gem.
9
- CUKE_OPTIONS = %w{ profiles tags file_paths formatters excludes no_source no_color options backtrace color dry_run expand guess help names no_profile quiet requires strict verbose version wip}
9
+ CUKE_OPTIONS = %w{long_flags profiles tags file_paths formatters excludes no_source no_color options backtrace color dry_run expand guess help names no_profile quiet requires strict verbose version wip}
10
10
  end
@@ -16,36 +16,36 @@ module CukeCommander
16
16
  validate_options(options)
17
17
  command_line = 'cucumber'
18
18
 
19
- append_options(command_line, wrap_options(options[:profiles]), '-p') if options[:profiles]
20
- append_options(command_line, wrap_options(options[:names]), '-n') if options[:names]
21
- append_options(command_line, wrap_options(options[:tags]), '-t') if options[:tags]
22
- append_options(command_line, wrap_options(options[:file_paths])) if options[:file_paths]
23
- append_options(command_line, wrap_options(options[:excludes]), '-e') if options[:excludes]
24
- append_options(command_line, wrap_options(options[:requires]), '-r') if options[:requires]
25
- append_option(command_line, '-s') if options[:no_source]
19
+ append_options(command_line, wrap_options(options[:profiles]), flag_for(:profiles, options[:long_flags])) if options[:profiles]
20
+ append_options(command_line, wrap_options(options[:names]), flag_for(:names, options[:long_flags])) if options[:names]
21
+ append_options(command_line, wrap_options(options[:tags]), flag_for(:tags, options[:long_flags])) if options[:tags]
22
+ append_options(command_line, wrap_options(options[:file_paths])) if options[:file_paths]
23
+ append_options(command_line, wrap_options(options[:excludes]), flag_for(:excludes, options[:long_flags])) if options[:excludes]
24
+ append_options(command_line, wrap_options(options[:requires]), flag_for(:requires, options[:long_flags])) if options[:requires]
25
+ append_option(command_line, flag_for(:no_source, options[:long_flags])) if options[:no_source]
26
26
 
27
27
  if options[:formatters]
28
28
  options[:formatters].each do |format, output_location|
29
- append_option(command_line, format, '-f')
30
- append_option(command_line, output_location, '-o') unless output_location.to_s.empty?
29
+ append_option(command_line, format, flag_for(:format, options[:long_flags]))
30
+ append_option(command_line, output_location,flag_for(:output, options[:long_flags])) unless output_location.to_s.empty?
31
31
  end
32
32
  end
33
33
 
34
- append_option(command_line, '--no-color') if options[:no_color]
35
- append_option(command_line, '--color') if options[:color]
36
- append_option(command_line, '-b') if options[:backtrace]
37
- append_option(command_line, '-d') if options[:dry_run]
38
- append_option(command_line, '-P') if options[:no_profile]
39
- append_option(command_line, '-g') if options[:guess]
40
- append_option(command_line, '-w') if options[:wip]
41
- append_option(command_line, '-q') if options[:quiet]
42
- append_option(command_line, '-v') if options[:verbose]
43
- append_option(command_line, '--version') if options[:version]
44
- append_option(command_line, '-h') if options[:help]
45
- append_option(command_line, '-x') if options[:expand]
46
- append_option(command_line, '-S') if options[:strict]
47
-
48
- append_options(command_line, wrap_options(options[:options])) if options[:options]
34
+ append_option(command_line, flag_for(:no_color,options[:long_flags])) if options[:no_color]
35
+ append_option(command_line, flag_for(:color,options[:long_flags])) if options[:color]
36
+ append_option(command_line, flag_for(:backtrace,options[:long_flags])) if options[:backtrace]
37
+ append_option(command_line, flag_for(:dry_run,options[:long_flags])) if options[:dry_run]
38
+ append_option(command_line, flag_for(:no_profile,options[:long_flags])) if options[:no_profile]
39
+ append_option(command_line, flag_for(:guess,options[:long_flags])) if options[:guess]
40
+ append_option(command_line, flag_for(:wip,options[:long_flags])) if options[:wip]
41
+ append_option(command_line, flag_for(:quiet,options[:long_flags])) if options[:quiet]
42
+ append_option(command_line, flag_for(:verbose,options[:long_flags])) if options[:verbose]
43
+ append_option(command_line, flag_for(:version,options[:long_flags])) if options[:version]
44
+ append_option(command_line, flag_for(:help,options[:long_flags])) if options[:help]
45
+ append_option(command_line, flag_for(:expand,options[:long_flags])) if options[:expand]
46
+ append_option(command_line, flag_for(:strict,options[:long_flags])) if options[:strict]
47
+
48
+ append_options(command_line, wrap_options(options[:options])) if options[:options]
49
49
 
50
50
  command_line
51
51
  end
@@ -83,6 +83,7 @@ module CukeCommander
83
83
  raise_invalid_error('Names', 'a String or Array', options[:names]) unless valid_names?(options[:names])
84
84
  raise_invalid_error('Requires', 'a String or Array', options[:requires]) unless valid_requires?(options[:requires])
85
85
  raise_invalid_error('Options', 'a String or Array', options[:options]) unless valid_options?(options[:options])
86
+ raise_invalid_error('Long Flags', 'true or false', options[:long_flags]) unless valid_long_flags?(options[:long_flags])
86
87
  end
87
88
 
88
89
  def append_options(command, option_set, flag= nil)
@@ -192,6 +193,10 @@ module CukeCommander
192
193
  valid_string_array_value?(options)
193
194
  end
194
195
 
196
+ def valid_long_flags?(long_flag)
197
+ valid_boolean_value?(long_flag)
198
+ end
199
+
195
200
  def valid_string_array_value?(value)
196
201
  value.nil? || value.is_a?(Array) || value.is_a?(String)
197
202
  end
@@ -204,5 +209,52 @@ module CukeCommander
204
209
  value.nil? || value.is_a?(Hash)
205
210
  end
206
211
 
212
+ def flag_for(option, long_flags)
213
+ case option
214
+ when :tags
215
+ long_flags ? '--tags' : '-t'
216
+ when :profiles
217
+ long_flags ? '--profile' : '-p'
218
+ when :names
219
+ long_flags ? '--name' : '-n'
220
+ when :excludes
221
+ long_flags ? '--exclude' : '-e'
222
+ when :requires
223
+ long_flags ? '--require' : '-r'
224
+ when :backtrace
225
+ long_flags ? '--backtrace' : '-b'
226
+ when :color
227
+ long_flags ? '--color' : '-c'
228
+ when :no_color
229
+ '--no-color'
230
+ when :dry_run
231
+ long_flags ? '--dry-run' : '-d'
232
+ when :guess
233
+ long_flags ? '--guess' : '-g'
234
+ when :wip
235
+ long_flags ? '--wip' : '-w'
236
+ when :quiet
237
+ long_flags ? '--quiet' : '-q'
238
+ when :help
239
+ long_flags ? '--help' : '-h'
240
+ when :verbose
241
+ long_flags ? '--verbose' : '-v'
242
+ when :version
243
+ '--version'
244
+ when :strict
245
+ long_flags ? '--strict' : '-S'
246
+ when :expand
247
+ long_flags ? '--expand' : '-x'
248
+ when :no_source
249
+ long_flags ? '--no-source' : '-s'
250
+ when :no_profile
251
+ long_flags ? '--no-profile' : '-P'
252
+ when :format
253
+ long_flags ? '--format' : '-f'
254
+ when :output
255
+ long_flags ? '--out' : '-o'
256
+ end
257
+ end
258
+
207
259
  end
208
260
  end
@@ -1,5 +1,5 @@
1
- module CukeCommander
2
-
3
- # The current version for the gem.
4
- VERSION = '1.0.0'
5
- end
1
+ module CukeCommander
2
+
3
+ # The current version for the gem.
4
+ VERSION = '1.1.0'
5
+ end
@@ -47,7 +47,8 @@ describe 'CLGenerator, Unit' do
47
47
  strict: true,
48
48
  verbose: true,
49
49
  version: true,
50
- wip: true
50
+ wip: true,
51
+ long_flags: false
51
52
  }
52
53
 
53
54
  let(:test_options) { all_options.dup }
@@ -230,6 +231,13 @@ describe 'CLGenerator, Unit' do
230
231
  expect { generator.generate_command_line({options: ['foo', 'bar']}) }.to_not raise_error
231
232
  expect { generator.generate_command_line({options: bad_value}) }.to raise_error(ArgumentError, /must.*String or Array.*got.*#{bad_value.class}/)
232
233
  end
234
+
235
+ it 'only accepts a boolean as a long flag value' do
236
+ expect { generator.generate_command_line({long_flags: true}) }.to_not raise_error
237
+ expect { generator.generate_command_line({long_flags: false}) }.to_not raise_error
238
+ expect { generator.generate_command_line({long_flags: bad_value}) }.to raise_error(ArgumentError, /must.*true or false.*got.*#{bad_value.class}/)
239
+ end
240
+
233
241
  end
234
242
 
235
243
  describe 'old bugs' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuke_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-03-20 00:00:00.000000000 Z
13
+ date: 2015-05-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -92,7 +92,7 @@ dependencies:
92
92
  - - ! '>='
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
- description: Command Cucumber
95
+ description: Provides an easy way to build a cucumber commandline.
96
96
  email:
97
97
  - morrow748@gmail.com
98
98
  - stanleyd@grangeinsurance.com
@@ -103,6 +103,7 @@ files:
103
103
  - .gitignore
104
104
  - .simplecov
105
105
  - Gemfile
106
+ - History.rdoc
106
107
  - LICENSE.txt
107
108
  - README.md
108
109
  - Rakefile
@@ -135,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
136
  version: '0'
136
137
  segments:
137
138
  - 0
138
- hash: 772110449
139
+ hash: -312039377
139
140
  required_rubygems_version: !ruby/object:Gem::Requirement
140
141
  none: false
141
142
  requirements:
@@ -144,13 +145,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
145
  version: '0'
145
146
  segments:
146
147
  - 0
147
- hash: 772110449
148
+ hash: -312039377
148
149
  requirements: []
149
150
  rubyforge_project:
150
- rubygems_version: 1.8.24
151
+ rubygems_version: 1.8.29
151
152
  signing_key:
152
153
  specification_version: 3
153
- summary: Provides an easy way to build a cucumber commandline.
154
+ summary: Command Cucumber
154
155
  test_files:
155
156
  - features/command_line_format.feature
156
157
  - features/cucumber_options.feature