cuker 0.4.5 → 0.4.9
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/lib/cuker/cuker_cmd.rb +1 -0
- data/lib/cuker/helpers/formatters/abstract_model.rb +1 -1
- data/lib/cuker/helpers/formatters/jira_model.rb +19 -3
- data/lib/cuker/helpers/formatters/jira_mono_model.rb +1 -1
- data/lib/cuker/helpers/string_helper.rb +39 -0
- data/lib/cuker/helpers/writers/csv_writer.rb +1 -0
- data/lib/cuker/helpers/writers/jira_writer.rb +1 -0
- data/lib/cuker/helpers/writers/ruby_x_l_writer.rb +6 -1
- data/lib/cuker/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea9e7c78907f9ffa3783fa4e6e657db008bbc27304f095f770c44977ad1587d1
|
4
|
+
data.tar.gz: 65890c29fbf590e0679ce8f05800a8ee2ff44c9a1656eccfc9908bbfa2a7f0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89e61d4e64248a0ce2ed460afe48a7f0980031a74f4ca3e0ec0d2d724e1d434307a12096d9152b38d55d9bc0dafc97235c08ef562ef7b05bf6b2e3e2e957cc11
|
7
|
+
data.tar.gz: 3e65628c004451840294afe37f07584b67f1173ed2a6a221e620023e29cc130266372edee34a4022c74fc8bb85b18013a8ef4406f8472634f3583b4f86b91d71
|
data/lib/cuker/cuker_cmd.rb
CHANGED
@@ -40,7 +40,7 @@ module Cuker
|
|
40
40
|
|
41
41
|
def name_merge hsh
|
42
42
|
str = ""
|
43
|
-
@log.
|
43
|
+
@log.debug "name merge for #{hsh}"
|
44
44
|
str += hsh[:name].strip.force_encoding("UTF-8") if hsh[:name]
|
45
45
|
str += "\n#{hsh[:description].strip.force_encoding("UTF-8")}" if hsh[:description]
|
46
46
|
str
|
@@ -3,6 +3,9 @@ module Cuker
|
|
3
3
|
class JiraModel < AbstractModel
|
4
4
|
include LoggerSetup
|
5
5
|
|
6
|
+
include StringHelper
|
7
|
+
TITLE_MAX_LEN = 40
|
8
|
+
|
6
9
|
JIRA_BLANK = ' '
|
7
10
|
JIRA_TITLE_SEP = '||'
|
8
11
|
JIRA_ROW_SEP = '|'
|
@@ -74,7 +77,7 @@ module Cuker
|
|
74
77
|
title_str = ''
|
75
78
|
# feat handle
|
76
79
|
title_str += jira_title 'Feature', feat_title
|
77
|
-
title_str += jira_title('Background', title) if
|
80
|
+
title_str += jira_title('Background', title) if type == :Background
|
78
81
|
row_hsh = {
|
79
82
|
:s_num => "#{feat_counter}",
|
80
83
|
:s_title => surround_panel(title_str),
|
@@ -224,7 +227,7 @@ module Cuker
|
|
224
227
|
res = []
|
225
228
|
arg[:rows].each_with_index do |row, i|
|
226
229
|
sep = i == 0 ? '||' : '|'
|
227
|
-
res << surround(row[:cells].map {|hsh| hsh[:value]}, sep)
|
230
|
+
res << surround(row[:cells].map {|hsh| jira_blank_pad hsh[:value]}, sep)
|
228
231
|
end
|
229
232
|
return res
|
230
233
|
elsif arg[:type] == :DocString
|
@@ -236,6 +239,14 @@ module Cuker
|
|
236
239
|
[]
|
237
240
|
end
|
238
241
|
|
242
|
+
def name_merge hsh, max_len = TITLE_MAX_LEN
|
243
|
+
str = ""
|
244
|
+
@log.debug "name merge for #{hsh} with max_len (#{max_len})"
|
245
|
+
str += add_newlines!(hsh[:name].strip.force_encoding("UTF-8"), max_len) if hsh[:name]
|
246
|
+
str += add_newlines!("\n#{hsh[:description].strip.force_encoding("UTF-8")}", max_len) if hsh[:description]
|
247
|
+
str
|
248
|
+
end
|
249
|
+
|
239
250
|
def surround_panel str, title = nil
|
240
251
|
if title
|
241
252
|
"{panel:title = #{title}} #{str} {panel}"
|
@@ -253,7 +264,7 @@ module Cuker
|
|
253
264
|
end
|
254
265
|
|
255
266
|
def jira_title keyword, title
|
256
|
-
"#{jira_bold "#{keyword}:"} #{title}\n "
|
267
|
+
"#{jira_bold "#{keyword}:"}\n #{title}\n "
|
257
268
|
end
|
258
269
|
|
259
270
|
def jira_arg_hilight(str)
|
@@ -275,5 +286,10 @@ module Cuker
|
|
275
286
|
def jira_italics(str)
|
276
287
|
simple_surround(str, '_')
|
277
288
|
end
|
289
|
+
|
290
|
+
def jira_blank_pad str
|
291
|
+
s = str.strip
|
292
|
+
s.empty? ? JIRA_BLANK : s
|
293
|
+
end
|
278
294
|
end
|
279
295
|
end
|
@@ -40,7 +40,7 @@ module Cuker
|
|
40
40
|
res = []
|
41
41
|
arg[:rows].each_with_index do |row, i|
|
42
42
|
sep = i == 0 ? '||' : '|'
|
43
|
-
res << surround(row[:cells].map {|hsh| jira_monospace(hsh[:value])}, sep)
|
43
|
+
res << surround(row[:cells].map {|hsh| jira_monospace(jira_blank_pad hsh[:value])}, sep)
|
44
44
|
end
|
45
45
|
return res
|
46
46
|
elsif arg[:type] == :DocString
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module StringHelper
|
2
|
+
|
3
|
+
def add_newlines_regex(str, max_len)
|
4
|
+
str.scan(/.{1,#{max_len}}.*?(?:\b|$)/).join "\n"
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_newlines!(str, max_len)
|
8
|
+
index = max_len - 1
|
9
|
+
until index >= str.length
|
10
|
+
if str[index] == ' '
|
11
|
+
str[index] = "\n"
|
12
|
+
index += max_len
|
13
|
+
else
|
14
|
+
index += 1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
str
|
18
|
+
end
|
19
|
+
|
20
|
+
def add_newlines(str, max_len)
|
21
|
+
words = str.split(' ')
|
22
|
+
lines = []
|
23
|
+
current_line = []
|
24
|
+
current_len = 0
|
25
|
+
until words.empty?
|
26
|
+
next_word = words.shift
|
27
|
+
current_line << next_word
|
28
|
+
current_len += next_word.length + 1
|
29
|
+
if current_len >= max_len
|
30
|
+
lines << current_line.join(' ')
|
31
|
+
current_line = []
|
32
|
+
current_len = 0
|
33
|
+
end
|
34
|
+
end
|
35
|
+
lines << current_line.join(' ') unless current_line.empty?
|
36
|
+
lines.join("\n")
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -28,7 +28,12 @@ module Cuker
|
|
28
28
|
end
|
29
29
|
|
30
30
|
class RubyXLSheet < AbstractSheet
|
31
|
-
|
31
|
+
def initialize file_name
|
32
|
+
super file_name
|
33
|
+
@log.info "Making new #{self.class} => #{file_name}"
|
34
|
+
# @jira_file = File.open(file_name, "wb")
|
35
|
+
end
|
36
|
+
|
32
37
|
end
|
33
38
|
end
|
34
39
|
end
|
data/lib/cuker/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cuker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ufo2mstar
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- lib/cuker/helpers/formatters/jira_mono_model.rb
|
168
168
|
- lib/cuker/helpers/formatters/title.rb
|
169
169
|
- lib/cuker/helpers/gherkin_helper.rb
|
170
|
+
- lib/cuker/helpers/string_helper.rb
|
170
171
|
- lib/cuker/helpers/writers/abstract_writer.rb
|
171
172
|
- lib/cuker/helpers/writers/csv_writer.rb
|
172
173
|
- lib/cuker/helpers/writers/jira_writer.rb
|