cuker 0.5.3 → 0.5.7
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 +4 -4
- data/.gitignore +1 -1
- data/Gemfile +6 -0
- data/cuker.gemspec +2 -4
- data/lib/cuker/cuker_cmd.rb +2 -1
- data/lib/cuker/helpers/{_interfact.rb → _interface.rb} +1 -1
- data/lib/cuker/helpers/formatters/abstract_model.rb +22 -2
- data/lib/cuker/helpers/formatters/jira_model.rb +5 -7
- data/lib/cuker/helpers/formatters/ruby_x_l_model.rb +355 -0
- data/lib/cuker/helpers/writers/abstract_writer.rb +1 -0
- data/lib/cuker/helpers/writers/ruby_x_l_writer.rb +16 -0
- data/lib/cuker/helpers/writers/simple_macro_template.xlsm +0 -0
- data/lib/cuker/high.rb +40 -14
- data/lib/cuker/test/ruby_xl.rb +32 -3
- data/lib/cuker/test/sablon-try.rb +24 -0
- data/lib/cuker/test/template.docx +0 -0
- data/lib/cuker/test/xlsx_500_rows.xlsx +0 -0
- data/lib/cuker/version.rb +1 -1
- metadata +8 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94bf544c652ce97b7c985b1f4b0c4bec9905a19f37e9dc7ec76df6970c741470
|
4
|
+
data.tar.gz: 7778dfbbd84ec0d4ee0311a9c9f213a9c6bde4b2cfc5e753aa284e35ef3a671c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e75c2b294daf52c8aaeba9a258ce283124794e578fc7dff16c9614898c7b92917c9f959c256c0cc9e86809784059070692d7859f47b52990297c521796e668b6
|
7
|
+
data.tar.gz: 83962be132951c6af897e680da9dd1a33b590ca51adcd0d5302b562876b65e572f07551f41faf722a49463be2fea7a709fe022e97b0a41837d935d74e9f50252
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/cuker.gemspec
CHANGED
@@ -39,17 +39,15 @@ Gem::Specification.new do |spec|
|
|
39
39
|
|
40
40
|
spec.add_development_dependency "bundler", "~> 2.0"
|
41
41
|
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
42
|
+
# spec.add_development_dependency "rspec", "~> 3.0"
|
43
43
|
|
44
|
-
# spec.add_development_dependency "bundler", "~> 2.0"
|
45
|
-
# spec.add_development_dependency "rake", "~> 10.0"
|
46
44
|
spec.add_development_dependency "require_all"
|
47
45
|
spec.add_development_dependency "awesome_print"
|
48
46
|
spec.add_development_dependency "logging"
|
49
47
|
|
50
48
|
spec.add_development_dependency "gherkin", "~> 5.1"
|
51
49
|
|
52
|
-
spec.add_development_dependency "thor"
|
50
|
+
# spec.add_development_dependency "thor"
|
53
51
|
spec.add_development_dependency "highline"
|
54
52
|
|
55
53
|
spec.add_development_dependency "rubyXL"
|
data/lib/cuker/cuker_cmd.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'thor'
|
1
|
+
# require 'thor'
|
2
2
|
|
3
3
|
require 'require_all'
|
4
4
|
# require_all 'lib/cuker/**/*.rb'
|
@@ -24,6 +24,7 @@ module Cuker
|
|
24
24
|
:simple_csv => [CsvModel, CsvWriter],
|
25
25
|
:simple_jira => [JiraModel, JiraWriter],
|
26
26
|
:monospaced_jira => [JiraMonoModel, JiraWriter],
|
27
|
+
# :simple_excel => [RubyXLModel, RubyXLWriter],
|
27
28
|
}
|
28
29
|
|
29
30
|
# desc "report PRESET_KEY [FEATURE_PATH [REPORT_PATH [REPORT_FILE_NAME [LOG_LEVEL]]]]",
|
@@ -12,6 +12,7 @@ module Cuker
|
|
12
12
|
|
13
13
|
class AbstractModel
|
14
14
|
include LoggerSetup
|
15
|
+
include IModel
|
15
16
|
|
16
17
|
# @return [Array] writable rows of title
|
17
18
|
# Defaults to []
|
@@ -21,6 +22,20 @@ module Cuker
|
|
21
22
|
# Defaults to []
|
22
23
|
attr_accessor :data
|
23
24
|
|
25
|
+
# https://cucumber.io/docs/gherkin/reference/#keywords
|
26
|
+
FEATURE = 'Feature'
|
27
|
+
BACKGROUND = 'Background'
|
28
|
+
|
29
|
+
SCENARIO = 'Scenario'
|
30
|
+
SCENARIO_OUTLINE = 'Scenario Outline'
|
31
|
+
EXAMPLES = 'Examples'
|
32
|
+
|
33
|
+
GIVEN = 'Given'
|
34
|
+
WHEN = 'When'
|
35
|
+
THEN = 'Then'
|
36
|
+
AND = 'And'
|
37
|
+
BUT = 'But'
|
38
|
+
|
24
39
|
def initialize _model_input = []
|
25
40
|
init_logger
|
26
41
|
@title = []
|
@@ -28,11 +43,11 @@ module Cuker
|
|
28
43
|
end
|
29
44
|
|
30
45
|
def get_values_ary ary_of_hshs
|
31
|
-
ary_of_hshs
|
46
|
+
get_item_ary ary_of_hshs, :values
|
32
47
|
end
|
33
48
|
|
34
49
|
def get_keys_ary ary_of_hshs
|
35
|
-
ary_of_hshs
|
50
|
+
get_item_ary ary_of_hshs, :keys
|
36
51
|
end
|
37
52
|
|
38
53
|
# utility methods
|
@@ -75,5 +90,10 @@ module Cuker
|
|
75
90
|
end
|
76
91
|
end
|
77
92
|
|
93
|
+
private
|
94
|
+
|
95
|
+
def get_item_ary ary_of_hshs, item
|
96
|
+
ary_of_hshs.map(&item).flatten
|
97
|
+
end
|
78
98
|
end
|
79
99
|
end
|
@@ -34,7 +34,7 @@ module Cuker
|
|
34
34
|
title = make_title @order
|
35
35
|
data = make_rows
|
36
36
|
|
37
|
-
@title = surround(title,
|
37
|
+
@title = surround(title, JIRA_TITLE_SEP)
|
38
38
|
@data = data.join("\n").split("\n")
|
39
39
|
end
|
40
40
|
|
@@ -48,8 +48,6 @@ module Cuker
|
|
48
48
|
{:s_content => "Steps"},
|
49
49
|
{:item => "Result"},
|
50
50
|
]
|
51
|
-
# # todo: make title order reorderable
|
52
|
-
# # todo: tag based reordering
|
53
51
|
end
|
54
52
|
|
55
53
|
def make_title order
|
@@ -76,8 +74,8 @@ module Cuker
|
|
76
74
|
@feat_printed = true
|
77
75
|
title_str = ''
|
78
76
|
# feat handle
|
79
|
-
title_str += jira_title
|
80
|
-
title_str += jira_title(
|
77
|
+
title_str += jira_title FEATURE, feat_title
|
78
|
+
title_str += jira_title(BACKGROUND, title) if type == :Background
|
81
79
|
row_hsh = {
|
82
80
|
:s_num => "#{feat_counter}",
|
83
81
|
:s_title => surround_panel(title_str),
|
@@ -165,7 +163,7 @@ module Cuker
|
|
165
163
|
if example[:type] == :Examples
|
166
164
|
res << JIRA_HORIZ_RULER
|
167
165
|
|
168
|
-
eg_title = jira_title
|
166
|
+
eg_title = jira_title EXAMPLES, name_merge(example)
|
169
167
|
res << eg_title
|
170
168
|
|
171
169
|
eg_header = surround(in_table_row(example[:tableHeader]), '||')
|
@@ -226,7 +224,7 @@ module Cuker
|
|
226
224
|
if arg[:type] == :DataTable
|
227
225
|
res = []
|
228
226
|
arg[:rows].each_with_index do |row, i|
|
229
|
-
sep = i == 0 ?
|
227
|
+
sep = i == 0 ? JIRA_TITLE_SEP : JIRA_ROW_SEP
|
230
228
|
res << surround(row[:cells].map {|hsh| jira_blank_pad hsh[:value]}, sep)
|
231
229
|
end
|
232
230
|
return res
|
@@ -0,0 +1,355 @@
|
|
1
|
+
require_relative '../writers/abstract_writer'
|
2
|
+
|
3
|
+
module Cuker
|
4
|
+
module ExcelSupport
|
5
|
+
|
6
|
+
def surround_panel str, title = nil
|
7
|
+
if title
|
8
|
+
"{panel:title = #{title}} #{str} {panel}"
|
9
|
+
else
|
10
|
+
"{panel} #{str} {panel}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def surround_color str, color = nil
|
15
|
+
if title
|
16
|
+
"{color:#{color}} #{str} {color}"
|
17
|
+
else
|
18
|
+
"{color} #{str} {color}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def excel_title keyword, title
|
23
|
+
"#{excel_bold "#{keyword}:"}\n #{title}\n "
|
24
|
+
end
|
25
|
+
|
26
|
+
def excel_arg_hilight(str)
|
27
|
+
# str.gsub(/<(.*)?>/, excel_bold_italics('<\1>'))
|
28
|
+
str.gsub(/<.*?>/, &method(:excel_bold_italics))
|
29
|
+
end
|
30
|
+
|
31
|
+
def excel_bold_italics(str)
|
32
|
+
# make excel_bold_italics?
|
33
|
+
excel_bold(excel_italics(str))
|
34
|
+
end
|
35
|
+
|
36
|
+
def excel_bold str
|
37
|
+
# make bold?
|
38
|
+
str
|
39
|
+
end
|
40
|
+
|
41
|
+
def excel_monospace str
|
42
|
+
# make monospaced?
|
43
|
+
str
|
44
|
+
end
|
45
|
+
|
46
|
+
def excel_italics(str)
|
47
|
+
# make excel_italics?
|
48
|
+
str
|
49
|
+
end
|
50
|
+
|
51
|
+
def excel_blank_pad str
|
52
|
+
s = str.strip
|
53
|
+
s.empty? ? EXCEL_BLANK : s
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
class RubyXLModel < AbstractModel
|
58
|
+
include LoggerSetup
|
59
|
+
include StringHelper
|
60
|
+
include ExcelSupport
|
61
|
+
|
62
|
+
attr_accessor :special_tag_list
|
63
|
+
|
64
|
+
TITLE_MAX_LEN = 60
|
65
|
+
|
66
|
+
EXCEL_BLANK = ''
|
67
|
+
EXCEL_TITLE_SEP = '|'
|
68
|
+
EXCEL_ROW_SEP = '|'
|
69
|
+
EXCEL_EMPTY_LINE = ' '
|
70
|
+
EXCEL_NEW_LINE = "\n"
|
71
|
+
EXCEL_HORIZ_RULER = ''
|
72
|
+
|
73
|
+
def initialize ast_map
|
74
|
+
super
|
75
|
+
@log.trace "initing #{self.class}"
|
76
|
+
@log.debug "has #{ast_map.size} items"
|
77
|
+
|
78
|
+
@asts = ast_map
|
79
|
+
|
80
|
+
@order = make_order
|
81
|
+
@title = make_title @order
|
82
|
+
@data = make_rows
|
83
|
+
end
|
84
|
+
|
85
|
+
# private
|
86
|
+
|
87
|
+
def make_order
|
88
|
+
[
|
89
|
+
# {:counter => "Sl.No"},
|
90
|
+
# {:feature_title => "Feature"},
|
91
|
+
# {:s_type => "Type"},
|
92
|
+
# {:s_title => "Title"},
|
93
|
+
# {:tags => special_tag_titles},
|
94
|
+
# {:file_s_num => "S.no"},
|
95
|
+
# {:file_name => "File"},
|
96
|
+
# {:other_tags => "Tags"},
|
97
|
+
{:counter => "Sl.No"},
|
98
|
+
{:feature => "Feature"},
|
99
|
+
{:background => "Background"},
|
100
|
+
{:scenario => "Scenario"},
|
101
|
+
{:examples => "Examples"},
|
102
|
+
{:result => "Result"},
|
103
|
+
{:tested_by => "Tested By"},
|
104
|
+
{:test_designer => "Test Designer"},
|
105
|
+
]
|
106
|
+
|
107
|
+
# todo: make title order reorderable
|
108
|
+
# todo: tag based reordering
|
109
|
+
end
|
110
|
+
|
111
|
+
def make_title order
|
112
|
+
get_values_ary order
|
113
|
+
end
|
114
|
+
|
115
|
+
def special_tag_titles
|
116
|
+
@special_tag_titles ||= get_values_ary @special_tag_list if @special_tag_list
|
117
|
+
end
|
118
|
+
|
119
|
+
def special_tag_lookup
|
120
|
+
@special_tag_lookup ||= get_keys_ary @special_tag_list if @special_tag_list
|
121
|
+
end
|
122
|
+
|
123
|
+
def filter_special_tags(all_tags)
|
124
|
+
return [[], all_tags] unless special_tag_lookup
|
125
|
+
ignore_list = all_tags - special_tag_lookup
|
126
|
+
select_list = all_tags - ignore_list
|
127
|
+
[select_list, ignore_list]
|
128
|
+
end
|
129
|
+
|
130
|
+
def make_rows
|
131
|
+
if @asts.nil? or @asts.empty?
|
132
|
+
@log.warn "No asts to parse!"
|
133
|
+
return []
|
134
|
+
end
|
135
|
+
|
136
|
+
feat_counter = 1
|
137
|
+
|
138
|
+
feat_content = ''
|
139
|
+
bg_content = ''
|
140
|
+
|
141
|
+
res = []
|
142
|
+
@asts.each do |file_path, ast|
|
143
|
+
|
144
|
+
@file_path = file_path
|
145
|
+
in_feat_counter = 0
|
146
|
+
# @feat_printed = false
|
147
|
+
|
148
|
+
if ast[:type] == :GherkinDocument
|
149
|
+
in_feature(ast) do |feat_tags_ary, feat_title, feat_item|
|
150
|
+
in_item(feat_item) do |tags_ary, title, type, content_ary, example_ary|
|
151
|
+
|
152
|
+
row_hsh = {}
|
153
|
+
|
154
|
+
if type == :Background or type == :Feature
|
155
|
+
|
156
|
+
# @feat_printed = true
|
157
|
+
|
158
|
+
title_str = ''
|
159
|
+
# feat handle
|
160
|
+
title_str += excel_title 'Feature', feat_title
|
161
|
+
# title_str += excel_title('Background', title) if type == :Background
|
162
|
+
row_hsh = {
|
163
|
+
# :s_num => "#{feat_counter}",
|
164
|
+
# :s_title => surround_panel(title_str),
|
165
|
+
# :s_content => surround_panel(content_ary.join("\n")),
|
166
|
+
# :item => simple_surround(EXCEL_ICONS[:empty], '|'),
|
167
|
+
}
|
168
|
+
feat_content = "Feature:\n#{title_str}"
|
169
|
+
bg_content = content_ary.join("\n")
|
170
|
+
elsif type == :Scenario or type == :ScenarioOutline
|
171
|
+
# row_hsh = {
|
172
|
+
# :s_num => "#{feat_counter}.#{in_feat_counter += 1}",
|
173
|
+
# :s_title => surround_panel(excel_title(type, title)),
|
174
|
+
# :s_content => surround_panel(content_ary.join("\n")),
|
175
|
+
# # :item => simple_surround(EXCEL_ICONS[type == :ScenarioOutline ? :info : :exclam], '|'),
|
176
|
+
# :item => simple_surround(EXCEL_ICONS[:info], '|'),
|
177
|
+
|
178
|
+
row_hsh[:counter] = "#{feat_counter}.#{in_feat_counter += 1}"
|
179
|
+
row_hsh[:feature] = "#{title}"
|
180
|
+
row_hsh[:background] = bg_content
|
181
|
+
row_hsh[:scenario] = content_ary.join("\n")
|
182
|
+
|
183
|
+
row_hsh[:result] = ""
|
184
|
+
row_hsh[:tested_by] = ""
|
185
|
+
row_hsh[:test_designer] = ""
|
186
|
+
|
187
|
+
|
188
|
+
elsif type == :Examples
|
189
|
+
row_hsh[:examples] = ""
|
190
|
+
end
|
191
|
+
row_ary = []
|
192
|
+
# get_keys_ary(@order).each {|k| row_ary << excel_arg_hilight(row_hsh[k])}
|
193
|
+
res << row_ary
|
194
|
+
end
|
195
|
+
end
|
196
|
+
end
|
197
|
+
feat_counter += 1
|
198
|
+
feat_content = ''
|
199
|
+
bg_content = ''
|
200
|
+
end
|
201
|
+
@file_path = nil
|
202
|
+
res
|
203
|
+
end
|
204
|
+
|
205
|
+
def in_feature(hsh)
|
206
|
+
if hsh[:feature]
|
207
|
+
feat = hsh[:feature]
|
208
|
+
|
209
|
+
feat_tags = get_tags feat
|
210
|
+
feat_title = name_merge feat
|
211
|
+
|
212
|
+
children = feat[:children]
|
213
|
+
children.each {|child| yield feat_tags, feat_title, child}
|
214
|
+
else
|
215
|
+
@log.warn "No Features found in file @ #{@file_path}"
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def in_item(child)
|
220
|
+
item_title = name_merge child
|
221
|
+
tags = get_tags child
|
222
|
+
if child[:type] == :Background
|
223
|
+
yield tags, item_title, child[:type], get_steps(child), []
|
224
|
+
# elsif !@feat_printed
|
225
|
+
# yield [], EXCEL_BLANK, :Feature, [EXCEL_BLANK]
|
226
|
+
# yield tags, item_title, child[:type], get_steps(child), []
|
227
|
+
elsif child[:type] == :Scenario
|
228
|
+
yield tags, item_title, child[:type], get_steps(child), []
|
229
|
+
elsif child[:type] == :ScenarioOutline
|
230
|
+
yield tags, item_title, child[:type], get_steps(child), get_examples(child[:examples])
|
231
|
+
# todo: think about new examples in new lines
|
232
|
+
else
|
233
|
+
@log.warn "Unknown type '#{child[:type]}' found in file @ #{@file_path}"
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
def in_step(steps)
|
238
|
+
steps.each do |step|
|
239
|
+
if step[:type] == :Step
|
240
|
+
step_ary = []
|
241
|
+
step_str = [
|
242
|
+
((excel_bold(step[:keyword].strip)).rjust(7)), # bolding the keywords
|
243
|
+
(step[:text].strip)
|
244
|
+
].join(' ')
|
245
|
+
|
246
|
+
# step_ary << excel_monospace(step_str)
|
247
|
+
step_ary << (step_str)
|
248
|
+
|
249
|
+
step_ary += in_step_args(step[:argument]) if step[:argument]
|
250
|
+
# todo: DOC string handle?
|
251
|
+
# todo: padding as needed
|
252
|
+
yield step_ary
|
253
|
+
else
|
254
|
+
@log.warn "Unknown type '#{item[:type]}' found in file @ #{@file_path}"
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
# helps handle tables for now
|
260
|
+
def in_step_args arg
|
261
|
+
if arg[:type] == :DataTable
|
262
|
+
res = []
|
263
|
+
arg[:rows].each_with_index do |row, i|
|
264
|
+
# sep = i == 0 ? EXCEL_TITLE_SEP : EXCEL_ROW_SEP
|
265
|
+
# res << surround(row[:cells].map {|hsh| excel_blank_pad hsh[:value]}, sep)
|
266
|
+
end
|
267
|
+
return res
|
268
|
+
elsif arg[:type] == :DocString
|
269
|
+
# todo: handle if needed
|
270
|
+
@log.warn "Docstrings found in '#{arg}' found in file @ #{@file_path}"
|
271
|
+
else
|
272
|
+
@log.warn "Unknown type '#{arg[:type]}' found in file @ #{@file_path}"
|
273
|
+
end
|
274
|
+
[]
|
275
|
+
end
|
276
|
+
|
277
|
+
def get_steps(hsh)
|
278
|
+
if hsh[:steps] and hsh[:steps].any?
|
279
|
+
content = []
|
280
|
+
steps = hsh[:steps]
|
281
|
+
in_step(steps) {|step| content += step}
|
282
|
+
content
|
283
|
+
else
|
284
|
+
@log.warn "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
285
|
+
[]
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def get_examples(examples)
|
290
|
+
res = []
|
291
|
+
examples.each do |example|
|
292
|
+
if example[:type] == :Examples
|
293
|
+
# res << EXCEL_HORIZ_RULER
|
294
|
+
|
295
|
+
eg_title = excel_title 'Examples', name_merge(example)
|
296
|
+
res << eg_title
|
297
|
+
|
298
|
+
eg_header = surround(get_table_row(example[:tableHeader]), EXCEL_TITLE_SEP)
|
299
|
+
res << eg_header
|
300
|
+
|
301
|
+
eg_rows = example[:tableBody]
|
302
|
+
eg_rows.map {|row_hsh| res << surround(get_table_row(row_hsh), EXCEL_ROW_SEP)}
|
303
|
+
|
304
|
+
else
|
305
|
+
@log.warn "Unknown type '#{example[:type]}' found in file @ #{@file_path}"
|
306
|
+
end
|
307
|
+
end
|
308
|
+
res
|
309
|
+
end
|
310
|
+
|
311
|
+
def get_table_row row_hsh
|
312
|
+
if row_hsh[:type] == :TableRow
|
313
|
+
row_hsh[:cells].map(&method(:get_table_cell))
|
314
|
+
else
|
315
|
+
@log.warn "Expected :TableRow in #{row_hsh} @ #{@file_path}"
|
316
|
+
[]
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
def get_table_cell cell_hsh
|
321
|
+
if cell_hsh[:type] == :TableCell
|
322
|
+
val = cell_hsh[:value].strip
|
323
|
+
val.empty? ? EXCEL_BLANK : val
|
324
|
+
else
|
325
|
+
@log.warn "Expected :TableCell in #{cell_hsh} @ #{@file_path}"
|
326
|
+
EXCEL_BLANK
|
327
|
+
end
|
328
|
+
end
|
329
|
+
|
330
|
+
def name_merge hsh, max_len = TITLE_MAX_LEN
|
331
|
+
str = ''
|
332
|
+
@log.debug "name merge for #{hsh} with max_len (#{max_len})"
|
333
|
+
str += add_newlines!(hsh[:name].strip.force_encoding("UTF-8"), max_len) if hsh[:name]
|
334
|
+
str += add_newlines!("\n#{hsh[:description].strip.force_encoding("UTF-8")}", max_len) if hsh[:description]
|
335
|
+
str
|
336
|
+
end
|
337
|
+
|
338
|
+
|
339
|
+
class Identifier
|
340
|
+
attr_accessor :name, :title, :pattern
|
341
|
+
end
|
342
|
+
|
343
|
+
module EXCEL
|
344
|
+
module RESULT
|
345
|
+
PENDING = "Pending"
|
346
|
+
PASS = "Pass"
|
347
|
+
FAIL = "Fail"
|
348
|
+
QUESTION = "Question"
|
349
|
+
NULL = ""
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
353
|
+
end
|
354
|
+
end
|
355
|
+
|
@@ -32,8 +32,24 @@ module Cuker
|
|
32
32
|
super file_name
|
33
33
|
@log.info "Making new #{self.class} => #{file_name}"
|
34
34
|
# @jira_file = File.open(file_name, "wb")
|
35
|
+
|
36
|
+
@workbook = RubyXL::Parser.parse './sample_template.xlsx'
|
37
|
+
end
|
38
|
+
|
39
|
+
def current_row
|
40
|
+
@rows.size + 1
|
35
41
|
end
|
36
42
|
|
43
|
+
def add_row ary
|
44
|
+
@rows << ary
|
45
|
+
end
|
46
|
+
|
47
|
+
alias :add_line :add_row
|
48
|
+
|
49
|
+
# @return ary of rows
|
50
|
+
def read_rows
|
51
|
+
@rows
|
52
|
+
end
|
37
53
|
end
|
38
54
|
end
|
39
55
|
end
|
Binary file
|
data/lib/cuker/high.rb
CHANGED
@@ -5,10 +5,12 @@
|
|
5
5
|
# CLI = HighLine.new
|
6
6
|
#
|
7
7
|
# DEFAULT_REPORT_FILE_NAME = 'DEFAULT_REPORT_NAME'
|
8
|
-
#
|
9
|
-
# DEFAULT_FEATURES_PATH = "."
|
8
|
+
# DEFAULT_FEATURES_PATH = "../../features/"
|
9
|
+
# # DEFAULT_FEATURES_PATH = "."
|
10
10
|
# # DEFAULT_REPORT_PATH = './reports'
|
11
11
|
#
|
12
|
+
# JIRA_FILE_HEADER = "\n----\n \nh2. *+Acceptance Test:+*\n\n"
|
13
|
+
#
|
12
14
|
# def ask_for_input_location
|
13
15
|
# loc = CLI.ask "\nType your JIRA number:\n"
|
14
16
|
# [File.join(DEFAULT_FEATURES_PATH, '**', loc), loc]
|
@@ -16,32 +18,55 @@
|
|
16
18
|
#
|
17
19
|
# def ask_for_output_file_name default = DEFAULT_REPORT_FILE_NAME
|
18
20
|
# # name = CLI.ask "\nType your report file name: \n[hit enter to use this default name => '#{default}']\n"
|
19
|
-
#
|
21
|
+
# puts
|
22
|
+
# name = ""
|
23
|
+
# # name = CLI.ask "\n'#{default}' <= Use this 'Default Name' for your output file?\n[else, please type in the name you want]\n"
|
20
24
|
# name.empty? ? default : name
|
21
25
|
# end
|
22
26
|
#
|
27
|
+
# # https://www.ruby-forum.com/t/how-to-append-some-data-at-the-beginning-of-a-file/112910/7
|
28
|
+
# def file_prepend file_path, str
|
29
|
+
# temp_path = "#{file_path}.txt"
|
30
|
+
# newfile = File.new(temp_path, "w")
|
31
|
+
# newfile.puts str
|
32
|
+
#
|
33
|
+
# File.open(file_path, "r+") do |f|
|
34
|
+
# f.each_line {|line| newfile.puts line}
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# newfile.close
|
38
|
+
#
|
39
|
+
# #File.delete(file_path)
|
40
|
+
# #File.rename(temp_path, file_path)
|
41
|
+
# temp_path
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
#
|
23
45
|
# def handle_call preset
|
24
46
|
# begin
|
25
47
|
# feat_path, default_file_name = ask_for_input_location
|
26
48
|
# report_name = ask_for_output_file_name("#{preset}_#{default_file_name.empty? ? DEFAULT_REPORT_FILE_NAME : default_file_name}")
|
27
49
|
# file_name = CCC.report preset, feat_path, report_name
|
50
|
+
# file_prepend file_name, JIRA_FILE_HEADER
|
28
51
|
# CLI.say("\n\nCreated '#{preset}' @ \n'#{file_name}' ... Enjoy!\n") if file_name
|
29
|
-
# rescue Exception
|
30
|
-
#
|
31
|
-
# puts
|
52
|
+
# rescue Exception => e
|
53
|
+
# pad_str = '!' * 80
|
54
|
+
# puts "\n\n#{pad_str}\nAn Error occured while running the report\nplease contact NarenSS (v675166) for more details\n#{pad_str}\n\n"
|
55
|
+
# raise e
|
32
56
|
# end
|
33
57
|
# end
|
34
58
|
#
|
35
59
|
# def exit_message
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
60
|
+
# pad_str = '*' * 80
|
61
|
+
# CLI.say("\n#{pad_str}\nThank you for using Cuker (a Gherkin Reporting Tool) :)\n
|
62
|
+
# Have Feature requests or Usage questions?
|
63
|
+
# Feel free to reach out to NarenSS (v675166)\n
|
64
|
+
# Have a very good day!\n#{pad_str}\n")
|
40
65
|
# exit
|
41
66
|
# end
|
42
67
|
#
|
43
68
|
# loop do
|
44
|
-
#
|
69
|
+
# # Menus:
|
45
70
|
# CLI.say("\nREPORT_NUMBERS:\n")
|
46
71
|
# CLI.choose do |menu|
|
47
72
|
# menu.prompt = "\n\nType the REPORT_NUMBER you want to generate?\n"
|
@@ -51,16 +76,17 @@
|
|
51
76
|
# presets.keys.each do |option|
|
52
77
|
# menu.choice(option) do
|
53
78
|
# handle_call option
|
79
|
+
# exit_message
|
54
80
|
# end
|
55
81
|
# end
|
56
82
|
#
|
57
|
-
# menu.choice(:quit) {
|
83
|
+
# menu.choice(:quit) {exit_message}
|
58
84
|
# menu.default = :quit
|
59
85
|
# end
|
60
86
|
#
|
61
|
-
# answer = CLI.agree "\nWant to
|
87
|
+
# answer = CLI.agree "\nWant to run a new one? \n y [n]\n"
|
62
88
|
# break unless answer
|
63
89
|
# puts "\n... rebooting ...\n\n"
|
64
90
|
# end
|
65
91
|
#
|
66
|
-
# exit_message
|
92
|
+
# exit_message
|
data/lib/cuker/test/ruby_xl.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
|
+
# # frozen_string_literal: true
|
1
2
|
#
|
2
3
|
# require 'rubyXL'
|
4
|
+
# require 'rubyXL/convenience_methods/cell'
|
3
5
|
#
|
4
6
|
# # ============================================
|
5
7
|
# # =========== Read Example ===============
|
6
8
|
# # ============================================
|
7
9
|
#
|
8
|
-
# workbook = RubyXL::Parser.parse './
|
10
|
+
# workbook = RubyXL::Parser.parse './xlsx_500_rows.xlsx'
|
9
11
|
#
|
10
12
|
# worksheets = workbook.worksheets
|
11
13
|
# puts "Found #{worksheets.count} worksheets"
|
@@ -14,14 +16,41 @@
|
|
14
16
|
# puts "Reading: #{worksheet.sheet_name}"
|
15
17
|
# num_rows = 0
|
16
18
|
#
|
19
|
+
# # worksheet[0][0].change_contents("kod", worksheet[0][0].formula)
|
20
|
+
# # worksheet.add_cell(0, 0, 'A1')
|
21
|
+
#
|
17
22
|
# worksheet.each do |row|
|
18
|
-
#
|
23
|
+
# next if row.r == 1
|
24
|
+
# cell = row[0]
|
25
|
+
# next if cell.value.to_i == 0
|
26
|
+
#
|
27
|
+
# # cell.change_contents(cell.value.to_i+100, cell.formula) # Sets value of cell A1 to empty string, preserves formula
|
28
|
+
# cell.change_contents(cell.value.to_i + 100) # Sets value of cell A1 to empty string, preserves formula
|
29
|
+
#
|
30
|
+
# # row && row.cells.each { |cell|
|
31
|
+
# # val = cell && cell.value
|
32
|
+
# # }
|
33
|
+
#
|
34
|
+
# # row&.cells&.each do |cell|
|
35
|
+
# # val = cell&.value
|
36
|
+
# # cell.change_contents(cell.value.to_i + 100) # Sets value of cell A1 to empty string, preserves formula
|
37
|
+
# # # if val
|
38
|
+
# # # cell.change_contents(val.to_i+100, cell.formula) # Sets value of cell A1 to empty string, preserves formula
|
39
|
+
# # # end
|
40
|
+
# # # print(val)
|
41
|
+
# # end
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# worksheet.each do |row|
|
45
|
+
# row_cells = row.cells.map(&:value)
|
19
46
|
# num_rows += 1
|
20
47
|
#
|
21
48
|
# # uncomment to print out row values
|
22
|
-
#
|
49
|
+
# puts row_cells.join ' '
|
23
50
|
# end
|
24
51
|
# puts "Read #{num_rows} rows"
|
25
52
|
# end
|
26
53
|
#
|
54
|
+
# workbook.write("res.xlsx")
|
55
|
+
#
|
27
56
|
# puts 'Done'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# require "sablon"
|
2
|
+
# # template = Sablon.template(File.expand_path("./template.docx"))
|
3
|
+
# # context = {
|
4
|
+
# # title: "Fabulous Document",
|
5
|
+
# # technologies: ["Ruby", "HTML", "ODF"]
|
6
|
+
# # }
|
7
|
+
# # template.render_to_file File.expand_path("./output.docx"), context
|
8
|
+
#
|
9
|
+
# word_processing_ml = <<-XML.gsub("\n", "")
|
10
|
+
# <w:p>
|
11
|
+
# <w:r w:rsidRPr="00B97C39">
|
12
|
+
# <w:rPr>
|
13
|
+
# <w:b />
|
14
|
+
# </w:rPr>
|
15
|
+
# <w:t>this is bold text</w:t>
|
16
|
+
# </w:r>
|
17
|
+
# </w:p>
|
18
|
+
# XML
|
19
|
+
# context = {
|
20
|
+
# long_description: Sablon.content(:word_ml, word_processing_ml)
|
21
|
+
# }
|
22
|
+
# # template.render_to_file File.expand_path("~/Desktop/output.docx"), context
|
23
|
+
#
|
24
|
+
# template.render_to_file File.expand_path("./output.docx"), context
|
Binary file
|
Binary file
|
data/lib/cuker/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ufo2mstar
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-06-
|
11
|
+
date: 2019-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: require_all
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,20 +94,6 @@ dependencies:
|
|
108
94
|
- - "~>"
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '5.1'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: thor
|
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
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: highline
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,12 +145,13 @@ files:
|
|
173
145
|
- lib/cuker/cuker_cmd.rb
|
174
146
|
- lib/cuker/gherkin_reporter.rb
|
175
147
|
- lib/cuker/gherkin_ripper.rb
|
176
|
-
- lib/cuker/helpers/
|
148
|
+
- lib/cuker/helpers/_interface.rb
|
177
149
|
- lib/cuker/helpers/file_helper.rb
|
178
150
|
- lib/cuker/helpers/formatters/abstract_model.rb
|
179
151
|
- lib/cuker/helpers/formatters/csv_model.rb
|
180
152
|
- lib/cuker/helpers/formatters/jira_model.rb
|
181
153
|
- lib/cuker/helpers/formatters/jira_mono_model.rb
|
154
|
+
- lib/cuker/helpers/formatters/ruby_x_l_model.rb
|
182
155
|
- lib/cuker/helpers/formatters/title.rb
|
183
156
|
- lib/cuker/helpers/gherkin_helper.rb
|
184
157
|
- lib/cuker/helpers/string_helper.rb
|
@@ -186,9 +159,13 @@ files:
|
|
186
159
|
- lib/cuker/helpers/writers/csv_writer.rb
|
187
160
|
- lib/cuker/helpers/writers/jira_writer.rb
|
188
161
|
- lib/cuker/helpers/writers/ruby_x_l_writer.rb
|
162
|
+
- lib/cuker/helpers/writers/simple_macro_template.xlsm
|
189
163
|
- lib/cuker/high.rb
|
190
164
|
- lib/cuker/log_utils.rb
|
191
165
|
- lib/cuker/test/ruby_xl.rb
|
166
|
+
- lib/cuker/test/sablon-try.rb
|
167
|
+
- lib/cuker/test/template.docx
|
168
|
+
- lib/cuker/test/xlsx_500_rows.xlsx
|
192
169
|
- lib/cuker/version.rb
|
193
170
|
- reports/.gitignore
|
194
171
|
- spec.bat
|