square-cucumber 0.3.12.2 → 0.3.93.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/History.txt +117 -4
- data/Manifest.txt +11 -0
- data/Rakefile +1 -1
- data/config/hoe.rb +3 -2
- data/cucumber.yml +2 -2
- data/examples/i18n/ko/features/addition.feature +5 -5
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/pt/features/adicao.feature +4 -4
- data/examples/self_test/features/support/env.rb +2 -1
- data/examples/sinatra/features/support/env.rb +7 -1
- data/examples/steps_library/features/step_definitions/steps_lib1.rb +8 -0
- data/examples/steps_library/features/step_definitions/steps_lib2.rb +8 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +15 -0
- data/examples/tickets/features/table_diffing.feature +13 -0
- data/examples/watir/features/step_definitons/search_steps.rb +5 -1
- data/features/cucumber_cli_diff_disabled.feature +2 -1
- data/features/html_formatter/a.html +5 -7
- data/features/junit_formatter.feature +21 -14
- data/features/profiles.feature +99 -0
- data/features/rake_task.feature +28 -0
- data/features/step_definitions/cucumber_steps.rb +28 -15
- data/features/steps_formatter.feature +25 -0
- data/features/support/env.rb +9 -5
- data/features/table_diffing.feature +45 -0
- data/features/unicode_table.feature +35 -0
- data/features/work_in_progress.feature +1 -0
- data/gem_tasks/contributors.rake +4 -0
- data/lib/cucumber/ast/background.rb +1 -0
- data/lib/cucumber/ast/comment.rb +1 -0
- data/lib/cucumber/ast/examples.rb +1 -0
- data/lib/cucumber/ast/feature.rb +10 -0
- data/lib/cucumber/ast/features.rb +6 -1
- data/lib/cucumber/ast/outline_table.rb +4 -1
- data/lib/cucumber/ast/py_string.rb +1 -1
- data/lib/cucumber/ast/scenario.rb +1 -0
- data/lib/cucumber/ast/scenario_outline.rb +2 -0
- data/lib/cucumber/ast/step.rb +5 -1
- data/lib/cucumber/ast/step_collection.rb +1 -0
- data/lib/cucumber/ast/step_invocation.rb +1 -0
- data/lib/cucumber/ast/table.rb +306 -52
- data/lib/cucumber/ast/tags.rb +1 -0
- data/lib/cucumber/ast/visitor.rb +2 -1
- data/lib/cucumber/cli/configuration.rb +28 -278
- data/lib/cucumber/cli/drb_client.rb +3 -1
- data/lib/cucumber/cli/language_help_formatter.rb +9 -7
- data/lib/cucumber/cli/main.rb +16 -2
- data/lib/cucumber/cli/options.rb +370 -0
- data/lib/cucumber/cli/profile_loader.rb +65 -0
- data/lib/cucumber/core_ext/instance_exec.rb +8 -5
- data/lib/cucumber/feature_file.rb +7 -1
- data/lib/cucumber/filter.rb +2 -2
- data/lib/cucumber/formatter/ansicolor.rb +42 -9
- data/lib/cucumber/formatter/console.rb +1 -1
- data/lib/cucumber/formatter/html.rb +12 -10
- data/lib/cucumber/formatter/junit.rb +63 -26
- data/lib/cucumber/formatter/pretty.rb +20 -5
- data/lib/cucumber/formatter/progress.rb +1 -1
- data/lib/cucumber/formatter/steps.rb +49 -0
- data/lib/cucumber/languages.yml +6 -6
- data/lib/cucumber/parser/feature.rb +90 -63
- data/lib/cucumber/parser/feature.tt +28 -1
- data/lib/cucumber/parser/i18n/language.rb +12 -5
- data/lib/cucumber/parser/table.rb +25 -25
- data/lib/cucumber/rake/task.rb +9 -3
- data/lib/cucumber/step_definition.rb +1 -1
- data/lib/cucumber/step_match.rb +1 -1
- data/lib/cucumber/step_mother.rb +3 -1
- data/lib/cucumber/version.rb +2 -2
- data/lib/cucumber/webrat/table_locator.rb +66 -0
- data/rails_generators/cucumber/cucumber_generator.rb +5 -1
- data/rails_generators/cucumber/templates/cucumber +3 -2
- data/rails_generators/cucumber/templates/cucumber.rake +18 -6
- data/rails_generators/cucumber/templates/cucumber_environment.rb +7 -4
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/cucumber/templates/spork_env.rb +1 -0
- data/rails_generators/cucumber/templates/webrat_steps.rb +22 -0
- data/rails_generators/feature/templates/feature.erb +1 -1
- data/rails_generators/feature/templates/steps.erb +2 -8
- data/spec/cucumber/ast/table_spec.rb +169 -0
- data/spec/cucumber/cli/configuration_spec.rb +144 -101
- data/spec/cucumber/cli/main_spec.rb +14 -5
- data/spec/cucumber/cli/options_spec.rb +311 -0
- data/spec/cucumber/cli/profile_loader_spec.rb +10 -0
- data/spec/cucumber/core_ext/proc_spec.rb +16 -2
- data/spec/cucumber/formatter/html_spec.rb +18 -0
- data/spec/cucumber/formatter/progress_spec.rb +2 -2
- data/spec/cucumber/parser/table_parser_spec.rb +1 -1
- data/spec/spec.opts +3 -1
- metadata +18 -4
- data/lib/cucumber/webrat/mechanize_world.rb +0 -82
data/lib/cucumber/ast/tags.rb
CHANGED
data/lib/cucumber/ast/visitor.rb
CHANGED
@@ -64,6 +64,7 @@ module Cucumber
|
|
64
64
|
end
|
65
65
|
|
66
66
|
def visit_outline_table(outline_table)
|
67
|
+
@table = outline_table
|
67
68
|
outline_table.accept(self)
|
68
69
|
end
|
69
70
|
|
@@ -105,7 +106,7 @@ module Cucumber
|
|
105
106
|
table_cell.accept(self)
|
106
107
|
end
|
107
108
|
|
108
|
-
def visit_table_cell_value(value,
|
109
|
+
def visit_table_cell_value(value, status)
|
109
110
|
end
|
110
111
|
|
111
112
|
def announce(announcement)
|
@@ -1,198 +1,29 @@
|
|
1
|
+
require 'cucumber/cli/options'
|
2
|
+
|
1
3
|
module Cucumber
|
2
4
|
module Cli
|
3
5
|
class YmlLoadError < StandardError; end
|
6
|
+
class ProfilesNotDefinedError < YmlLoadError; end
|
7
|
+
class ProfileNotFound < StandardError; end
|
4
8
|
|
5
9
|
class Configuration
|
6
|
-
BUILTIN_FORMATS = {
|
7
|
-
'html' => 'Cucumber::Formatter::Html',
|
8
|
-
'pretty' => 'Cucumber::Formatter::Pretty',
|
9
|
-
'profile' => 'Cucumber::Formatter::Profile',
|
10
|
-
'progress' => 'Cucumber::Formatter::Progress',
|
11
|
-
'rerun' => 'Cucumber::Formatter::Rerun',
|
12
|
-
'usage' => 'Cucumber::Formatter::Usage',
|
13
|
-
'junit' => 'Cucumber::Formatter::Junit',
|
14
|
-
'tag_cloud' => 'Cucumber::Formatter::TagCloud',
|
15
|
-
'steps' => 'Cucumber::Formatter::Steps'
|
16
|
-
}
|
17
|
-
DRB_FLAG = '--drb'
|
18
|
-
PROFILE_SHORT_FLAG = '-p'
|
19
|
-
PROFILE_LONG_FLAG = '--profile'
|
20
|
-
|
21
|
-
attr_reader :paths
|
22
10
|
attr_reader :options
|
23
11
|
|
24
12
|
def initialize(out_stream = STDOUT, error_stream = STDERR)
|
25
13
|
@out_stream = out_stream
|
26
14
|
@error_stream = error_stream
|
27
|
-
|
28
|
-
@paths = []
|
29
|
-
@options = default_options
|
15
|
+
@options = Options.new(@out_stream, @error_stream, :default_profile => 'default')
|
30
16
|
end
|
31
17
|
|
32
18
|
def parse!(args)
|
33
|
-
args.concat(%w{--profile default}) if args.empty?
|
34
19
|
@args = args
|
35
|
-
|
36
|
-
|
20
|
+
@options.parse!(args)
|
21
|
+
raise("You can't use both --strict and --wip") if strict? && wip?
|
37
22
|
|
38
|
-
@args.
|
39
|
-
if arg =~ /^(\w+)=(.*)$/
|
40
|
-
ENV[$1] = $2
|
41
|
-
@args.delete(arg)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
@args.extend(::OptionParser::Arguable)
|
46
|
-
|
47
|
-
@args.options do |opts|
|
48
|
-
opts.banner = ["Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+", "",
|
49
|
-
"Examples:",
|
50
|
-
"cucumber examples/i18n/en/features",
|
51
|
-
"cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
|
52
|
-
"cucumber -s -i http://rubyurl.com/eeCl", "", "",
|
53
|
-
].join("\n")
|
54
|
-
opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
|
55
|
-
"Require files before executing the features. If this",
|
56
|
-
"option is not specified, all *.rb files that are",
|
57
|
-
"siblings or below the features will be loaded auto-",
|
58
|
-
"matically. Automatic loading is disabled when this",
|
59
|
-
"option is specified, and all loading becomes explicit.",
|
60
|
-
"Files under directories named \"support\" are always",
|
61
|
-
"loaded first.",
|
62
|
-
"This option can be specified multiple times.") do |v|
|
63
|
-
@options[:require] ||= []
|
64
|
-
@options[:require] << v
|
65
|
-
end
|
66
|
-
opts.on("-l LANG", "--language LANG",
|
67
|
-
"Specify language for features (Default: #{@options[:lang]})",
|
68
|
-
%{Run with "--language help" to see all languages},
|
69
|
-
%{Run with "--language LANG help" to list keywords for LANG}) do |v|
|
70
|
-
if v == 'help'
|
71
|
-
list_languages_and_exit
|
72
|
-
elsif args==['help']
|
73
|
-
list_keywords_and_exit(v)
|
74
|
-
else
|
75
|
-
@options[:lang] = v
|
76
|
-
end
|
77
|
-
end
|
78
|
-
opts.on("-f FORMAT", "--format FORMAT",
|
79
|
-
"How to format features (Default: pretty)",
|
80
|
-
"Available formats: #{BUILTIN_FORMATS.keys.sort.join(", ")}",
|
81
|
-
"FORMAT can also be the fully qualified class name of",
|
82
|
-
"your own custom formatter. If the class isn't loaded,",
|
83
|
-
"Cucumber will attempt to require a file with a relative",
|
84
|
-
"file name that is the underscore name of the class name.",
|
85
|
-
"Example: --format Foo::BarZap -> Cucumber will look for",
|
86
|
-
"foo/bar_zap.rb. You can place the file with this relative",
|
87
|
-
"path underneath your features/support directory or anywhere",
|
88
|
-
"on Ruby's LOAD_PATH, for example in a Ruby gem.") do |v|
|
89
|
-
@options[:formats] << [v, @out_stream]
|
90
|
-
@active_format = v
|
91
|
-
end
|
92
|
-
opts.on("-o", "--out [FILE|DIR]",
|
93
|
-
"Write output to a file/directory instead of STDOUT. This option",
|
94
|
-
"applies to the previously specified --format, or the",
|
95
|
-
"default format if no format is specified. Check the specific",
|
96
|
-
"formatter's docs to see whether to pass a file or a dir.") do |v|
|
97
|
-
@options[:formats] << ['pretty', nil] if @options[:formats].empty?
|
98
|
-
@options[:formats][-1][1] = v
|
99
|
-
end
|
100
|
-
opts.on("-t TAGS", "--tags TAGS",
|
101
|
-
"Only execute the features or scenarios with the specified tags.",
|
102
|
-
"TAGS must be comma-separated without spaces. Prefix tags with ~ to",
|
103
|
-
"exclude features or scenarios having that tag. Tags can be specified",
|
104
|
-
"with or without the @ prefix.") do |v|
|
105
|
-
@options[:include_tags], @options[:exclude_tags] = *parse_tags(v)
|
106
|
-
end
|
107
|
-
opts.on("-n NAME", "--name NAME",
|
108
|
-
"Only execute the feature elements which match part of the given name.",
|
109
|
-
"If this option is given more than once, it will match against all the",
|
110
|
-
"given names.") do |v|
|
111
|
-
@options[:name_regexps] << /#{v}/
|
112
|
-
end
|
113
|
-
opts.on("-e", "--exclude PATTERN", "Don't run feature files or require ruby files matching PATTERN") do |v|
|
114
|
-
@options[:excludes] << Regexp.new(v)
|
115
|
-
end
|
116
|
-
opts.on(PROFILE_SHORT_FLAG, "#{PROFILE_LONG_FLAG} PROFILE", "Pull commandline arguments from cucumber.yml.") do |v|
|
117
|
-
# Processing of this is done previsouly so that the DRb flag can be detected within profiles.
|
118
|
-
end
|
119
|
-
opts.on("-c", "--[no-]color",
|
120
|
-
"Whether or not to use ANSI color in the output. Cucumber decides",
|
121
|
-
"based on your platform and the output destination if not specified.") do |v|
|
122
|
-
Term::ANSIColor.coloring = v
|
123
|
-
end
|
124
|
-
opts.on("-d", "--dry-run", "Invokes formatters without executing the steps.",
|
125
|
-
"This also omits the loading of your support/env.rb file if it exists.",
|
126
|
-
"Implies --quiet.") do
|
127
|
-
@options[:dry_run] = true
|
128
|
-
@quiet = true
|
129
|
-
end
|
130
|
-
opts.on("-a", "--autoformat DIRECTORY",
|
131
|
-
"Reformats (pretty prints) feature files and write them to DIRECTORY.",
|
132
|
-
"Be careful if you choose to overwrite the originals.",
|
133
|
-
"Implies --dry-run --formatter pretty.") do |directory|
|
134
|
-
@options[:autoformat] = directory
|
135
|
-
Term::ANSIColor.coloring = false
|
136
|
-
@options[:dry_run] = true
|
137
|
-
@quiet = true
|
138
|
-
end
|
139
|
-
opts.on("-m", "--no-multiline",
|
140
|
-
"Don't print multiline strings and tables under steps.") do
|
141
|
-
@options[:no_multiline] = true
|
142
|
-
end
|
143
|
-
opts.on("-s", "--no-source",
|
144
|
-
"Don't print the file and line of the step definition with the steps.") do
|
145
|
-
@options[:source] = false
|
146
|
-
end
|
147
|
-
opts.on("-i", "--no-snippets", "Don't print snippets for pending steps.") do
|
148
|
-
@options[:snippets] = false
|
149
|
-
end
|
150
|
-
opts.on("-q", "--quiet", "Alias for --no-snippets --no-source.") do
|
151
|
-
@quiet = true
|
152
|
-
end
|
153
|
-
opts.on("-b", "--backtrace", "Show full backtrace for all errors.") do
|
154
|
-
Exception.cucumber_full_backtrace = true
|
155
|
-
end
|
156
|
-
opts.on("-S", "--strict", "Fail if there are any undefined steps.") do
|
157
|
-
@options[:strict] = true
|
158
|
-
end
|
159
|
-
opts.on("-w", "--wip", "Fail if there are any passing scenarios.") do
|
160
|
-
@options[:wip] = true
|
161
|
-
end
|
162
|
-
opts.on("-v", "--verbose", "Show the files and features loaded.") do
|
163
|
-
@options[:verbose] = true
|
164
|
-
end
|
165
|
-
opts.on("-g", "--guess", "Guess best match for Ambiguous steps.") do
|
166
|
-
@options[:guess] = true
|
167
|
-
end
|
168
|
-
opts.on("-x", "--expand", "Expand Scenario Outline Tables in output.") do
|
169
|
-
@options[:expand] = true
|
170
|
-
end
|
171
|
-
opts.on("--no-diff", "Disable diff output on failing expectations.") do
|
172
|
-
@options[:diff_enabled] = false
|
173
|
-
end
|
174
|
-
opts.on(DRB_FLAG, "Run features against a DRb server. (i.e. with the spork gem)") do
|
175
|
-
# Processing of this is done previsouly in order to short circuit args from being lost.
|
176
|
-
end
|
177
|
-
opts.on_tail("--version", "Show version.") do
|
178
|
-
@out_stream.puts VERSION::STRING
|
179
|
-
Kernel.exit
|
180
|
-
end
|
181
|
-
opts.on_tail("-h", "--help", "You're looking at it.") do
|
182
|
-
@out_stream.puts opts.help
|
183
|
-
Kernel.exit
|
184
|
-
end
|
185
|
-
end.parse!
|
23
|
+
return @args.replace(@options.expanded_args_without_drb) if drb?
|
186
24
|
|
25
|
+
set_environment_variables
|
187
26
|
arrange_formats
|
188
|
-
|
189
|
-
@options[:snippets] = true if !@quiet && @options[:snippets].nil?
|
190
|
-
@options[:source] = true if !@quiet && @options[:source].nil?
|
191
|
-
|
192
|
-
raise("You can't use both --strict and --wip") if @options[:strict] && @options[:wip]
|
193
|
-
|
194
|
-
# Whatever is left after option parsing is the FILE arguments
|
195
|
-
@paths += @args
|
196
27
|
end
|
197
28
|
|
198
29
|
def verbose?
|
@@ -216,18 +47,11 @@ module Cucumber
|
|
216
47
|
end
|
217
48
|
|
218
49
|
def drb?
|
219
|
-
@drb
|
50
|
+
@options[:drb]
|
220
51
|
end
|
221
52
|
|
222
|
-
def
|
223
|
-
|
224
|
-
excludes, includes = tag_names.partition{|tag| tag =~ /^~/}
|
225
|
-
excludes = excludes.map{|tag| tag[1..-1]}
|
226
|
-
|
227
|
-
# Strip @
|
228
|
-
includes = includes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
229
|
-
excludes = excludes.map{|tag| Ast::Tags.strip_prefix(tag)}
|
230
|
-
[includes, excludes]
|
53
|
+
def paths
|
54
|
+
@options[:paths]
|
231
55
|
end
|
232
56
|
|
233
57
|
def build_formatter_broadcaster(step_mother)
|
@@ -260,15 +84,15 @@ module Cucumber
|
|
260
84
|
end
|
261
85
|
|
262
86
|
def formatter_class(format)
|
263
|
-
if(builtin = BUILTIN_FORMATS[format])
|
264
|
-
constantize(builtin)
|
87
|
+
if(builtin = Options::BUILTIN_FORMATS[format])
|
88
|
+
constantize(builtin[0])
|
265
89
|
else
|
266
90
|
constantize(format)
|
267
91
|
end
|
268
92
|
end
|
269
93
|
|
270
94
|
def files_to_require
|
271
|
-
requires = @options[:require]
|
95
|
+
requires = @options[:require].empty? ? require_dirs : @options[:require]
|
272
96
|
files = requires.map do |path|
|
273
97
|
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
274
98
|
path = path.gsub(/\/$/, '') # Strip trailing slash.
|
@@ -283,7 +107,7 @@ module Cucumber
|
|
283
107
|
end
|
284
108
|
|
285
109
|
def feature_files
|
286
|
-
potential_feature_files = @paths.map do |path|
|
110
|
+
potential_feature_files = @options[:paths].map do |path|
|
287
111
|
path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
|
288
112
|
path = path.chomp('/')
|
289
113
|
File.directory?(path) ? Dir["#{path}/**/*.feature"] : path
|
@@ -292,7 +116,13 @@ module Cucumber
|
|
292
116
|
potential_feature_files
|
293
117
|
end
|
294
118
|
|
295
|
-
|
119
|
+
private
|
120
|
+
|
121
|
+
def set_environment_variables
|
122
|
+
@options[:env_vars].each do |var, value|
|
123
|
+
ENV[var] = value
|
124
|
+
end
|
125
|
+
end
|
296
126
|
|
297
127
|
def arrange_formats
|
298
128
|
@options[:formats] << ['pretty', @out_stream] if @options[:formats].empty?
|
@@ -307,7 +137,11 @@ module Cucumber
|
|
307
137
|
end
|
308
138
|
|
309
139
|
def feature_dirs
|
310
|
-
|
140
|
+
paths.map { |f| File.directory?(f) ? f : File.dirname(f) }.uniq
|
141
|
+
end
|
142
|
+
|
143
|
+
def require_dirs
|
144
|
+
feature_dirs + Dir['vendor/{gems,plugins}/*/cucumber']
|
311
145
|
end
|
312
146
|
|
313
147
|
def constantize(camel_cased_word)
|
@@ -335,90 +169,6 @@ module Cucumber
|
|
335
169
|
downcase
|
336
170
|
end
|
337
171
|
|
338
|
-
def expand_profiles_into_args
|
339
|
-
while (profile_index = @args.index(PROFILE_SHORT_FLAG) || @args.index(PROFILE_LONG_FLAG)) do
|
340
|
-
@args.delete_at(profile_index)
|
341
|
-
@args[profile_index] = args_from_profile(@args[profile_index])
|
342
|
-
@args.flatten!
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
def args_from_profile(profile)
|
347
|
-
unless cucumber_yml.has_key?(profile)
|
348
|
-
raise(<<-END_OF_ERROR)
|
349
|
-
Could not find profile: '#{profile}'
|
350
|
-
|
351
|
-
Defined profiles in cucumber.yml:
|
352
|
-
* #{cucumber_yml.keys.join("\n * ")}
|
353
|
-
END_OF_ERROR
|
354
|
-
end
|
355
|
-
|
356
|
-
args_from_yml = cucumber_yml[profile] || ''
|
357
|
-
|
358
|
-
case(args_from_yml)
|
359
|
-
when String
|
360
|
-
raise "The '#{profile}' profile in cucumber.yml was blank. Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml =~ /^\s*$/
|
361
|
-
args_from_yml = args_from_yml.split(' ')
|
362
|
-
when Array
|
363
|
-
raise "The '#{profile}' profile in cucumber.yml was empty. Please define the command line arguments for the '#{profile}' profile in cucumber.yml.\n" if args_from_yml.empty?
|
364
|
-
else
|
365
|
-
raise "The '#{profile}' profile in cucumber.yml was a #{args_from_yml.class}. It must be a String or Array"
|
366
|
-
end
|
367
|
-
args_from_yml
|
368
|
-
end
|
369
|
-
|
370
|
-
def cucumber_yml
|
371
|
-
return @cucumber_yml if @cucumber_yml
|
372
|
-
unless File.exist?('cucumber.yml')
|
373
|
-
raise(YmlLoadError,"cucumber.yml was not found. Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
|
374
|
-
end
|
375
|
-
|
376
|
-
require 'yaml'
|
377
|
-
begin
|
378
|
-
@cucumber_yml = YAML::load(IO.read('cucumber.yml'))
|
379
|
-
rescue StandardError => e
|
380
|
-
raise(YmlLoadError,"cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
|
381
|
-
end
|
382
|
-
|
383
|
-
if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
|
384
|
-
raise(YmlLoadError,"cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentation on correct profile usage.\n")
|
385
|
-
end
|
386
|
-
|
387
|
-
return @cucumber_yml
|
388
|
-
end
|
389
|
-
|
390
|
-
# TODO: Move to Language
|
391
|
-
def list_keywords_and_exit(lang)
|
392
|
-
unless Cucumber::LANGUAGES[lang]
|
393
|
-
raise("No language with key #{lang}")
|
394
|
-
end
|
395
|
-
LanguageHelpFormatter.list_keywords(@out_stream, lang)
|
396
|
-
Kernel.exit
|
397
|
-
end
|
398
|
-
|
399
|
-
def list_languages_and_exit
|
400
|
-
LanguageHelpFormatter.list_languages(@out_stream)
|
401
|
-
Kernel.exit
|
402
|
-
end
|
403
|
-
|
404
|
-
def parse_drb
|
405
|
-
@drb = @args.delete(DRB_FLAG) ? true : false
|
406
|
-
end
|
407
|
-
|
408
|
-
def default_options
|
409
|
-
{
|
410
|
-
:strict => false,
|
411
|
-
:require => nil,
|
412
|
-
:lang => nil,
|
413
|
-
:dry_run => false,
|
414
|
-
:formats => [],
|
415
|
-
:excludes => [],
|
416
|
-
:include_tags => [],
|
417
|
-
:exclude_tags => [],
|
418
|
-
:name_regexps => [],
|
419
|
-
:diff_enabled => true
|
420
|
-
}
|
421
|
-
end
|
422
172
|
end
|
423
173
|
|
424
174
|
end
|
@@ -11,7 +11,9 @@ module Cucumber
|
|
11
11
|
# See http://redmine.ruby-lang.org/issues/show/496 as to why we specify localhost:0
|
12
12
|
DRb.start_service("druby://localhost:0")
|
13
13
|
feature_server = DRbObject.new_with_uri("druby://127.0.0.1:8990")
|
14
|
-
|
14
|
+
cloned_args = [] # I have no idea why this is needed, but if the regular args are sent then DRb magically transforms it into a DRb object - not an array
|
15
|
+
args.each { |arg| cloned_args << arg }
|
16
|
+
feature_server.run(cloned_args, error_stream, out_stream)
|
15
17
|
rescue DRb::DRbConnError
|
16
18
|
raise DRbClientError, "No DRb server is running."
|
17
19
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'cucumber/formatter/pretty'
|
2
|
+
require 'cucumber/parser/i18n/language'
|
2
3
|
|
3
4
|
module Cucumber
|
4
5
|
module Cli
|
@@ -18,15 +19,16 @@ http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages
|
|
18
19
|
[lang, Cucumber::LANGUAGES[lang]['name'], Cucumber::LANGUAGES[lang]['native']]
|
19
20
|
end
|
20
21
|
table = Ast::Table.new(raw)
|
21
|
-
new(nil, io, {:check_lang=>true}
|
22
|
+
new(nil, io, {:check_lang=>true}).visit_multiline_arg(table)
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.list_keywords(io, lang)
|
25
|
-
|
26
|
-
|
26
|
+
language = Parser::I18n::Language[lang]
|
27
|
+
raw = Parser::I18n::Language::KEYWORD_KEYS.map do |key|
|
28
|
+
[key, language.keywords(key)]
|
27
29
|
end
|
28
30
|
table = Ast::Table.new(raw)
|
29
|
-
new(nil, io, {:incomplete =>
|
31
|
+
new(nil, io, {:incomplete => language.incomplete?}).visit_multiline_arg(table)
|
30
32
|
end
|
31
33
|
|
32
34
|
def visit_multiline_arg(table)
|
@@ -41,10 +43,10 @@ http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages
|
|
41
43
|
super
|
42
44
|
end
|
43
45
|
|
44
|
-
def visit_table_cell_value(value,
|
46
|
+
def visit_table_cell_value(value, status)
|
45
47
|
if @col == 1
|
46
48
|
if(@options[:check_lang])
|
47
|
-
@incomplete =
|
49
|
+
@incomplete = Parser::I18n::Language[value].incomplete?
|
48
50
|
end
|
49
51
|
status = :comment
|
50
52
|
elsif @incomplete
|
@@ -52,7 +54,7 @@ http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages
|
|
52
54
|
end
|
53
55
|
|
54
56
|
@col += 1
|
55
|
-
super(value,
|
57
|
+
super(value, status)
|
56
58
|
end
|
57
59
|
end
|
58
60
|
end
|