cuker 0.3.15 → 0.3.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +16 -16
- data/cuker.gemspec +53 -43
- data/lib/cuker/cuker_cmd.rb +57 -0
- data/lib/cuker/high.rb +48 -43
- data/lib/cuker/version.rb +3 -3
- data/lib/cuker/writer_helper/abstract_model.rb +41 -2
- data/lib/cuker/writer_helper/abstract_writer.rb +1 -1
- data/lib/cuker/writer_helper/csv_model.rb +0 -17
- data/lib/cuker/writer_helper/csv_writer.rb +1 -1
- data/lib/cuker/writer_helper/jira_model.rb +95 -47
- data/lib/cuker/writer_helper/jira_writer.rb +10 -10
- data/lib/cuker.rb +6 -6
- metadata +87 -3
- data/lib/cuker/gp.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6b1d180c3c6993a9369242cbb2f1f8f5d445b99e9ea053b0b23a1c8b2afa015
|
4
|
+
data.tar.gz: 44f6f7ec50da9849b81c3f12b7149087073781d0bd802dcec5f6f05381a8df66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4242e860043fc50f7321d3dd157d372a12ea7f3b97187d07ddbb6645a71101de9b32ac3acbf2670355e803f3bda2395a388b14e52fa19b9fb24c86dddfb8092f
|
7
|
+
data.tar.gz: 37782b63570653d0115514017671247af1220e777ac54dca1b7940e6adbc0f8223b73cf8f66eb0c3583db2dfb5174b5ea388cc32b073c724105d37dbc9ab4efb
|
data/Gemfile
CHANGED
@@ -1,16 +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'
|
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/cuker.gemspec
CHANGED
@@ -1,43 +1,53 @@
|
|
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
|
-
|
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
|
+
|
44
|
+
spec.add_development_dependency "awesome_print"
|
45
|
+
# spec.add_development_dependency "bundler", "~> 2.0"
|
46
|
+
spec.add_development_dependency "gherkin", "~> 5.1"
|
47
|
+
spec.add_development_dependency "highline"
|
48
|
+
spec.add_development_dependency "logging"
|
49
|
+
# spec.add_development_dependency "rake", "~> 10.0"
|
50
|
+
spec.add_development_dependency "require_all"
|
51
|
+
spec.add_development_dependency "thor"
|
52
|
+
|
53
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
require 'require_all'
|
4
|
+
# require_all 'lib/cuker/**/*.rb'
|
5
|
+
# require_all 'lib/cuker/*.rb'
|
6
|
+
require_rel '**/*.rb'
|
7
|
+
require_rel '*.rb'
|
8
|
+
|
9
|
+
|
10
|
+
module Cuker
|
11
|
+
# module GPHelper
|
12
|
+
# def self.dash_print(ary)
|
13
|
+
# # ary.each {|x| puts " - '#{x}'"}
|
14
|
+
# end
|
15
|
+
# end
|
16
|
+
|
17
|
+
# class CukerCmd < Thor
|
18
|
+
class CukerCmd
|
19
|
+
include LoggerSetup
|
20
|
+
|
21
|
+
CONSTS = []
|
22
|
+
PRESETS = {
|
23
|
+
:simple_csv => [CsvModel, CsvWriter],
|
24
|
+
:simple_jira => [JiraModel, JiraWriter],
|
25
|
+
}
|
26
|
+
|
27
|
+
# desc "report PRESET_KEY [FEATURE_PATH [REPORT_PATH [REPORT_FILE_NAME [LOG_LEVEL]]]]",
|
28
|
+
# "reports parsed results into \nREPORT_PATH/REPORT_FILE_NAME \nfor all '*.feature' files in the given FEATURE_PATH\nSTDIO LOG_LEVEL adjustable\n"
|
29
|
+
|
30
|
+
def report preset_key, report_file_name = 'sample_report', feat_path = "../", report_path = ".", log_level = :error
|
31
|
+
init_logger log_level
|
32
|
+
report_path = File.join report_path, 'reports', LOG_TIME_TODAY
|
33
|
+
|
34
|
+
msg = "running '#{preset_key.to_s.upcase}' reporter @\n Feature Path: '#{feat_path}' \n Report Path => '#{report_path}' - '#{report_file_name}'\n"
|
35
|
+
|
36
|
+
@log.info msg
|
37
|
+
puts msg
|
38
|
+
|
39
|
+
model, writer = PRESETS[preset_key]
|
40
|
+
|
41
|
+
gr = GherkinRipper.new feat_path
|
42
|
+
ast_map = gr.ast_map
|
43
|
+
preset_model = model.new ast_map
|
44
|
+
preset_writer = writer.new
|
45
|
+
grr = GherkinReporter.new preset_writer, preset_model, report_path, report_file_name
|
46
|
+
grr.write
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def init
|
52
|
+
# todo: init things if needed
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# GherkinParserCmd.start(ARGV)
|
57
|
+
end
|
data/lib/cuker/high.rb
CHANGED
@@ -1,57 +1,62 @@
|
|
1
|
+
# require 'cuker'
|
1
2
|
# require 'highline'
|
2
3
|
#
|
3
|
-
#
|
4
|
+
# CCC = Cuker::CukerCmd.new
|
5
|
+
# CLI = HighLine.new
|
4
6
|
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# # Default answer
|
11
|
-
#
|
12
|
-
# cli.ask("Company? ") { |q| q.default = "none" }
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# # Validation
|
16
|
-
#
|
17
|
-
# cli.ask("Age? ", Integer) { |q| q.in = 0..105 }
|
18
|
-
# cli.ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ }
|
19
|
-
#
|
20
|
-
#
|
21
|
-
# # Type conversion for answers:
|
22
|
-
#
|
23
|
-
# cli.ask("Birthday? ", Date)
|
24
|
-
# cli.ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) })
|
7
|
+
# DEFAULT_REPORT_FILE_NAME = 'DEFAULT_REPORT_NAME'
|
8
|
+
# # DEFAULT_FEATURES_PATH = "../../features/uat/gcm/jira_stories/"
|
9
|
+
# DEFAULT_FEATURES_PATH = "."
|
10
|
+
# # DEFAULT_REPORT_PATH = './reports'
|
25
11
|
#
|
12
|
+
# def ask_for_input_location
|
13
|
+
# loc = CLI.ask "\nType your JIRA number:\n"
|
14
|
+
# File.join DEFAULT_FEATURES_PATH, '**', loc
|
15
|
+
# end
|
26
16
|
#
|
27
|
-
#
|
17
|
+
# def ask_for_output_file_name
|
18
|
+
# name = CLI.ask "\nType your report file name: \n[hit enter to use default name => '#{DEFAULT_REPORT_FILE_NAME}']\n"
|
19
|
+
# name.empty? ? DEFAULT_REPORT_FILE_NAME : name
|
20
|
+
# end
|
28
21
|
#
|
29
|
-
#
|
30
|
-
#
|
22
|
+
# def handle_call preset
|
23
|
+
# begin
|
24
|
+
# feat_path = ask_for_input_location
|
25
|
+
# report_name = ask_for_output_file_name
|
26
|
+
# file_name = CCC.report preset, report_name, feat_path
|
27
|
+
# CLI.say("\n\nCreated '#{preset}' @ '#{file_name}' ... Enjoy!\n") if file_name
|
28
|
+
# rescue Exception
|
29
|
+
# puts "An Error occured\nplease contact NarenSS (v675166) for more details\n"
|
30
|
+
# puts e
|
31
|
+
# end
|
32
|
+
# end
|
31
33
|
#
|
34
|
+
# def exit_message
|
35
|
+
# CLI.say("Thank you for using Cuker :)\nFeel free to reach out to NarenSS (v675166) for any feature request\nHave a very good day!")
|
36
|
+
# exit
|
37
|
+
# end
|
32
38
|
#
|
33
|
-
#
|
39
|
+
# loop do
|
40
|
+
# # Menus:
|
41
|
+
# CLI.say("\nREPORT_NUMBERS:\n")
|
42
|
+
# CLI.choose do |menu|
|
43
|
+
# menu.prompt = "\n\nType the REPORT_NUMBER you want to generate?\n"
|
34
44
|
#
|
35
|
-
#
|
45
|
+
# presets = Cuker::CukerCmd::PRESETS
|
36
46
|
#
|
47
|
+
# presets.keys.each do |option|
|
48
|
+
# menu.choice(option) do
|
49
|
+
# handle_call option
|
50
|
+
# end
|
51
|
+
# end
|
37
52
|
#
|
38
|
-
#
|
53
|
+
# menu.choice(:quit) {exit_message}
|
54
|
+
# menu.default = :quit
|
55
|
+
# end
|
39
56
|
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
# menu.choices(:python, :perl) { cli.say("Not from around here, are you?") }
|
44
|
-
# menu.default = :ruby
|
57
|
+
# answer = CLI.ask "\nWant to rerun? \n[ type anything and hit enter to rerun\nor just hit enter to quit this program ]\n"
|
58
|
+
# break if answer.empty?
|
59
|
+
# puts "\n... rebooting ...\n\n"
|
45
60
|
# end
|
46
61
|
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
# HighLine::Menu.index_color = :rgb_77bbff # set default index color
|
50
|
-
#
|
51
|
-
# cli.choose do |menu|
|
52
|
-
# menu.index_color = :rgb_999999 # override default color of index
|
53
|
-
# # you can also use constants like :blue
|
54
|
-
# menu.prompt = "Please choose your favorite programming language? "
|
55
|
-
# menu.choice(:ruby) { cli.say("Good choice!") }
|
56
|
-
# menu.choices(:python, :perl) { cli.say("Not from around here, are you?") }
|
57
|
-
# end
|
62
|
+
# exit_message
|
data/lib/cuker/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Cuker
|
2
|
-
VERSION = "0.3.
|
3
|
-
end
|
1
|
+
module Cuker
|
2
|
+
VERSION = "0.3.17"
|
3
|
+
end
|
@@ -27,11 +27,50 @@ class AbstractModel
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def get_values_ary ary_of_hshs
|
30
|
-
ary_of_hshs.map
|
30
|
+
ary_of_hshs.map(&:values).flatten
|
31
31
|
end
|
32
32
|
|
33
33
|
def get_keys_ary ary_of_hshs
|
34
|
-
ary_of_hshs.map
|
34
|
+
ary_of_hshs.map(&:keys).flatten
|
35
|
+
end
|
36
|
+
|
37
|
+
# utility methods
|
38
|
+
# used by any model
|
39
|
+
|
40
|
+
def name_merge hsh
|
41
|
+
str = ""
|
42
|
+
@log.warn "name merge for #{hsh}"
|
43
|
+
str += hsh[:name].strip.force_encoding("UTF-8") if hsh[:name]
|
44
|
+
str += " - #{hsh[:description].strip.force_encoding("UTF-8")}" if hsh[:description]
|
45
|
+
str
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
def union feat_tags, tags
|
50
|
+
(feat_tags.to_set | tags.to_set).to_a # union
|
51
|
+
end
|
52
|
+
|
53
|
+
def surround ary, sep
|
54
|
+
# "#{sep}#{ary.is_a?(Array)? ary.join(sep) : ary}#{sep}"
|
55
|
+
# "#{sep}#{ary.join(sep)}#{sep}"
|
56
|
+
simple_surround ary.join(sep), sep
|
57
|
+
end
|
58
|
+
|
59
|
+
def simple_surround item, sep
|
60
|
+
"#{sep}#{item}#{sep}"
|
61
|
+
end
|
62
|
+
|
63
|
+
# def padded_surround item, sep, pad
|
64
|
+
# "#{sep}#{pad}#{item}#{pad}#{sep}"
|
65
|
+
# end
|
66
|
+
|
67
|
+
def get_tags(hsh)
|
68
|
+
if hsh[:tags] and hsh[:tags].any?
|
69
|
+
hsh[:tags].map {|tag| tag[:name]}
|
70
|
+
else
|
71
|
+
@log.warn "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
72
|
+
[]
|
73
|
+
end
|
35
74
|
end
|
36
75
|
|
37
76
|
end
|
@@ -121,23 +121,6 @@ module Cuker
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
def get_tags(hsh)
|
125
|
-
if hsh[:tags] and hsh[:tags].any?
|
126
|
-
hsh[:tags].map {|tag| tag[:name]}
|
127
|
-
else
|
128
|
-
@log.warn "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
129
|
-
[]
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
def name_merge hsh
|
134
|
-
str = ""
|
135
|
-
@log.warn "name merge for #{hsh}"
|
136
|
-
str += hsh[:name].strip.force_encoding("UTF-8") if hsh[:name]
|
137
|
-
str += " - #{hsh[:description].strip.force_encoding("UTF-8")}" if hsh[:description]
|
138
|
-
str
|
139
|
-
end
|
140
|
-
|
141
124
|
end
|
142
125
|
|
143
126
|
class Identifier
|
@@ -46,7 +46,7 @@ class CsvSheet < AbstractSheet
|
|
46
46
|
|
47
47
|
def add_row row_ary
|
48
48
|
super row_ary
|
49
|
-
#
|
49
|
+
@log.warn "argument not an array.. instead is a '#{row_ary.class}' -> '#{row_ary}'" unless row_ary.is_a? Array
|
50
50
|
CSV.open(@name, "ab") do |csv|
|
51
51
|
csv << row_ary
|
52
52
|
end
|
@@ -3,6 +3,14 @@ module Cuker
|
|
3
3
|
class JiraModel < AbstractModel
|
4
4
|
include LoggerSetup
|
5
5
|
|
6
|
+
JIRA_ICONS = {
|
7
|
+
info: "(i)",
|
8
|
+
pass: "(/)",
|
9
|
+
fail: "(x)",
|
10
|
+
exclam: "(!)",
|
11
|
+
question: "(?)",
|
12
|
+
}
|
13
|
+
|
6
14
|
def initialize ast_map
|
7
15
|
super
|
8
16
|
@log.trace "initing #{self.class}"
|
@@ -14,7 +22,7 @@ module Cuker
|
|
14
22
|
title = make_title @order
|
15
23
|
data = make_rows
|
16
24
|
|
17
|
-
@title =
|
25
|
+
@title = surround(title, '||')
|
18
26
|
@data = data.join("\n").split("\n")
|
19
27
|
end
|
20
28
|
|
@@ -24,7 +32,8 @@ module Cuker
|
|
24
32
|
[
|
25
33
|
# {:counter => "Sl.No"},
|
26
34
|
{:s_num => "Scen ID"},
|
27
|
-
{:
|
35
|
+
{:s_title => "Feature/Scenario"},
|
36
|
+
{:s_content => "Steps"},
|
28
37
|
{:item => "Result"},
|
29
38
|
]
|
30
39
|
# # todo: make title order reorderable
|
@@ -47,13 +56,31 @@ module Cuker
|
|
47
56
|
@file_path = file_path
|
48
57
|
in_feat_counter = 0
|
49
58
|
if ast[:type] == :GherkinDocument
|
50
|
-
in_feature(ast) do |
|
51
|
-
in_item(feat_item) do |
|
52
|
-
row_hsh = {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
in_feature(ast) do |feat_tags_ary, feat_title, feat_item|
|
60
|
+
in_item(feat_item) do |tags_ary, title, type, content_ary|
|
61
|
+
row_hsh = {}
|
62
|
+
if type == :Background
|
63
|
+
row_hsh = {
|
64
|
+
:s_num => "#{feat_counter}",
|
65
|
+
:s_title => "Feature: #{feat_title}\nBackground: #{title}",
|
66
|
+
:s_content => surround_panel(content_ary.join("\n")),
|
67
|
+
:item => simple_surround(JIRA_ICONS[:empty], '|'),
|
68
|
+
}
|
69
|
+
elsif type == :Scenario or type == :ScenarioOutline
|
70
|
+
row_hsh = {
|
71
|
+
:s_num => "#{feat_counter}.#{in_feat_counter += 1}",
|
72
|
+
:s_title => title,
|
73
|
+
:s_content => surround_panel(content_ary.join("\n")),
|
74
|
+
:item => simple_surround(JIRA_ICONS[type == :ScenarioOutline ? :info : :exclam], '|'),
|
75
|
+
}
|
76
|
+
elsif type == :Examples
|
77
|
+
row_hsh = {
|
78
|
+
:s_num => "#{feat_counter}.#{in_feat_counter}.x",
|
79
|
+
:s_title => title, # example title
|
80
|
+
:s_content => surround_panel(content_ary.join("\n")),
|
81
|
+
:item => simple_surround(JIRA_ICONS[:info], '|'),
|
82
|
+
}
|
83
|
+
end
|
57
84
|
row_ary = []
|
58
85
|
get_keys_ary(@order).each {|k| row_ary << row_hsh[k]}
|
59
86
|
res << surround(row_ary, '|')
|
@@ -72,29 +99,26 @@ module Cuker
|
|
72
99
|
feat_tags = get_tags feat
|
73
100
|
feat_title = name_merge feat
|
74
101
|
children = feat[:children]
|
75
|
-
children.each do |
|
76
|
-
yield feat_tags, feat_title,
|
102
|
+
children.each do |child|
|
103
|
+
yield feat_tags, feat_title, child
|
77
104
|
end
|
78
105
|
else
|
79
106
|
@log.warn "No Features found in file @ #{@file_path}"
|
80
107
|
end
|
81
108
|
end
|
82
109
|
|
83
|
-
def in_item(
|
84
|
-
item_title = name_merge
|
85
|
-
tags = get_tags
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
elsif
|
91
|
-
yield tags, item_title, get_steps(
|
92
|
-
|
93
|
-
elsif item[:type] == :ScenarioOutline
|
94
|
-
yield tags, item_title, get_steps(item)
|
95
|
-
@bg_steps = nil
|
110
|
+
def in_item(child)
|
111
|
+
item_title = name_merge child
|
112
|
+
tags = get_tags child
|
113
|
+
if child[:type] == :Background
|
114
|
+
yield tags, item_title, child[:type], get_steps(child)
|
115
|
+
elsif child[:type] == :Scenario
|
116
|
+
yield tags, item_title, child[:type], get_steps(child)
|
117
|
+
elsif child[:type] == :ScenarioOutline
|
118
|
+
yield tags, item_title, child[:type], get_steps(child)
|
119
|
+
# todo: think about new examples in new lines
|
96
120
|
else
|
97
|
-
@log.warn "Unknown type '#{
|
121
|
+
@log.warn "Unknown type '#{child[:type]}' found in file @ #{@file_path}"
|
98
122
|
end
|
99
123
|
end
|
100
124
|
|
@@ -105,6 +129,7 @@ module Cuker
|
|
105
129
|
in_step(steps) do |step|
|
106
130
|
content += step
|
107
131
|
end
|
132
|
+
content += in_example(hsh[:examples]) if hsh[:examples]
|
108
133
|
content
|
109
134
|
else
|
110
135
|
@log.warn "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
@@ -112,13 +137,51 @@ module Cuker
|
|
112
137
|
end
|
113
138
|
end
|
114
139
|
|
140
|
+
def in_example(examples)
|
141
|
+
res = []
|
142
|
+
examples.each do |example|
|
143
|
+
if example[:type] == :Examples
|
144
|
+
res << " "
|
145
|
+
|
146
|
+
eg_title = "Examples: #{name_merge(example)}"
|
147
|
+
res << eg_title
|
148
|
+
|
149
|
+
eg_header = surround(in_table_row(example[:tableHeader]), '||')
|
150
|
+
res << eg_header
|
151
|
+
|
152
|
+
eg_rows = example[:tableBody]
|
153
|
+
eg_rows.map {|row_hsh| res << surround(in_table_row(row_hsh), '|')}
|
154
|
+
|
155
|
+
else
|
156
|
+
@log.warn "Unknown type '#{item[:type]}' found in file @ #{@file_path}"
|
157
|
+
end
|
158
|
+
end
|
159
|
+
res
|
160
|
+
end
|
161
|
+
|
162
|
+
def in_table_row row_hsh
|
163
|
+
if row_hsh[:type] == :TableRow
|
164
|
+
row_hsh[:cells].map(&method(:in_table_cell))
|
165
|
+
else
|
166
|
+
@log.warn "Expected :TableRow in #{row_hsh} @ #{@file_path}"
|
167
|
+
[]
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def in_table_cell cell_hsh
|
172
|
+
if cell_hsh[:type] == :TableCell
|
173
|
+
cell_hsh[:value]
|
174
|
+
else
|
175
|
+
@log.warn "Expected :TableCell in #{cell_hsh} @ #{@file_path}"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
115
179
|
def in_step(steps)
|
116
|
-
# todo: table
|
117
180
|
steps.each do |step|
|
118
181
|
if step[:type] == :Step
|
119
182
|
step_ary = []
|
120
183
|
step_ary << [
|
121
|
-
step[:keyword].strip,
|
184
|
+
"*#{step[:keyword].strip}*", # bolding the keywords
|
122
185
|
step[:text].strip
|
123
186
|
].join(" ")
|
124
187
|
step_ary += in_step_args(step[:argument]) if step[:argument]
|
@@ -140,35 +203,20 @@ module Cuker
|
|
140
203
|
return res
|
141
204
|
elsif arg[:type] == :DocString
|
142
205
|
# todo: handle if needed
|
206
|
+
@log.warn "Docstrings found in '#{arg}' found in file @ #{@file_path}"
|
143
207
|
else
|
144
208
|
@log.warn "Unknown type '#{arg[:type]}' found in file @ #{@file_path}"
|
145
209
|
end
|
146
210
|
[]
|
147
211
|
end
|
148
212
|
|
149
|
-
def
|
150
|
-
if
|
151
|
-
|
213
|
+
def surround_panel str, title = nil
|
214
|
+
if title
|
215
|
+
"{panel:title = #{title}} #{str} {panel}"
|
152
216
|
else
|
153
|
-
|
154
|
-
[]
|
217
|
+
"{panel} #{str} {panel}"
|
155
218
|
end
|
156
219
|
end
|
157
220
|
|
158
|
-
def union feat_tags, tags
|
159
|
-
(feat_tags.to_set | tags.to_set).to_a # union
|
160
|
-
end
|
161
|
-
|
162
|
-
def surround ary, sep
|
163
|
-
"#{sep}#{ary.join(sep)}#{sep}"
|
164
|
-
end
|
165
|
-
|
166
|
-
def name_merge hsh
|
167
|
-
str = ""
|
168
|
-
@log.warn hsh
|
169
|
-
str += hsh[:name].strip.force_encoding("UTF-8") if hsh[:name]
|
170
|
-
str += hsh[:description].strip.force_encoding("UTF-8") if hsh[:description]
|
171
|
-
str
|
172
|
-
end
|
173
221
|
end
|
174
222
|
end
|
@@ -7,16 +7,16 @@ class JiraWriter < AbstractWriter
|
|
7
7
|
@log.debug "initing #{self.class}"
|
8
8
|
end
|
9
9
|
|
10
|
-
def write_title
|
11
|
-
super
|
10
|
+
def write_title title_line
|
11
|
+
super title_line
|
12
12
|
@log.debug "JW write title"
|
13
|
-
@active_sheet.
|
13
|
+
@active_sheet.add_line title_line
|
14
14
|
end
|
15
15
|
|
16
|
-
def write_new_row
|
17
|
-
super
|
16
|
+
def write_new_row row_line
|
17
|
+
super row_line
|
18
18
|
@log.debug "JW write row"
|
19
|
-
@active_sheet.
|
19
|
+
@active_sheet.add_line row_line
|
20
20
|
end
|
21
21
|
|
22
22
|
def make_new_sheet name = nil
|
@@ -39,11 +39,11 @@ class JiraFile < AbstractSheet
|
|
39
39
|
@csv_sheet = File.open(file_name, "wb")
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
super
|
44
|
-
#
|
42
|
+
def add_line line
|
43
|
+
super line
|
44
|
+
@log.warn "argument not a String.. instead is a '#{line.class}' -> '#{line}'" unless line.is_a? String
|
45
45
|
File.open(@name, "ab") do |file|
|
46
|
-
file << "#{
|
46
|
+
file << "#{line}\n"
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
data/lib/cuker.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'cuker/version'
|
2
|
-
require 'cuker/
|
3
|
-
|
4
|
-
module Cuker
|
5
|
-
CukerError = Class.new StandardError
|
6
|
-
|
1
|
+
require 'cuker/version'
|
2
|
+
require 'cuker/cuker_cmd'
|
3
|
+
|
4
|
+
module Cuker
|
5
|
+
CukerError = Class.new StandardError
|
6
|
+
|
7
7
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ufo2mstar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,90 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: awesome_print
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: gherkin
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: highline
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: logging
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: require_all
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: thor
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
55
139
|
description: generates reports and gives some customizable formatting options
|
56
140
|
email:
|
57
141
|
- ufo2mstar@gmail.com
|
@@ -72,11 +156,11 @@ files:
|
|
72
156
|
- bin/setup
|
73
157
|
- cuker.gemspec
|
74
158
|
- lib/cuker.rb
|
159
|
+
- lib/cuker/cuker_cmd.rb
|
75
160
|
- lib/cuker/gherkin_lexer.rb
|
76
161
|
- lib/cuker/gherkin_parser.rb
|
77
162
|
- lib/cuker/gherkin_reporter.rb
|
78
163
|
- lib/cuker/gherkin_ripper.rb
|
79
|
-
- lib/cuker/gp.rb
|
80
164
|
- lib/cuker/helper/file_helper.rb
|
81
165
|
- lib/cuker/helper/gherkin_helper.rb
|
82
166
|
- lib/cuker/high.rb
|
data/lib/cuker/gp.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
require 'require_all'
|
4
|
-
# require_all 'lib/cuker/**/*.rb'
|
5
|
-
# require_all 'lib/cuker/*.rb'
|
6
|
-
require_rel '**/*.rb'
|
7
|
-
require_rel '*.rb'
|
8
|
-
|
9
|
-
|
10
|
-
module Cuker
|
11
|
-
module GPHelper
|
12
|
-
def self.dash_print(ary)
|
13
|
-
# ary.each {|x| puts " - '#{x}'"}
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
class GherkinParserCmd < Thor
|
18
|
-
include LoggerSetup
|
19
|
-
|
20
|
-
GPTOOL = GherkinParser.new
|
21
|
-
PRESET_LOCS = ['*', './*']
|
22
|
-
|
23
|
-
desc "gp LOCATION", "parse all *.feature files in the given LOCATION"
|
24
|
-
|
25
|
-
def gp loc = "../jira*/**/*", file_name = nil
|
26
|
-
init
|
27
|
-
@log.warn "running GPTOOL @ #{loc}"
|
28
|
-
end
|
29
|
-
|
30
|
-
desc "gpp", "parse all *.feature files in the preset locations: \n#{GPHelper.dash_print PRESET_LOCS}"
|
31
|
-
|
32
|
-
def gpp
|
33
|
-
init
|
34
|
-
@log.warn "running GPTOOL @ #{PRESET_LOCS}"
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
desc "gpr FEATURE_PATH REPORT_PATH [REPORT_FILE_NAME]",
|
39
|
-
"reports parsed results into REPORT_FILE_NAME for all *.feature files in the given LOCATION"
|
40
|
-
|
41
|
-
def gpr report_file_name = 'sample_report', feat_path = "../", report_path = "reports"
|
42
|
-
init
|
43
|
-
@log.warn "running GPTOOL @ '#{feat_path}' => '#{report_path}' '#{report_file_name}.csv' "
|
44
|
-
|
45
|
-
report_path = File.join report_path, LOG_TIME_TODAY
|
46
|
-
@log.info Dir.pwd
|
47
|
-
|
48
|
-
gr = GherkinRipper.new feat_path
|
49
|
-
ast_map = gr.ast_map
|
50
|
-
csv_model = CsvModel.new ast_map
|
51
|
-
csv_writer = CsvWriter.new
|
52
|
-
grr = GherkinReporter.new csv_writer, csv_model, report_path, report_file_name
|
53
|
-
grr.write
|
54
|
-
end
|
55
|
-
|
56
|
-
desc "gpj FEATURE_PATH REPORT_PATH [REPORT_FILE_NAME]",
|
57
|
-
"reports parsed results into REPORT_FILE_NAME for all *.feature files in the given LOCATION"
|
58
|
-
|
59
|
-
def gpj feat_path = "spec/cuker_spec/testdata", report_path = "reports/#{LOG_TIME_TODAY}", report_file_name = 'sample_report'
|
60
|
-
init
|
61
|
-
@log.warn "running GPTOOL @ '#{feat_path}' => '#{report_path}' '#{report_file_name}.csv' "
|
62
|
-
|
63
|
-
@log.info Dir.pwd
|
64
|
-
|
65
|
-
gr = GherkinRipper.new feat_path
|
66
|
-
ast_map = gr.ast_map
|
67
|
-
csv_model = JiraModel.new ast_map
|
68
|
-
csv_writer = JiraWriter.new
|
69
|
-
grr = GherkinReporter.new csv_writer, csv_model, report_path, report_file_name
|
70
|
-
grr.write
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
private
|
75
|
-
|
76
|
-
def init
|
77
|
-
init_logger :warn
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
# GherkinParserCmd.start(ARGV)
|
82
|
-
end
|