add some tasks
This commit is contained in:
parent
85140c135d
commit
2afcc53b75
2
lib/cuke-pack/tasks.rb
Normal file
2
lib/cuke-pack/tasks.rb
Normal file
@ -0,0 +1,2 @@
|
||||
require 'cuke-pack/tasks/any_wip'
|
||||
|
23
lib/cuke-pack/tasks/any_wip.rb
Normal file
23
lib/cuke-pack/tasks/any_wip.rb
Normal file
@ -0,0 +1,23 @@
|
||||
namespace :cuke_pack do
|
||||
desc "Raise an exception if any tasks are marked @wip"
|
||||
task :any_wip do
|
||||
require 'gherkin/parser/parser'
|
||||
require 'gherkin/formatter/json_formatter'
|
||||
require 'gherkin/formatter/tag_count_formatter'
|
||||
|
||||
io = StringIO.new
|
||||
counts = {}
|
||||
json_formatter = Gherkin::Formatter::JSONFormatter.new(io)
|
||||
formatter = Gherkin::Formatter::TagCountFormatter.new(json_formatter, counts)
|
||||
parser = Gherkin::Parser::Parser.new(formatter)
|
||||
|
||||
Dir['features/**/*.feature'].each do |file|
|
||||
parser.parse(File.read(file), file, 0)
|
||||
end
|
||||
|
||||
if counts['@wip']
|
||||
raise StandardError.new("@wip occurred in the following files:\n#{counts['@wip'].join("\n")}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user