Skip to content

Commit

Permalink
Remove --dotcucumber. No longer generate stepdefs.json.
Browse files Browse the repository at this point in the history
This feature was added a long time ago to support autocomplete in
3rd party tools. The only tool that has used the generated stepdefs.json
file is Cucumber Pro, which recently abandoned it. (Cucumber Pro will
receive the same metadata over an API, via a custom formatter).
  • Loading branch information
aslakhellesoy committed Sep 11, 2014
1 parent a0da6f2 commit b774ffd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 47 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ doc/
*.tgz
Gemfile.lock
tags
features/.cucumber/stepdefs.json
.ruby-version
.project
4 changes: 4 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [In Git](https://github.com/cucumber/cucumber/compare/v.2.0.0.beta.2...master)

### Removed Features

* The `--dotcucumber` option is no longer supported and `stepdefs.json` is no longer written. (Aslak Hellesøy)

### New Features

* Add TestCase#outline? for conditionals in Before / After hooks ([728](https://github.com/cucumber/cucumber/pull/728) [Erran Carey](https://github.com/erran))
Expand Down
4 changes: 0 additions & 4 deletions lib/cucumber/cli/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ def expand?
@options[:expand]
end

def dotcucumber
@options[:dotcucumber]
end

def snippet_type
@options[:snippet_type] || :regexp
end
Expand Down
1 change: 0 additions & 1 deletion lib/cucumber/cli/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def execute!(existing_runtime = nil)
end

runtime.run!
runtime.write_stepdefs_json
failure = runtime.results.failure? || Cucumber.wants_to_quit
@kernel.exit(failure ? 1 : 0)
rescue FileNotFoundException => e
Expand Down
3 changes: 0 additions & 3 deletions lib/cucumber/cli/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ def parse!(args)
opts.on("-x", "--expand", "Expand Scenario Outline Tables in output.") do
@options[:expand] = true
end
opts.on("--dotcucumber DIR", "Write metadata to DIR") do |dir|
@options[:dotcucumber] = dir
end
opts.on("--order TYPE[:SEED]", "Run examples in the specified order. Available types:",
*<<-TEXT.split("\n")) do |order|
[defined] Run scenarios in the order they were defined (default).
Expand Down
38 changes: 0 additions & 38 deletions lib/cucumber/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,44 +157,6 @@ def unknown_programming_language?
@support_code.unknown_programming_language?
end

# TODO: this code is untested
def write_stepdefs_json
if(@configuration.dotcucumber)
stepdefs = []
@support_code.step_definitions.sort{|a,b| a.to_hash['source'] <=> a.to_hash['source']}.each do |stepdef|
stepdef_hash = stepdef.to_hash
steps = []
features.each do |feature|
feature.feature_elements.each do |feature_element|
feature_element.raw_steps.each do |step|
args = stepdef.arguments_from(step.name)
if(args)
steps << {
'name' => step.name,
'args' => args.map do |arg|
{
'offset' => arg.offset,
'val' => arg.val
}
end
}
end
end
end
end
stepdef_hash['file_colon_line'] = stepdef.file_colon_line
stepdef_hash['steps'] = steps.uniq.sort {|a,b| a['name'] <=> b['name']}
stepdefs << stepdef_hash
end
if !File.directory?(@configuration.dotcucumber)
FileUtils.mkdir_p(@configuration.dotcucumber)
end
File.open(File.join(@configuration.dotcucumber, 'stepdefs.json'), 'w') do |io|
io.write(MultiJson.dump(stepdefs, :pretty => true))
end
end
end

# Returns Ast::DocString for +string_without_triple_quotes+.
#
def doc_string(string_without_triple_quotes, content_type='', line_offset=0)
Expand Down

0 comments on commit b774ffd

Please sign in to comment.