cuker 0.3.15
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.
- checksums.yaml +7 -0
- data/.gitignore +71 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +0 -0
- data/Gemfile +16 -0
- data/LICENSE +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/cuker.gemspec +43 -0
- data/lib/cuker.rb +7 -0
- data/lib/cuker/gherkin_lexer.rb +33 -0
- data/lib/cuker/gherkin_parser.rb +23 -0
- data/lib/cuker/gherkin_reporter.rb +85 -0
- data/lib/cuker/gherkin_ripper.rb +67 -0
- data/lib/cuker/gp.rb +82 -0
- data/lib/cuker/helper/file_helper.rb +14 -0
- data/lib/cuker/helper/gherkin_helper.rb +28 -0
- data/lib/cuker/high.rb +57 -0
- data/lib/cuker/log_utils.rb +88 -0
- data/lib/cuker/models/model_try.rb +30 -0
- data/lib/cuker/models/models_forming.rb +65 -0
- data/lib/cuker/models/models_ready.rb +132 -0
- data/lib/cuker/models/state.rb +3 -0
- data/lib/cuker/state/in_background.rb +0 -0
- data/lib/cuker/state/in_comment.rb +3 -0
- data/lib/cuker/state/in_feature.rb +0 -0
- data/lib/cuker/state/in_scenario.rb +0 -0
- data/lib/cuker/state/in_scenario_outline.rb +0 -0
- data/lib/cuker/state/in_table.rb +0 -0
- data/lib/cuker/state/in_tag.rb +0 -0
- data/lib/cuker/version.rb +3 -0
- data/lib/cuker/writer_helper/_interfact.rb +7 -0
- data/lib/cuker/writer_helper/abstract_model.rb +37 -0
- data/lib/cuker/writer_helper/abstract_writer.rb +77 -0
- data/lib/cuker/writer_helper/csv_model.rb +148 -0
- data/lib/cuker/writer_helper/csv_writer.rb +59 -0
- data/lib/cuker/writer_helper/jira_model.rb +174 -0
- data/lib/cuker/writer_helper/jira_writer.rb +55 -0
- data/lib/cuker/writer_helper/ruby_x_l_writer.rb +32 -0
- data/lib/cuker/writer_helper/title.rb +14 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8dea6f1d74926122a091f9d183bf99e986dc262837b8c9c4f07f8896481f9b91
|
4
|
+
data.tar.gz: a6df0acfc07e13568d9389337457a8a0066f3c7ea713abf786183ff6109f46e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3ecbbc946d9b0a2841c90cd095c7361d8e1d7bc8261eea31de6854b6b5b568dba3484dd96573aa55685261f56e857d500611476139e9a9a9a9e46121013f485e
|
7
|
+
data.tar.gz: 33bd0377c5b3711873c942e339dcf1ef43d435996d3f18586e8493b740818e588723a1110838faefc397e66207ba0b28da8ccccfd083f5fbb8b51e153bfa8446
|
data/.gitignore
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# Github ignores
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
## Specific to RubyMotion:
|
18
|
+
.dat*
|
19
|
+
.repl_history
|
20
|
+
build/
|
21
|
+
*.bridgesupport
|
22
|
+
build-iPhoneOS/
|
23
|
+
build-iPhoneSimulator/
|
24
|
+
|
25
|
+
## Specific to RubyMotion (use of CocoaPods):
|
26
|
+
#
|
27
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
28
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
29
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
30
|
+
#
|
31
|
+
# vendor/Pods/
|
32
|
+
|
33
|
+
## Documentation cache and generated files:
|
34
|
+
/.yardoc/
|
35
|
+
/_yardoc/
|
36
|
+
/doc/
|
37
|
+
/rdoc/
|
38
|
+
|
39
|
+
## Environment normalization:
|
40
|
+
/.bundle/
|
41
|
+
/vendor/bundle
|
42
|
+
/lib/bundler/man/
|
43
|
+
|
44
|
+
# for a library or gem, you might want to ignore these files since the code is
|
45
|
+
# intended to run in multiple environments; otherwise, check them in:
|
46
|
+
# Gemfile.lock
|
47
|
+
# .ruby-version
|
48
|
+
# .ruby-gemset
|
49
|
+
|
50
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
51
|
+
.rvmrc
|
52
|
+
|
53
|
+
# Bundle ignores
|
54
|
+
|
55
|
+
/.bundle/
|
56
|
+
/.yardoc
|
57
|
+
/_yardoc/
|
58
|
+
/coverage/
|
59
|
+
/doc/
|
60
|
+
/pkg/
|
61
|
+
/spec/reports/
|
62
|
+
/tmp/
|
63
|
+
|
64
|
+
# rspec failure tracking
|
65
|
+
.rspec_status
|
66
|
+
|
67
|
+
|
68
|
+
# My ignores
|
69
|
+
|
70
|
+
.idea/*
|
71
|
+
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
File without changes
|
data/Gemfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in cuker.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
|
7
|
+
# core
|
8
|
+
gem 'rspec'
|
9
|
+
gem 'logging'
|
10
|
+
gem 'require_all'
|
11
|
+
gem 'awesome_print'
|
12
|
+
gem 'gherkin', '~> 5.1'
|
13
|
+
|
14
|
+
# ext
|
15
|
+
gem 'thor'
|
16
|
+
gem 'highline'
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Naren SivaSubramani
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 ufo2mstar
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Cuker
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/cuker`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'cuker'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install cuker
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/cuker.
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "cuker"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/cuker.gemspec
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "cuker/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "cuker"
|
8
|
+
spec.version = Cuker::VERSION
|
9
|
+
spec.authors = ["ufo2mstar"]
|
10
|
+
spec.email = ["ufo2mstar@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Cucumber Summary Gem}
|
13
|
+
spec.description = %q{generates reports and gives some customizable formatting options}
|
14
|
+
spec.homepage = "https://github.com/ufo2mstar/cuker"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# # to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
# if spec.respond_to?(:metadata)
|
20
|
+
# # spec.metadata["allowed_push_host"] = "http://mygemserver.com"
|
21
|
+
#
|
22
|
+
# spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
# spec.metadata["source_code_uri"] = spec.homepage
|
24
|
+
# spec.metadata["changelog_uri"] = "https://github.com/ufo2mstar/cuker/blob/master/CHANGELOG.md"
|
25
|
+
# else
|
26
|
+
# raise "RubyGems 2.0 or newer is required to protect against " \
|
27
|
+
# "public gem pushes."
|
28
|
+
# end
|
29
|
+
|
30
|
+
# Specify which files should be added to the gem when it is released.
|
31
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
32
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
|
+
end
|
35
|
+
spec.bindir = "exe"
|
36
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
37
|
+
# gem.executables = ["cuker"]
|
38
|
+
spec.require_paths = ["lib"]
|
39
|
+
|
40
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
41
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
43
|
+
end
|
data/lib/cuker.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
module Cuker
|
2
|
+
class GherkinLexer
|
3
|
+
NonLexicalError = Class.new NotImplementedError
|
4
|
+
|
5
|
+
attr_reader :lexed_ary
|
6
|
+
attr :file_name
|
7
|
+
|
8
|
+
def initialize raw_str_ary, file_name = nil
|
9
|
+
@raw_strs_ary = raw_str_ary
|
10
|
+
@file_name = file_name
|
11
|
+
@lexed_ary = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def lex
|
15
|
+
# temp = nil
|
16
|
+
@raw_strs_ary.each_with_index do |raw_str, line_num|
|
17
|
+
res = case raw_str
|
18
|
+
when /^\s*#/
|
19
|
+
Comment.new raw_str
|
20
|
+
else
|
21
|
+
raise NonLexicalError.new "unable to lex line: #{line_num} :'#{raw_str}' #{"in file #{@file_name}" if @file_name}"
|
22
|
+
end
|
23
|
+
# if temp
|
24
|
+
# temp.items << Comment.new raw_str
|
25
|
+
# else
|
26
|
+
# temp = nil
|
27
|
+
# end
|
28
|
+
@lexed_ary << res
|
29
|
+
end
|
30
|
+
@lexed_ary
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'log_utils'
|
2
|
+
|
3
|
+
# = Parse Gherkins into my mental models
|
4
|
+
#
|
5
|
+
# Init Parser and get to action on a given location
|
6
|
+
# @
|
7
|
+
module Cuker
|
8
|
+
class GherkinParser
|
9
|
+
include LoggerSetup
|
10
|
+
|
11
|
+
attr_accessor :lex_ary
|
12
|
+
|
13
|
+
def initialize lex = []
|
14
|
+
init_logger
|
15
|
+
@lex_ary = lex
|
16
|
+
@log.trace "init parser for lexer with items: "
|
17
|
+
end
|
18
|
+
|
19
|
+
def parse
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require_relative 'log_utils'
|
2
|
+
# require 'writeexcel'
|
3
|
+
|
4
|
+
#= Write to Reports
|
5
|
+
#
|
6
|
+
# to write out all your parsed gherkins by tags etc..
|
7
|
+
# uses gem 'writeexcel'
|
8
|
+
class GherkinReporter
|
9
|
+
include LoggerSetup
|
10
|
+
|
11
|
+
attr_accessor :file_path, :workbook
|
12
|
+
|
13
|
+
def initialize(writer, model, loc, file_name = nil)
|
14
|
+
init_logger
|
15
|
+
|
16
|
+
@writer = writer
|
17
|
+
@model = model
|
18
|
+
|
19
|
+
@file_path = FileHelper.file_path(loc, "#{LOG_TIME_NOW}_#{file_name}")
|
20
|
+
@log.info "Report file => #{@file_name}#{@writer.ext}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def write
|
24
|
+
@writer.make_file @file_path
|
25
|
+
@writer.write_title @model.title
|
26
|
+
@model.data.each {|row| @writer.write_new_row row}
|
27
|
+
@file_path
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# def setup_report_file output_file_name
|
33
|
+
# states = %w[OH, WI, NY, SA]
|
34
|
+
# col_list = [:ignore, :mock, :run, :defect, :other]
|
35
|
+
#
|
36
|
+
# # output_file = "scen_UAT-reg_done_#{Time.now.strftime '%F_%H-%M-%S'}.xls"
|
37
|
+
# # output_file = name
|
38
|
+
# title_hai = ["Sl.No;4", "Type;4", "Title;60", states.map {|a| a + ";2"}, col_list.map {|a| "#{a};10"}, "Feature;10", "S.no;3", "File"].flatten
|
39
|
+
#
|
40
|
+
# File.open(output_file_name, 'wb')
|
41
|
+
# # workbook = WriteExcel.new(output_file_name)
|
42
|
+
# # worksheet = workbook.add_worksheet
|
43
|
+
# #
|
44
|
+
# # @format = workbook.add_format(:size => 10, :bold => 1); @format.set_align('center') #format.set_bold
|
45
|
+
# # @state_f = workbook.add_format(:size => 8, :align => "center") #@state_f.set_align('center')
|
46
|
+
# #
|
47
|
+
# #
|
48
|
+
# # worksheet.write('A1', title_hai.map {|itr| itr.split(";")[0]}, @format)
|
49
|
+
# # title_hai.each_with_index do |itr, i|
|
50
|
+
# # worksheet.set_column(i, i, itr.split(";")[1].to_i) if itr.split(";")[1]
|
51
|
+
# # end
|
52
|
+
# # workbook
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# def basic_write
|
56
|
+
# itr = 0
|
57
|
+
# $feat_stuff = {}
|
58
|
+
#
|
59
|
+
# col_recog = title_hai.map {|each| each.split(";")[0].downcase}
|
60
|
+
# # col_list =[:cit, :special, :delta, :rtc, :other]
|
61
|
+
# # col_list =$col_list
|
62
|
+
#
|
63
|
+
# $arr.each {|each_scen_tag|
|
64
|
+
# scen_info = each_scen_tag[0]
|
65
|
+
# ($feat_tags = scen_info; itr += 1; next) if itr == 0
|
66
|
+
#
|
67
|
+
# worksheet.write(@item_number, 0, @item_number, @format)
|
68
|
+
# worksheet.write(@item_number, 1, scen_info[:S_type][0].gsub(/cenario|utline/, ""))
|
69
|
+
# worksheet.write(@item_number, 2, scen_info[:S_title][0].to_s.force_encoding("UTF-8"))
|
70
|
+
#
|
71
|
+
# scen_info[:state].each do |st|
|
72
|
+
# worksheet.write(@item_number, col_recog.index(st.downcase), st, @state_f)
|
73
|
+
# #worksheet.write(@exc_no, 3+state_list[st].to_i, st, @state_f)
|
74
|
+
# #worksheet.write(@exc_no, 3+state_list[st].to_i, "X",@state_f)
|
75
|
+
# end
|
76
|
+
# col_list.each {|key| worksheet.write(@item_number, col_recog.index(key.to_s), scen_info[key].join(","))}
|
77
|
+
# worksheet.write(@item_number, title_hai.size - 3, $feat_tags[:S_title])
|
78
|
+
# worksheet.write(@item_number, title_hai.size - 2, itr, workbook.add_format(:size => 8, :align => "center"))
|
79
|
+
# worksheet.write(@item_number, title_hai.size - 1, file.gsub("features/scenarios", ""))
|
80
|
+
#
|
81
|
+
# @item_number += 1; itr += 1
|
82
|
+
# }
|
83
|
+
# end
|
84
|
+
|
85
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require_relative './helper/gherkin_helper'
|
2
|
+
|
3
|
+
# == Gherkin Ripper
|
4
|
+
# does lexing and parsing (building a simple ParseTree for Cucumber Gherkins)
|
5
|
+
# adding a few support methods to ripping
|
6
|
+
#
|
7
|
+
module Cuker
|
8
|
+
|
9
|
+
class GherkinRipper
|
10
|
+
include GherkinHelper
|
11
|
+
include LoggerSetup
|
12
|
+
|
13
|
+
NoFilesFoundError = Class.new IOError
|
14
|
+
|
15
|
+
attr_accessor :location
|
16
|
+
attr_accessor :features
|
17
|
+
# attr_reader :ast_map
|
18
|
+
|
19
|
+
def initialize path = '*'
|
20
|
+
init_logger
|
21
|
+
|
22
|
+
@location = path.strip
|
23
|
+
@location = '.' if @location.empty? # handle blank path searching all features
|
24
|
+
@features = get_features @location
|
25
|
+
|
26
|
+
@log.trace "Gherkin ripper running at #{path}"
|
27
|
+
|
28
|
+
@parser = Gherkin::Parser.new
|
29
|
+
@ast_map = {}
|
30
|
+
|
31
|
+
@log.info "Parsed '.feature' files @ #{path} = #{@features.size} files"
|
32
|
+
end
|
33
|
+
|
34
|
+
def ast_map
|
35
|
+
@ast_map = parse_all if @ast_map.empty?
|
36
|
+
@ast_map
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# if you need to ignore any pattern of files, change this regex to match those patterns
|
42
|
+
IGNORE_EXP = /^$/
|
43
|
+
|
44
|
+
# dir glob for all feature files
|
45
|
+
# @param location dir location of all the feature files
|
46
|
+
def get_features(path_or_file)
|
47
|
+
ext = '.feature'
|
48
|
+
files = FileHelper.get_files(path_or_file, ext, IGNORE_EXP)
|
49
|
+
files = FileHelper.get_file(path_or_file, ext, IGNORE_EXP) if files.empty?
|
50
|
+
raise NoFilesFoundError.new "No '#{ext}' files found @ path '#{path_or_file}'... " if files.empty?
|
51
|
+
files
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_all
|
55
|
+
parse_hsh = {}
|
56
|
+
@features.each do |feat|
|
57
|
+
feature_text = File.read(feat)
|
58
|
+
scanner = TokenScanner.new(feature_text)
|
59
|
+
parse_handle(feat) {
|
60
|
+
ast = @parser.parse(scanner)
|
61
|
+
parse_hsh[feat] = ast
|
62
|
+
}
|
63
|
+
end
|
64
|
+
parse_hsh
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|