cuker 0.5.15 → 0.5.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cuker/cuker_cmd.rb +30 -19
- data/lib/cuker/gherkin_reporter.rb +7 -2
- data/lib/cuker/gherkin_ripper.rb +9 -7
- data/lib/cuker/helpers/formatters/abstract_model.rb +1 -1
- data/lib/cuker/helpers/formatters/jira_model.rb +11 -11
- data/lib/cuker/helpers/formatters/ruby_x_l_model.rb +63 -26
- data/lib/cuker/helpers/writers/abstract_writer.rb +8 -0
- data/lib/cuker/helpers/writers/csv_writer.rb +3 -3
- data/lib/cuker/helpers/writers/jira_writer.rb +3 -3
- data/lib/cuker/helpers/writers/ruby_x_l_writer.rb +18 -11
- data/lib/cuker/helpers/writers/simple_macro_template.xlsm +0 -0
- data/lib/cuker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7969f3a6f08ea4d5b63178fb158efa0da89a8aa1444fc1c1fe991ae6781adb6e
|
4
|
+
data.tar.gz: abfc21dc42ae79816b24df697c5d7ceff360c69abc35f4d75c682acf5a4ace04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 532fd2f5ba0374dfbf3b1c28eb8b2a43ceb2402449c49e45d647f05ff128c0ceeeebb1be7ed87c2df12f37f6dd234fc7e35c8fc61f8dcf2b7516c89ea952b686
|
7
|
+
data.tar.gz: d7538e53094c40302fd459b249bc5c106f0ac30ce5ef4d27c4a55b8841ce1963acbce8a85cc11ec4930d8c37125cad8e4e1f826454d400b2402b3b27e98fa3c0
|
data/lib/cuker/cuker_cmd.rb
CHANGED
@@ -19,34 +19,45 @@ module Cuker
|
|
19
19
|
class CukerCmd
|
20
20
|
include LoggerSetup
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
22
|
+
PRODUCERS = {}
|
23
|
+
PRODUCERS[:simple_csv] = [CsvModel, CsvWriter]
|
24
|
+
PRODUCERS[:simple_jira] = [JiraModel, JiraWriter]
|
25
|
+
PRODUCERS[:monospaced_jira] = [JiraMonoModel, JiraWriter]
|
26
|
+
PRODUCERS[:jira_excel] = [RubyXLModel, RubyXLWriter]
|
27
|
+
|
28
|
+
PRESETS = {}
|
29
|
+
PRESETS[:jira_package] = [:simple_jira, :jira_excel]
|
30
|
+
PRESETS[:jira_text] = [:simple_jira]
|
31
|
+
PRESETS[:jira_excel] = [:jira_excel]
|
32
|
+
|
29
33
|
|
30
34
|
# desc "report PRESET_KEY [FEATURE_PATH [REPORT_PATH [REPORT_FILE_NAME [LOG_LEVEL]]]]",
|
31
35
|
# "reports parsed results into \nREPORT_PATH/REPORT_FILE_NAME \nfor all '*.feature' files in the given FEATURE_PATH\nSTDIO LOG_LEVEL adjustable\n"
|
32
36
|
|
33
|
-
def report preset_key, feat_path = "../", report_file_name = 'sample_report',
|
37
|
+
def report preset_key, feat_path = "../", report_file_name = 'sample_report', report_path_input = ".", log_level = :info
|
34
38
|
init_logger log_level
|
35
|
-
|
39
|
+
output_files = []
|
40
|
+
producers = PRESETS[preset_key]
|
36
41
|
|
37
|
-
|
42
|
+
@log.info "Using preset: #{preset_key} => #{producers}"
|
43
|
+
gr = GherkinRipper.new feat_path
|
44
|
+
ast_map = gr.ast_map
|
38
45
|
|
39
|
-
|
40
|
-
|
46
|
+
producers.each do |producer|
|
47
|
+
report_path = File.join report_path_input, 'reports', LOG_TIME_TODAY
|
48
|
+
msg = "running '#{preset_key.to_s.upcase}' reporter @\n Feature Path: '#{feat_path}' \n Report Path => '#{report_path}' - '#{report_file_name}'\n"
|
41
49
|
|
42
|
-
|
50
|
+
@log.info msg
|
51
|
+
puts msg
|
52
|
+
model, writer = PRODUCERS[producer]
|
43
53
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
54
|
+
preset_model = model.new ast_map
|
55
|
+
preset_writer = writer.new
|
56
|
+
grr = GherkinReporter.new preset_writer, preset_model, report_path, report_file_name
|
57
|
+
|
58
|
+
output_files << File.expand_path(grr.write)
|
59
|
+
end
|
60
|
+
output_files
|
50
61
|
end
|
51
62
|
|
52
63
|
private
|
@@ -10,19 +10,24 @@ class GherkinReporter
|
|
10
10
|
|
11
11
|
attr_accessor :file_path, :workbook
|
12
12
|
|
13
|
-
def initialize(writer, model,
|
13
|
+
def initialize(writer, model, path, file_name = nil)
|
14
14
|
init_logger
|
15
15
|
|
16
16
|
@writer = writer
|
17
17
|
@model = model
|
18
18
|
|
19
|
-
@file_path = FileHelper.file_path(
|
19
|
+
@file_path = FileHelper.file_path(path, "#{LOG_TIME_NOW}_#{file_name}")
|
20
20
|
@log.info "Report file => #{@file_name}#{@writer.ext}"
|
21
21
|
end
|
22
22
|
|
23
23
|
def write
|
24
|
+
@writer.write @model, @file_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def old_write
|
24
28
|
# todo: why don't we just give the writer the model?
|
25
29
|
file_name = @writer.make_new_file @file_path
|
30
|
+
#todo: redo, causing issue!
|
26
31
|
@writer.write_title @model.title
|
27
32
|
@model.data.each {|row| @writer.write_new_row row}
|
28
33
|
@writer.finishup
|
data/lib/cuker/gherkin_ripper.rb
CHANGED
@@ -21,14 +21,15 @@ module Cuker
|
|
21
21
|
|
22
22
|
@location = path.strip
|
23
23
|
@location = '.' if @location.empty? # handle blank path searching all features
|
24
|
-
@features = get_features @location
|
25
24
|
|
26
|
-
|
25
|
+
ext = '.feature'
|
26
|
+
@features = get_files @location, ext
|
27
27
|
|
28
|
+
@log.trace "Gherkin ripper running at #{path}"
|
28
29
|
@parser = Gherkin::Parser.new
|
29
30
|
@ast_map = {}
|
30
31
|
|
31
|
-
@log.
|
32
|
+
@log.trace "Parsed '.feature' files @ #{path} = #{@features.size} files"
|
32
33
|
end
|
33
34
|
|
34
35
|
def ast_map
|
@@ -41,19 +42,20 @@ module Cuker
|
|
41
42
|
# if you need to ignore any pattern of files, change this regex to match those patterns
|
42
43
|
IGNORE_EXP = /^$/
|
43
44
|
|
44
|
-
# dir glob for all
|
45
|
-
# @param location dir location of all the
|
46
|
-
def
|
47
|
-
ext = '.feature'
|
45
|
+
# dir glob for all files with extension = ext
|
46
|
+
# @param location dir location of all the ext files
|
47
|
+
def get_files(path_or_file, ext = '.feature')
|
48
48
|
files = FileHelper.get_files(path_or_file, ext, IGNORE_EXP)
|
49
49
|
files = FileHelper.get_file(path_or_file, ext, IGNORE_EXP) if files.empty?
|
50
50
|
raise NoFilesFoundError.new "No '#{ext}' files found @ path '#{path_or_file}'... " if files.empty?
|
51
|
+
@log.info "Number of '#{ext}' files to parse : @#{path_or_file} = #{files.size}"
|
51
52
|
files
|
52
53
|
end
|
53
54
|
|
54
55
|
def parse_all
|
55
56
|
parse_hsh = {}
|
56
57
|
@features.each do |feat|
|
58
|
+
@log.info "Parsing file: #{feat}"
|
57
59
|
feature_text = File.read(feat)
|
58
60
|
scanner = TokenScanner.new(feature_text)
|
59
61
|
parse_handle(feat) {
|
@@ -56,7 +56,7 @@ module Cuker
|
|
56
56
|
|
57
57
|
def make_rows
|
58
58
|
if @asts.nil? or @asts.empty?
|
59
|
-
@log.
|
59
|
+
@log.debug "No asts to parse!"
|
60
60
|
return []
|
61
61
|
end
|
62
62
|
|
@@ -120,7 +120,7 @@ module Cuker
|
|
120
120
|
yield feat_tags, feat_title, child
|
121
121
|
end
|
122
122
|
else
|
123
|
-
@log.
|
123
|
+
@log.debug "No Features found in file @ #{@file_path}"
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
@@ -138,7 +138,7 @@ module Cuker
|
|
138
138
|
yield tags, item_title, child[:type], get_steps(child)
|
139
139
|
# todo: think about new examples in new lines
|
140
140
|
else
|
141
|
-
@log.
|
141
|
+
@log.debug "Unknown type '#{child[:type]}' found in file @ #{@file_path}"
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -152,7 +152,7 @@ module Cuker
|
|
152
152
|
content += in_example(hsh[:examples]) if hsh[:examples]
|
153
153
|
content
|
154
154
|
else
|
155
|
-
@log.
|
155
|
+
@log.debug "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
156
156
|
[]
|
157
157
|
end
|
158
158
|
end
|
@@ -173,7 +173,7 @@ module Cuker
|
|
173
173
|
eg_body.map {|row_hsh| res << surround(in_table_row(row_hsh), '|')}
|
174
174
|
|
175
175
|
else
|
176
|
-
@log.
|
176
|
+
@log.debug "Unknown type '#{item[:type]}' found in file @ #{@file_path}"
|
177
177
|
end
|
178
178
|
end
|
179
179
|
res
|
@@ -183,7 +183,7 @@ module Cuker
|
|
183
183
|
if row_hsh[:type] == :TableRow
|
184
184
|
row_hsh[:cells].map(&method(:in_table_cell))
|
185
185
|
else
|
186
|
-
@log.
|
186
|
+
@log.debug "Expected :TableRow in #{row_hsh} @ #{@file_path}"
|
187
187
|
[]
|
188
188
|
end
|
189
189
|
end
|
@@ -193,7 +193,7 @@ module Cuker
|
|
193
193
|
val = cell_hsh[:value].strip
|
194
194
|
val.empty? ? JIRA_BLANK : val
|
195
195
|
else
|
196
|
-
@log.
|
196
|
+
@log.debug "Expected :TableCell in #{cell_hsh} @ #{@file_path}"
|
197
197
|
JIRA_BLANK
|
198
198
|
end
|
199
199
|
end
|
@@ -214,7 +214,7 @@ module Cuker
|
|
214
214
|
# todo: padding as needed
|
215
215
|
yield step_ary
|
216
216
|
else
|
217
|
-
@log.
|
217
|
+
@log.debug "Unknown type '#{item[:type]}' found in file @ #{@file_path}"
|
218
218
|
end
|
219
219
|
end
|
220
220
|
end
|
@@ -230,16 +230,16 @@ module Cuker
|
|
230
230
|
return res
|
231
231
|
elsif arg[:type] == :DocString
|
232
232
|
# todo: handle if needed
|
233
|
-
@log.
|
233
|
+
@log.debug "Docstrings found in '#{arg}' found in file @ #{@file_path}"
|
234
234
|
else
|
235
|
-
@log.
|
235
|
+
@log.debug "Unknown type '#{arg[:type]}' found in file @ #{@file_path}"
|
236
236
|
end
|
237
237
|
[]
|
238
238
|
end
|
239
239
|
|
240
240
|
def name_merge hsh, max_len = TITLE_MAX_LEN
|
241
241
|
str = ""
|
242
|
-
@log.
|
242
|
+
@log.trace "name merge for #{hsh} with max_len (#{max_len})"
|
243
243
|
str += add_newlines!(hsh[:name].strip.force_encoding("UTF-8"), max_len) if hsh[:name]
|
244
244
|
str += add_newlines!("\n#{hsh[:description].strip.force_encoding("UTF-8")}", max_len) if hsh[:description]
|
245
245
|
str
|
@@ -1,8 +1,10 @@
|
|
1
1
|
require_relative '../writers/abstract_writer'
|
2
|
+
require 'text-table'
|
2
3
|
|
3
4
|
module Cuker
|
4
5
|
module ExcelSupport
|
5
6
|
EXCEL_BLANK = ''
|
7
|
+
EXCEL_TABLE_PADDING = 7
|
6
8
|
|
7
9
|
def surround_panel str, title = nil
|
8
10
|
if title
|
@@ -59,6 +61,32 @@ module Cuker
|
|
59
61
|
s.empty? ? EXCEL_BLANK : s
|
60
62
|
end
|
61
63
|
|
64
|
+
# Properly spaced out tables
|
65
|
+
# def tableify header_ary, rows_ary
|
66
|
+
# @return [Array] tableified string array
|
67
|
+
# https://www.rubydoc.info/gems/text-table/1.2.4
|
68
|
+
def tableify header_and_rows_ary, padding = 0
|
69
|
+
table = Text::Table.new(:horizontal_padding => 1,
|
70
|
+
:vertical_boundary => '-',
|
71
|
+
:horizontal_boundary => '|',
|
72
|
+
:boundary_intersection => '+',
|
73
|
+
# :boundary_intersection => '-',
|
74
|
+
# :boundary_intersection => ' ',
|
75
|
+
:first_row_is_head => true,
|
76
|
+
# :rows => header_and_rows_ary # works only for to_table
|
77
|
+
)
|
78
|
+
table.head = header_and_rows_ary[0]
|
79
|
+
table.rows = header_and_rows_ary[1..-1]
|
80
|
+
|
81
|
+
# table.to_s
|
82
|
+
# table.rows = header_and_rows_ary
|
83
|
+
#
|
84
|
+
# table = header_and_rows_ary.to_table(:first_row_is_head => true)
|
85
|
+
|
86
|
+
res = table.to_s.split("\n")
|
87
|
+
res.map {|row_str| ' ' * padding + row_str}
|
88
|
+
end
|
89
|
+
|
62
90
|
end
|
63
91
|
class RubyXLModel < AbstractModel
|
64
92
|
include LoggerSetup
|
@@ -74,7 +102,9 @@ module Cuker
|
|
74
102
|
EXCEL_ROW_SEP = '|'
|
75
103
|
EXCEL_EMPTY_LINE = ' '
|
76
104
|
EXCEL_NEW_LINE = "\n"
|
77
|
-
EXCEL_HORIZ_RULER = ''
|
105
|
+
EXCEL_HORIZ_RULER = ' '
|
106
|
+
|
107
|
+
EXCEL_OFFSET = 6
|
78
108
|
|
79
109
|
def initialize ast_map
|
80
110
|
super
|
@@ -92,6 +122,7 @@ module Cuker
|
|
92
122
|
|
93
123
|
def make_order
|
94
124
|
[
|
125
|
+
# todo: template{:col_key => ["Title text",fill_color,font, etc]},
|
95
126
|
{:counter => "Sl.No"},
|
96
127
|
{:feature => "Feature"},
|
97
128
|
{:background => "Background"},
|
@@ -127,16 +158,17 @@ module Cuker
|
|
127
158
|
|
128
159
|
def make_rows
|
129
160
|
if @asts.nil? or @asts.empty?
|
130
|
-
@log.
|
161
|
+
@log.debug "No asts to parse!"
|
131
162
|
return []
|
132
163
|
end
|
133
164
|
|
134
165
|
feat_counter = 1
|
135
|
-
feat_content =
|
136
|
-
bg_content =
|
166
|
+
feat_content = []
|
167
|
+
bg_content = []
|
137
168
|
|
138
169
|
res = []
|
139
170
|
@asts.each do |file_path, ast|
|
171
|
+
@log.debug "Understanding file: #{file_path}"
|
140
172
|
@file_path = file_path
|
141
173
|
in_feat_counter = 0
|
142
174
|
|
@@ -144,8 +176,8 @@ module Cuker
|
|
144
176
|
in_feature(ast) do |feat_tags_ary, feat_title, feat_item|
|
145
177
|
in_item(feat_item) do |tags_ary, type, item_title, content_ary, example_ary|
|
146
178
|
row_hsh = {}
|
179
|
+
feat_content = excel_title FEATURE, feat_title
|
147
180
|
if type == :Background or type == :Feature
|
148
|
-
feat_content = excel_title FEATURE, feat_title
|
149
181
|
bg_content = [excel_title(BACKGROUND, item_title)] + content_ary
|
150
182
|
else
|
151
183
|
# if type == :Scenario or type == :ScenarioOutline
|
@@ -160,6 +192,7 @@ module Cuker
|
|
160
192
|
row_hsh[:test_designer] = ""
|
161
193
|
row_hsh[:comments] = ""
|
162
194
|
|
195
|
+
# row_hsh[:examples] = "" # is nil by default
|
163
196
|
if type == :ScenarioOutline
|
164
197
|
row_hsh[:examples] = excel_content_format example_ary
|
165
198
|
end
|
@@ -172,8 +205,8 @@ module Cuker
|
|
172
205
|
end
|
173
206
|
end
|
174
207
|
feat_counter += 1
|
175
|
-
feat_title =
|
176
|
-
bg_content =
|
208
|
+
feat_title = []
|
209
|
+
bg_content = []
|
177
210
|
end
|
178
211
|
@file_path = nil
|
179
212
|
res
|
@@ -189,7 +222,7 @@ module Cuker
|
|
189
222
|
children = feat[:children]
|
190
223
|
children.each {|child| yield feat_tags, feat_title, child}
|
191
224
|
else
|
192
|
-
@log.
|
225
|
+
@log.debug "No Features found in file @ #{@file_path}"
|
193
226
|
end
|
194
227
|
end
|
195
228
|
|
@@ -207,7 +240,7 @@ module Cuker
|
|
207
240
|
yield tags, child[:type], item_title, get_steps(child), get_examples(child[:examples])
|
208
241
|
# todo: think about new examples in new lines
|
209
242
|
else
|
210
|
-
@log.
|
243
|
+
@log.debug "Unknown type '#{child[:type]}' found in file @ #{@file_path}"
|
211
244
|
end
|
212
245
|
end
|
213
246
|
|
@@ -216,37 +249,37 @@ module Cuker
|
|
216
249
|
if step[:type] == :Step
|
217
250
|
step_ary = []
|
218
251
|
step_str = [
|
219
|
-
((excel_bold(step[:keyword].strip)).rjust(
|
252
|
+
((excel_bold(step[:keyword].strip)).rjust(EXCEL_OFFSET)), # bolding the keywords
|
220
253
|
(step[:text].strip)
|
221
254
|
].join(' ')
|
222
255
|
|
223
256
|
# step_ary << excel_monospace(step_str)
|
224
257
|
step_ary << (step_str)
|
225
258
|
|
226
|
-
step_ary +=
|
259
|
+
step_ary += tableify(get_step_args(step[:argument]), EXCEL_TABLE_PADDING) if step[:argument]
|
227
260
|
# todo: DOC string handle?
|
228
|
-
# todo: padding as needed
|
229
261
|
yield step_ary
|
230
262
|
else
|
231
|
-
@log.
|
263
|
+
@log.debug "Unknown type '#{item[:type]}' found in file @ #{@file_path}"
|
232
264
|
end
|
233
265
|
end
|
234
266
|
end
|
235
267
|
|
236
268
|
# helps handle tables for now
|
237
|
-
def
|
269
|
+
def get_step_args arg
|
238
270
|
if arg[:type] == :DataTable
|
239
271
|
res = []
|
240
272
|
arg[:rows].each_with_index do |row, i|
|
241
|
-
sep = i == 0 ? EXCEL_TITLE_SEP : EXCEL_ROW_SEP
|
242
|
-
res << surround(row[:cells].map {|hsh| excel_blank_pad hsh[:value]}, sep)
|
273
|
+
# sep = i == 0 ? EXCEL_TITLE_SEP : EXCEL_ROW_SEP
|
274
|
+
# res << surround(row[:cells].map {|hsh| excel_blank_pad hsh[:value]}, sep)
|
275
|
+
res << row[:cells].map {|hsh| hsh[:value]}
|
243
276
|
end
|
244
277
|
return res
|
245
278
|
elsif arg[:type] == :DocString
|
246
279
|
# todo: handle if needed
|
247
|
-
@log.
|
280
|
+
@log.debug "Docstrings found in '#{arg}' found in file @ #{@file_path}"
|
248
281
|
else
|
249
|
-
@log.
|
282
|
+
@log.debug "Unknown type '#{arg[:type]}' found in file @ #{@file_path}"
|
250
283
|
end
|
251
284
|
[]
|
252
285
|
end
|
@@ -258,7 +291,7 @@ module Cuker
|
|
258
291
|
in_step(steps) {|step| content += step}
|
259
292
|
content
|
260
293
|
else
|
261
|
-
@log.
|
294
|
+
@log.debug "No Tags found in #{hsh[:keyword]} @ #{@file_path}"
|
262
295
|
[]
|
263
296
|
end
|
264
297
|
end
|
@@ -267,19 +300,23 @@ module Cuker
|
|
267
300
|
res = []
|
268
301
|
examples.each do |example|
|
269
302
|
if example[:type] == :Examples
|
270
|
-
#
|
303
|
+
# example_data << EXCEL_HORIZ_RULER
|
304
|
+
example_data = []
|
271
305
|
|
272
306
|
eg_title = excel_title EXAMPLES, get_title_ary(example)
|
273
307
|
res << eg_title
|
274
308
|
|
275
|
-
|
276
|
-
|
309
|
+
table_header = example[:tableHeader]
|
310
|
+
eg_header = table_header.nil? ? [] : get_table_row(table_header)
|
311
|
+
example_data << eg_header
|
277
312
|
|
278
313
|
eg_body = example[:tableBody]
|
279
|
-
eg_body.map {|row_hsh|
|
314
|
+
eg_body.map {|row_hsh| example_data << get_table_row(row_hsh)} unless eg_body.nil?
|
280
315
|
|
316
|
+
res << tableify(example_data)
|
317
|
+
res << EXCEL_HORIZ_RULER
|
281
318
|
else
|
282
|
-
@log.
|
319
|
+
@log.debug "Unknown type '#{example[:type]}' found in file @ #{@file_path}"
|
283
320
|
end
|
284
321
|
end
|
285
322
|
res
|
@@ -289,7 +326,7 @@ module Cuker
|
|
289
326
|
if row_hsh[:type] == :TableRow
|
290
327
|
row_hsh[:cells].map(&method(:get_table_cell))
|
291
328
|
else
|
292
|
-
@log.
|
329
|
+
@log.debug "Expected :TableRow in '#{row_hsh}' @ #{@file_path}"
|
293
330
|
[]
|
294
331
|
end
|
295
332
|
end
|
@@ -299,7 +336,7 @@ module Cuker
|
|
299
336
|
val = cell_hsh[:value].strip
|
300
337
|
val.empty? ? EXCEL_BLANK : val
|
301
338
|
else
|
302
|
-
@log.
|
339
|
+
@log.debug "Expected :TableCell in '#{cell_hsh}' @ #{@file_path}"
|
303
340
|
EXCEL_BLANK
|
304
341
|
end
|
305
342
|
end
|
@@ -70,6 +70,14 @@ module Cuker
|
|
70
70
|
def new_name name
|
71
71
|
name.nil? ? "Sheet_#{@book.size + 1}" : name
|
72
72
|
end
|
73
|
+
|
74
|
+
def write model, output_file_path
|
75
|
+
file_name = make_new_file output_file_path
|
76
|
+
write_title model.title
|
77
|
+
model.data.each {|row| write_new_row row}
|
78
|
+
finishup
|
79
|
+
file_name
|
80
|
+
end
|
73
81
|
end
|
74
82
|
|
75
83
|
class AbstractFile
|
@@ -10,13 +10,13 @@ module Cuker
|
|
10
10
|
|
11
11
|
def write_title title_ary
|
12
12
|
super title_ary
|
13
|
-
@log.
|
13
|
+
@log.trace "csv write title"
|
14
14
|
@active_file.add_row title_ary
|
15
15
|
end
|
16
16
|
|
17
17
|
def write_new_row row_ary
|
18
18
|
super row_ary
|
19
|
-
@log.
|
19
|
+
@log.trace "csv write row: #{row_ary}"
|
20
20
|
@active_file.add_row row_ary
|
21
21
|
end
|
22
22
|
|
@@ -43,7 +43,7 @@ module Cuker
|
|
43
43
|
class CsvFile < AbstractFile
|
44
44
|
def initialize file_name
|
45
45
|
super file_name
|
46
|
-
@log.
|
46
|
+
@log.debug "Making new #{self.class} => #{file_name}"
|
47
47
|
@csv_sheet = CSV.open(file_name, "wb")
|
48
48
|
@csv_sheet.close
|
49
49
|
end
|
@@ -10,13 +10,13 @@ module Cuker
|
|
10
10
|
|
11
11
|
def write_title title_line
|
12
12
|
super title_line
|
13
|
-
@log.
|
13
|
+
@log.trace "JW write title: #{title_line}"
|
14
14
|
@active_file.add_line title_line
|
15
15
|
end
|
16
16
|
|
17
17
|
def write_new_row row_line
|
18
18
|
super row_line
|
19
|
-
@log.
|
19
|
+
@log.trace "JW write row: #{row_line}"
|
20
20
|
@active_file.add_line row_line
|
21
21
|
end
|
22
22
|
|
@@ -37,7 +37,7 @@ module Cuker
|
|
37
37
|
class JiraFile < AbstractFile
|
38
38
|
def initialize file_name
|
39
39
|
super file_name
|
40
|
-
@log.
|
40
|
+
@log.debug "Making new #{self.class} => #{file_name}"
|
41
41
|
@jira_file = File.open(file_name, "wb")
|
42
42
|
@jira_file.close
|
43
43
|
end
|
@@ -12,13 +12,13 @@ module Cuker
|
|
12
12
|
|
13
13
|
def write_title title_ary
|
14
14
|
super title_ary
|
15
|
-
@log.
|
15
|
+
@log.trace "rxl write title: #{title_ary}"
|
16
16
|
@active_file.add_row title_ary
|
17
17
|
end
|
18
18
|
|
19
19
|
def write_new_row row_ary
|
20
20
|
super row_ary
|
21
|
-
@log.
|
21
|
+
@log.trace "rxl write row: #{row_ary}"
|
22
22
|
@active_file.add_row row_ary
|
23
23
|
end
|
24
24
|
|
@@ -40,6 +40,13 @@ module Cuker
|
|
40
40
|
def finishup
|
41
41
|
@active_file.finishup if @active_file
|
42
42
|
end
|
43
|
+
|
44
|
+
def write model, output_file_path
|
45
|
+
file_name = make_new_file output_file_path
|
46
|
+
model.data.each(&method(:write_new_row))
|
47
|
+
finishup
|
48
|
+
file_name
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
52
|
class RubyXLFile < AbstractFile
|
@@ -55,7 +62,7 @@ module Cuker
|
|
55
62
|
@file_name = premade ? template_file_name : file_name
|
56
63
|
|
57
64
|
super @file_name
|
58
|
-
@log.
|
65
|
+
@log.debug "Making new #{self.class} => #{@file_name}"
|
59
66
|
|
60
67
|
@workbook = premade ? RubyXL::Parser.parse(@file_name) : RubyXL::Workbook.new
|
61
68
|
# @workbook.add_worksheet('Acceptance Tests')
|
@@ -70,7 +77,7 @@ module Cuker
|
|
70
77
|
locate_sheet 'test_id'
|
71
78
|
|
72
79
|
# @worksheet = @workbook[0]
|
73
|
-
@worksheet = @workbook['Acceptance Tests']
|
80
|
+
@worksheet = @workbook['Acceptance Tests raw']
|
74
81
|
|
75
82
|
|
76
83
|
@rows = sheet_rows.dup # starting Row
|
@@ -114,14 +121,14 @@ module Cuker
|
|
114
121
|
|
115
122
|
link_sheet_name = "#{ary[0]} results"
|
116
123
|
workbook.add_worksheet(link_sheet_name)
|
117
|
-
back_link_value = @link_sheet[0][0].value
|
118
|
-
back_link_formula = @link_sheet[0][0].formula
|
119
|
-
@workbook[link_sheet_name].add_cell(0, 0, back_link_value, back_link_formula)
|
124
|
+
# back_link_value = @link_sheet[0][0].value
|
125
|
+
# back_link_formula = @link_sheet[0][0].formula
|
126
|
+
# @workbook[link_sheet_name].add_cell(0, 0, back_link_value, back_link_formula)
|
120
127
|
# workbook.worksheets <<
|
121
|
-
|
128
|
+
# (link_sheet_name)
|
122
129
|
|
123
|
-
@log.
|
124
|
-
@log.
|
130
|
+
@log.trace workbook.worksheets.map(&:sheet_name)
|
131
|
+
# @log.debug sheet_rows
|
125
132
|
# @log.debug worksheet.rows
|
126
133
|
end
|
127
134
|
|
@@ -129,7 +136,7 @@ module Cuker
|
|
129
136
|
|
130
137
|
# @return ary of rows
|
131
138
|
def sheet_rows
|
132
|
-
|
139
|
+
worksheet.sheet_data.rows
|
133
140
|
end
|
134
141
|
|
135
142
|
def finishup
|
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.21
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|