Almirah 0.2.2 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/almirah/doc_fabric.rb +21 -2
- data/lib/almirah/doc_items/blockquote.rb +2 -2
- data/lib/almirah/doc_items/code_block.rb +2 -2
- data/lib/almirah/doc_items/controlled_paragraph.rb +100 -79
- data/lib/almirah/doc_items/controlled_table.rb +181 -134
- data/lib/almirah/doc_items/controlled_table_row.rb +3 -3
- data/lib/almirah/doc_items/doc_footer.rb +2 -2
- data/lib/almirah/doc_items/doc_item.rb +1 -1
- data/lib/almirah/doc_items/heading.rb +80 -85
- data/lib/almirah/doc_items/image.rb +2 -2
- data/lib/almirah/doc_items/markdown_list.rb +134 -143
- data/lib/almirah/doc_items/markdown_table.rb +52 -48
- data/lib/almirah/doc_items/paragraph.rb +6 -4
- data/lib/almirah/doc_items/text_line.rb +247 -264
- data/lib/almirah/doc_items/todo_block.rb +2 -2
- data/lib/almirah/doc_parser.rb +56 -60
- data/lib/almirah/doc_types/base_document.rb +1 -0
- data/lib/almirah/doc_types/coverage.rb +4 -1
- data/lib/almirah/doc_types/index.rb +26 -18
- data/lib/almirah/doc_types/specification.rb +56 -93
- data/lib/almirah/doc_types/traceability.rb +6 -2
- data/lib/almirah/dom/doc_section.rb +21 -24
- data/lib/almirah/dom/document.rb +66 -57
- data/lib/almirah/project.rb +257 -275
- data/lib/almirah/search/specifications_db.rb +18 -1
- data/lib/almirah/templates/css/main.css +5 -2
- data/lib/almirah/templates/page.html +4 -2
- data/lib/almirah/templates/scripts/main.js +54 -3
- metadata +2 -2
data/lib/almirah/doc_parser.rb
CHANGED
@@ -24,10 +24,7 @@ class DocParser
|
|
24
24
|
if s.lstrip != ''
|
25
25
|
if res = /^(\#{1,})\s(.*)/.match(s) # Heading
|
26
26
|
|
27
|
-
|
28
|
-
doc.items.append temp_md_table
|
29
|
-
temp_md_table = nil
|
30
|
-
end
|
27
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
31
28
|
if temp_md_list
|
32
29
|
doc.items.append temp_md_list
|
33
30
|
temp_md_list = nil
|
@@ -58,10 +55,7 @@ class DocParser
|
|
58
55
|
|
59
56
|
elsif res = /^\[(\S*)\]\s+(.*)/.match(s) # Controlled Paragraph
|
60
57
|
|
61
|
-
|
62
|
-
doc.items.append temp_md_table
|
63
|
-
temp_md_table = nil
|
64
|
-
end
|
58
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
65
59
|
if temp_md_list
|
66
60
|
doc.items.append temp_md_list
|
67
61
|
temp_md_list = nil
|
@@ -137,10 +131,7 @@ class DocParser
|
|
137
131
|
|
138
132
|
elsif res = /^!\[(.*)\]\((.*)\)/.match(s) # Image
|
139
133
|
|
140
|
-
|
141
|
-
doc.items.append temp_md_table
|
142
|
-
temp_md_table = nil
|
143
|
-
end
|
134
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
144
135
|
if temp_md_list
|
145
136
|
doc.items.append temp_md_list
|
146
137
|
temp_md_list = nil
|
@@ -157,35 +148,29 @@ class DocParser
|
|
157
148
|
|
158
149
|
elsif res = /^(\*\s+)(.*)/.match(s) # check if unordered list start
|
159
150
|
|
160
|
-
|
161
|
-
doc.items.append temp_md_table
|
162
|
-
temp_md_table = nil
|
163
|
-
end
|
151
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
164
152
|
|
165
153
|
row = res[2]
|
166
154
|
|
167
155
|
if temp_md_list
|
168
|
-
temp_md_list.
|
156
|
+
temp_md_list.add_row(s)
|
169
157
|
else
|
170
158
|
item = MarkdownList.new(doc, false)
|
171
|
-
item.
|
159
|
+
item.add_row(s)
|
172
160
|
temp_md_list = item
|
173
161
|
end
|
174
162
|
|
175
163
|
elsif res = /^\d[.]\s(.*)/.match(s) # check if ordered list start
|
176
164
|
|
177
|
-
|
178
|
-
doc.items.append temp_md_table
|
179
|
-
temp_md_table = nil
|
180
|
-
end
|
165
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
181
166
|
|
182
167
|
row = res[1]
|
183
168
|
|
184
169
|
if temp_md_list
|
185
|
-
temp_md_list.
|
170
|
+
temp_md_list.add_row(s)
|
186
171
|
else
|
187
172
|
item = MarkdownList.new(doc, true)
|
188
|
-
item.
|
173
|
+
item.add_row(s)
|
189
174
|
temp_md_list = item
|
190
175
|
end
|
191
176
|
|
@@ -199,39 +184,50 @@ class DocParser
|
|
199
184
|
if res = /^[|](-{3,})[|]/.match(s) # check if it is a separator first
|
200
185
|
|
201
186
|
if temp_md_table
|
202
|
-
# separator is found after heading
|
187
|
+
# separator is found after heading
|
188
|
+
temp_md_table.is_separator_detected = true
|
203
189
|
else
|
204
190
|
# separator out of table scope consider it just as a regular paragraph
|
205
|
-
item = Paragraph.new(s)
|
206
|
-
item.parent_doc = doc
|
207
|
-
item.parent_heading = doc.headings[-1]
|
191
|
+
item = Paragraph.new(doc, s)
|
208
192
|
doc.items.append(item)
|
209
193
|
end
|
210
194
|
|
211
|
-
elsif res = /^[|](.*[|])/.match(s) # check if it looks as a table
|
195
|
+
elsif res = /^[|](.*[|])/.match(s) # check if it looks as a table row
|
212
196
|
|
213
197
|
row = res[1]
|
214
198
|
|
215
199
|
if temp_md_table
|
216
|
-
#
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
200
|
+
if temp_md_table.is_separator_detected # if there is a separator
|
201
|
+
# check if parent doc is a Protocol
|
202
|
+
if doc.instance_of? Protocol
|
203
|
+
# check if it is a controlled table
|
204
|
+
tmp = /(.*)\s+>\[(\S*)\]/.match(row)
|
205
|
+
if tmp && (temp_md_table.instance_of? MarkdownTable)
|
206
|
+
# this is not a regular Markdown table
|
207
|
+
# so the table type shall be changed and this row shall be passed one more time
|
208
|
+
temp_md_table = ControlledTable.new(doc, temp_md_table)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
temp_md_table.add_row(row)
|
212
|
+
else
|
213
|
+
# replece table heading with regular paragraph
|
214
|
+
item = Paragraph.new(doc, temp_md_table.heading_row)
|
215
|
+
doc.items.append(item)
|
216
|
+
# and current row
|
217
|
+
item = Paragraph.new(doc, s)
|
218
|
+
doc.items.append(item)
|
219
|
+
temp_md_table = nil
|
221
220
|
end
|
222
221
|
else
|
223
222
|
# start table from heading
|
224
|
-
temp_md_table = MarkdownTable.new(
|
225
|
-
temp_md_table.parent_doc = doc
|
223
|
+
temp_md_table = MarkdownTable.new(doc, s)
|
226
224
|
end
|
227
225
|
end
|
228
226
|
|
229
227
|
elsif res = /^>(.*)/.match(s) # check if blockquote
|
230
228
|
|
231
|
-
|
232
|
-
|
233
|
-
temp_md_table = nil
|
234
|
-
end
|
229
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
230
|
+
|
235
231
|
if temp_md_list
|
236
232
|
doc.items.append temp_md_list
|
237
233
|
temp_md_list = nil
|
@@ -244,10 +240,7 @@ class DocParser
|
|
244
240
|
|
245
241
|
elsif res = /^```(\w*)/.match(s) # check if code block
|
246
242
|
|
247
|
-
|
248
|
-
doc.items.append temp_md_table
|
249
|
-
temp_md_table = nil
|
250
|
-
end
|
243
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
251
244
|
if temp_md_list
|
252
245
|
doc.items.append temp_md_list
|
253
246
|
temp_md_list = nil
|
@@ -268,10 +261,7 @@ class DocParser
|
|
268
261
|
|
269
262
|
elsif res = /^TODO:(.*)/.match(s) # check if TODO block
|
270
263
|
|
271
|
-
|
272
|
-
doc.items.append temp_md_table
|
273
|
-
temp_md_table = nil
|
274
|
-
end
|
264
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
275
265
|
if temp_md_list
|
276
266
|
doc.items.append temp_md_list
|
277
267
|
temp_md_list = nil
|
@@ -286,13 +276,10 @@ class DocParser
|
|
286
276
|
doc.todo_blocks.append(item)
|
287
277
|
|
288
278
|
else # Reqular Paragraph
|
289
|
-
|
290
|
-
doc.items.append temp_md_table
|
291
|
-
temp_md_table = nil
|
292
|
-
end
|
279
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
293
280
|
if temp_md_list
|
294
281
|
if MarkdownList.unordered_list_item?(s) || MarkdownList.ordered_list_item?(s)
|
295
|
-
temp_md_list.
|
282
|
+
temp_md_list.add_row(s)
|
296
283
|
next
|
297
284
|
else
|
298
285
|
doc.items.append temp_md_list
|
@@ -302,9 +289,7 @@ class DocParser
|
|
302
289
|
if temp_code_block
|
303
290
|
temp_code_block.code_lines.append(s)
|
304
291
|
else
|
305
|
-
item = Paragraph.new(s)
|
306
|
-
item.parent_doc = doc
|
307
|
-
item.parent_heading = doc.headings[-1]
|
292
|
+
item = Paragraph.new(doc, s)
|
308
293
|
doc.items.append(item)
|
309
294
|
end
|
310
295
|
end
|
@@ -314,10 +299,7 @@ class DocParser
|
|
314
299
|
end
|
315
300
|
end
|
316
301
|
# Finalize non-closed elements
|
317
|
-
|
318
|
-
doc.items.append temp_md_table
|
319
|
-
temp_md_table = nil
|
320
|
-
end
|
302
|
+
temp_md_table = process_temp_table(doc, temp_md_table)
|
321
303
|
if temp_md_list
|
322
304
|
doc.items.append temp_md_list
|
323
305
|
temp_md_list = nil
|
@@ -331,4 +313,18 @@ class DocParser
|
|
331
313
|
item.parent_doc = doc
|
332
314
|
doc.items.append(item)
|
333
315
|
end
|
316
|
+
|
317
|
+
def self.process_temp_table(doc, temp_md_table) # rubocop:disable Metrics/MethodLength
|
318
|
+
if temp_md_table
|
319
|
+
if temp_md_table.is_separator_detected
|
320
|
+
doc.items.append temp_md_table
|
321
|
+
else # no separator
|
322
|
+
# replece table heading with regular paragraph
|
323
|
+
item = Paragraph.new(doc, temp_md_table.heading_row)
|
324
|
+
doc.items.append(item)
|
325
|
+
end
|
326
|
+
temp_md_table = nil
|
327
|
+
end
|
328
|
+
temp_md_table
|
329
|
+
end
|
334
330
|
end
|
@@ -4,14 +4,16 @@ class Coverage < BaseDocument
|
|
4
4
|
|
5
5
|
attr_accessor :top_doc
|
6
6
|
attr_accessor :bottom_doc
|
7
|
+
attr_accessor :covered_items
|
7
8
|
|
8
9
|
def initialize(top_doc)
|
9
10
|
super()
|
10
11
|
@top_doc = top_doc
|
11
|
-
@bottom_doc =
|
12
|
+
@bottom_doc = nil
|
12
13
|
|
13
14
|
@id = top_doc.id + "-" + "tests"
|
14
15
|
@title = "Coverage Matrix: " + @id
|
16
|
+
@covered_items = {}
|
15
17
|
end
|
16
18
|
|
17
19
|
def to_console
|
@@ -64,6 +66,7 @@ class Coverage < BaseDocument
|
|
64
66
|
s += "\t\t<td class=\"item_id\" #{test_step_color}><a href=\"./../../tests/protocols/#{bottom_item.parent_doc.id}/#{bottom_item.parent_doc.id}.html##{bottom_item.id}\" class=\"external\">#{bottom_item.id}</a></td>\n"
|
65
67
|
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_item.columns[1].text}</td>\n"
|
66
68
|
s += "\t</tr>\n"
|
69
|
+
@covered_items[top_item.id.to_s.downcase] = top_item
|
67
70
|
end
|
68
71
|
else
|
69
72
|
s += "\t<tr>\n"
|
@@ -26,15 +26,15 @@ class Index < BaseDocument
|
|
26
26
|
s = "<h2>Specifications</h2>\n"
|
27
27
|
s += "<table class=\"controlled\">\n"
|
28
28
|
s += "\t<thead>\n"
|
29
|
-
s += "\t\t<th>Title</th>\n"
|
30
|
-
s += "\t\t<th>Items</th>\n"
|
31
|
-
s += "\t\t<th>Items<br>w/
|
32
|
-
s += "\t\t<th>Items<br>w/
|
33
|
-
s += "\t\t<th>Covered<br>by Tests</th>\n"
|
34
|
-
s += "\t\t<th>Duplicated<br>
|
35
|
-
s += "\t\t<th>Wrong<br>links</th>\n"
|
36
|
-
s += "\t\t<th>TODOs</th>\n"
|
37
|
-
s += "\t\t<th>Last Used<br>
|
29
|
+
s += "\t\t<th title=\"Document title\">Title</th>\n"
|
30
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs\">Items</th>\n"
|
31
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs with up-links\">Items<br>w/ Up-links</th>\n"
|
32
|
+
s += "\t\t<th title=\"Number of references from other documents\">Items<br>w/ Down-links</th>\n"
|
33
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs mentioned in Test Cases\">Covered <br>by Tests</th>\n"
|
34
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs that have the same ID\">Duplicated<br>IDs</th>\n"
|
35
|
+
s += "\t\t<th title=\"Number of Controlled Paragraphs that link to non-existing items\">Wrong<br>links</th>\n"
|
36
|
+
s += "\t\t<th title=\"Number of 'TODO:' blocks in document\">TODOs</th>\n"
|
37
|
+
s += "\t\t<th title=\"The last Controlled Paragraph sequence number (ID) used in the document\">Last Used<br>ID</th>\n"
|
38
38
|
s += "</thead>\n"
|
39
39
|
html_rows.append s
|
40
40
|
|
@@ -51,11 +51,11 @@ class Index < BaseDocument
|
|
51
51
|
if doc.duplicated_ids_number >0
|
52
52
|
s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
|
53
53
|
s += "<div id=\"DL_#{doc.id}\" style=\"display: block;\">"
|
54
|
-
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{doc.duplicated_ids_number.to_s}</a>"
|
54
|
+
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of Controlled Paragraphs that have the same ID\">#{doc.duplicated_ids_number.to_s}</a>"
|
55
55
|
s += "</div>"
|
56
56
|
s += "<div id=\"DLS_#{doc.id}\" style=\"display: none;\">"
|
57
57
|
doc.duplicates_list.each do |lnk|
|
58
|
-
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{lnk.id}\" class=\"external\">#{lnk.id}</a>\n<br>"
|
58
|
+
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{lnk.id}\" class=\"external\" title=\"Controlled Paragraph with duplicated ID\">#{lnk.id}</a>\n<br>"
|
59
59
|
end
|
60
60
|
s += "</div>"
|
61
61
|
s += "</td>\n"
|
@@ -66,11 +66,11 @@ class Index < BaseDocument
|
|
66
66
|
if doc.wrong_links_hash.length >0
|
67
67
|
s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
|
68
68
|
s += "<div id=\"DL_#{doc.id}wl\" style=\"display: block;\">"
|
69
|
-
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\">#{doc.wrong_links_hash.length.to_s}</a>"
|
69
|
+
s += "<a href=\"#\" onclick=\"downlink_OnClick(this.parentElement); return false;\" class=\"external\" title=\"Number of Controlled Paragraphs that link to non-existing items\">#{doc.wrong_links_hash.length.to_s}</a>"
|
70
70
|
s += "</div>"
|
71
71
|
s += "<div id=\"DLS_#{doc.id}wl\" style=\"display: none;\">"
|
72
72
|
doc.wrong_links_hash.each do |wrong_lnk, item|
|
73
|
-
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{item.id}\" class=\"external\">#{wrong_lnk}</a>\n<br>"
|
73
|
+
s += "\t\t\t<a href=\"./specifications/#{doc.id}/#{doc.id}.html##{item.id}\" class=\"external\" title=\"Controlled Paragraphs that link to non-existing items\">#{wrong_lnk}</a>\n<br>"
|
74
74
|
end
|
75
75
|
s += "</div>"
|
76
76
|
s += "</td>\n"
|
@@ -94,10 +94,10 @@ class Index < BaseDocument
|
|
94
94
|
s = "<h2>Traceability Matrices</h2>\n"
|
95
95
|
s += "<table class=\"controlled\">\n"
|
96
96
|
s += "\t<thead>\n"
|
97
|
-
s += "\t\t<th>Title</th>\n"
|
98
|
-
s += "\t\t<th>Coverage</th>\n"
|
99
|
-
s += "\t\t<th>Top Document</th>\n"
|
100
|
-
s += "\t\t<th>Bottom Document</th>\n"
|
97
|
+
s += "\t\t<th title=\"Traceability Matrix Title\">Title</th>\n"
|
98
|
+
s += "\t\t<th title=\"The ratio of Controlled Paragraphs mentioned in other documents and not-mentioned ones\">Coverage</th>\n"
|
99
|
+
s += "\t\t<th title=\"Document, that contains Cotroled Paragraphs to be referenced in Bottom document(s)\">Top Document</th>\n"
|
100
|
+
s += "\t\t<th title=\"Document(s), that contains references to Controlled Paragraphs from the Top Document\">Bottom Document</th>\n"
|
101
101
|
s += "</thead>\n"
|
102
102
|
html_rows.append s
|
103
103
|
|
@@ -136,6 +136,9 @@ class Index < BaseDocument
|
|
136
136
|
s += "<table class=\"controlled\">\n"
|
137
137
|
s += "\t<thead>\n"
|
138
138
|
s += "\t\t<th>Title</th>\n"
|
139
|
+
s += "\t\t<th title=\"The ratio of Controlled Paragraphs mentioned in test protocols \
|
140
|
+
and total number of Controlled Paragraphs\">Coverage</th>\n"
|
141
|
+
s += "\t\t<th title=\"Numbers of passed and failed test steps\">Test Results</th>\n"
|
139
142
|
s += "\t\t<th>Specification Covered</th>\n"
|
140
143
|
s += "</thead>\n"
|
141
144
|
html_rows.append s
|
@@ -144,8 +147,13 @@ class Index < BaseDocument
|
|
144
147
|
|
145
148
|
sorted_items.each do |doc|
|
146
149
|
s = "\t<tr>\n"
|
150
|
+
coverage = doc.covered_items.length.to_f / doc.top_doc.controlled_items.length * 100.0
|
147
151
|
s += "\t\t<td class=\"item_text\" style='padding: 5px;'><a href=\"./specifications/#{doc.id}/#{doc.id}.html\" class=\"external\">#{doc.title}</a></td>\n"
|
148
|
-
s += "\t\t<td class=\"
|
152
|
+
s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{'%.2f' % coverage}%</td>\n"
|
153
|
+
s += "\t\t<td class=\"item_id\" style='width: 7%;'> n/a </td>\n"
|
154
|
+
s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'>\
|
155
|
+
<i class=\"fa fa-file-text-o\" style='background-color: ##{doc.top_doc.color};'> </i>\
|
156
|
+
#{doc.top_doc.title}</td>\n"
|
149
157
|
s += "</tr>\n"
|
150
158
|
html_rows.append s
|
151
159
|
end
|
@@ -1,104 +1,67 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
attr_accessor :dictionary
|
6
|
-
attr_accessor :todo_blocks
|
7
|
-
attr_accessor :wrong_links_hash
|
8
|
-
|
9
|
-
attr_accessor :items_with_uplinks_number
|
10
|
-
attr_accessor :items_with_downlinks_number
|
11
|
-
attr_accessor :items_with_coverage_number
|
12
|
-
attr_accessor :duplicated_ids_number
|
13
|
-
attr_accessor :duplicates_list
|
14
|
-
attr_accessor :last_used_id
|
15
|
-
attr_accessor :last_used_id_number
|
16
|
-
attr_accessor :color
|
17
|
-
|
18
|
-
def initialize(fele_path)
|
19
|
-
super
|
20
|
-
@dictionary = Hash.new
|
21
|
-
@duplicates_list = Array.new
|
22
|
-
@todo_blocks = Array.new
|
23
|
-
@wrong_links_hash = Hash.new
|
24
|
-
|
25
|
-
@items_with_uplinks_number = 0
|
26
|
-
@items_with_downlinks_number = 0
|
27
|
-
@items_with_coverage_number = 0
|
28
|
-
@duplicated_ids_number = 0
|
29
|
-
@last_used_id = ""
|
30
|
-
@last_used_id_number = 0
|
31
|
-
|
32
|
-
@color = 'bbb'
|
3
|
+
require_relative 'persistent_document'
|
33
4
|
|
34
|
-
|
5
|
+
class Specification < PersistentDocument
|
6
|
+
attr_accessor :dictionary, :todo_blocks, :wrong_links_hash, :items_with_uplinks_number, :items_with_downlinks_number,
|
7
|
+
:items_with_coverage_number, :duplicated_ids_number, :duplicates_list, :last_used_id,
|
8
|
+
:last_used_id_number, :color
|
9
|
+
|
10
|
+
def initialize(fele_path)
|
11
|
+
super
|
12
|
+
@dictionary = {}
|
13
|
+
@duplicates_list = []
|
14
|
+
@todo_blocks = []
|
15
|
+
@wrong_links_hash = {}
|
16
|
+
|
17
|
+
@items_with_uplinks_number = 0
|
18
|
+
@items_with_downlinks_number = 0
|
19
|
+
@items_with_coverage_number = 0
|
20
|
+
@duplicated_ids_number = 0
|
21
|
+
@last_used_id = ''
|
22
|
+
@last_used_id_number = 0
|
23
|
+
|
24
|
+
@color = 'bbb'
|
25
|
+
|
26
|
+
@id = File.basename(fele_path, File.extname(fele_path)).downcase
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_console
|
30
|
+
puts ''
|
31
|
+
puts "\e[33mSpecification: #{@title}\e[0m"
|
32
|
+
puts '-' * 53
|
33
|
+
puts '| Number of Controlled Items | %10d |' % @controlled_items.length
|
34
|
+
puts format('| Number of Items w/ Up-links | %10d |', @items_with_uplinks_number)
|
35
|
+
puts format('| Number of Items w/ Down-links | %10d |', @items_with_downlinks_number)
|
36
|
+
|
37
|
+
# coverage
|
38
|
+
if @controlled_items.length.positive? && (@controlled_items.length == @items_with_coverage_number)
|
39
|
+
puts format("| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|", @items_with_coverage_number)
|
40
|
+
else
|
41
|
+
puts format('| Number of Items w/ Test Coverage | %10d |', @items_with_coverage_number)
|
35
42
|
end
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
puts "| Number of Items w/ Up-links | %10d |" % @items_with_uplinks_number
|
43
|
-
puts "| Number of Items w/ Down-links | %10d |" % @items_with_downlinks_number
|
44
|
-
|
45
|
-
# coverage
|
46
|
-
if (@controlled_items.length > 0) && (@controlled_items.length == @items_with_coverage_number)
|
47
|
-
puts "| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|" % @items_with_coverage_number
|
48
|
-
else
|
49
|
-
puts "| Number of Items w/ Test Coverage | %10d |" % @items_with_coverage_number
|
50
|
-
end
|
51
|
-
|
52
|
-
# duplicates
|
53
|
-
if @duplicated_ids_number >0
|
54
|
-
puts "| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|" % @duplicated_ids_number
|
55
|
-
else
|
56
|
-
puts "| Duplicated Item Ids found | %10d |" % @duplicated_ids_number
|
57
|
-
end
|
58
|
-
|
59
|
-
puts "| Last used Item Id |\e[1m\e[37m %10s \e[0m|" % @last_used_id
|
60
|
-
puts "-" * 53
|
44
|
+
# duplicates
|
45
|
+
if @duplicated_ids_number.positive?
|
46
|
+
puts format("| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|", @duplicated_ids_number)
|
47
|
+
else
|
48
|
+
puts format('| Duplicated Item Ids found | %10d |', @duplicated_ids_number)
|
61
49
|
end
|
62
50
|
|
63
|
-
|
51
|
+
puts format("| Last used Item Id |\e[1m\e[37m %10s \e[0m|", @last_used_id)
|
52
|
+
puts '-' * 53
|
53
|
+
end
|
64
54
|
|
65
|
-
|
55
|
+
def to_html(nav_pane, output_file_path)
|
56
|
+
html_rows = []
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
@items.each do |item|
|
70
|
-
a = item.to_html
|
71
|
-
#a = adjust_internal_links(a, nav_pane.specifications)
|
72
|
-
html_rows.append a
|
73
|
-
end
|
74
|
-
|
75
|
-
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
76
|
-
|
77
|
-
end
|
58
|
+
html_rows.append('')
|
78
59
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
if res = /(\w*)[.]md/.match(tmp[1])
|
83
|
-
id = res[1].downcase
|
84
|
-
res = /(\w*)[.]md(#.*)/.match(tmp[1])
|
85
|
-
|
86
|
-
specifications.each do |spec|
|
87
|
-
if spec.id.downcase == id
|
88
|
-
if res && res.length > 2
|
89
|
-
anchor = res[2]
|
90
|
-
line.sub!(/<a\shref="(.*)"\sclass="external">/,
|
91
|
-
"<a href=\".\\..\\#{id}\\#{id}.html#{anchor}\" class=\"external\">")
|
92
|
-
else
|
93
|
-
line.sub!(/<a\shref="(.*)"\sclass="external">/,
|
94
|
-
"<a href=\".\\..\\#{id}\\#{id}.html\" class=\"external\">")
|
95
|
-
end
|
96
|
-
break
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
return line
|
60
|
+
@items.each do |item|
|
61
|
+
a = item.to_html
|
62
|
+
html_rows.append a
|
102
63
|
end
|
103
64
|
|
104
|
-
|
65
|
+
save_html_to_file(html_rows, nav_pane, output_file_path)
|
66
|
+
end
|
67
|
+
end
|
@@ -8,11 +8,15 @@ class Traceability < BaseDocument
|
|
8
8
|
attr_accessor :is_agregated
|
9
9
|
attr_accessor :traced_items
|
10
10
|
|
11
|
-
def initialize(top_doc, bottom_doc
|
11
|
+
def initialize(top_doc, bottom_doc)
|
12
12
|
super()
|
13
13
|
@top_doc = top_doc
|
14
14
|
@bottom_doc = bottom_doc
|
15
|
-
@is_agregated =
|
15
|
+
@is_agregated = if bottom_doc
|
16
|
+
false
|
17
|
+
else
|
18
|
+
true
|
19
|
+
end
|
16
20
|
@traced_items = {}
|
17
21
|
|
18
22
|
if @is_agregated
|
@@ -1,28 +1,25 @@
|
|
1
1
|
class DocSection
|
2
|
+
attr_accessor :sections, :heading, :parent_section
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
def initialize(heading)
|
5
|
+
@sections = []
|
6
|
+
@heading = heading
|
7
|
+
@parent_section = nil
|
8
|
+
end
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
def to_html # rubocop:disable Metrics/MethodLength
|
11
|
+
s = ''
|
12
|
+
s += "\t<li onclick=\"nav_toggle_expand_list(this, event)\">" \
|
13
|
+
'<span class="fa-li"><i class="fa fa-minus-square-o"> </i></span>'
|
14
|
+
s += "<a href=\"##{@heading.anchor_id}\">#{@heading.get_section_info}</a>\n"
|
15
|
+
unless @sections.empty?
|
16
|
+
s += "\t\t<ul class=\"fa-ul\">\n"
|
17
|
+
@sections.each do |sub_section|
|
18
|
+
s += sub_section.to_html
|
19
|
+
end
|
20
|
+
s += "\t\t</ul>\n"
|
11
21
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
s += "<a href=\"\#" + @heading.anchor_id.to_s + "\">" + @heading.get_section_info + "</a>\n"
|
17
|
-
if @sections.length >0
|
18
|
-
s += "\t\t<ul class=\"fa-ul\">\n"
|
19
|
-
@sections.each do |sub_section|
|
20
|
-
s += sub_section.to_html()
|
21
|
-
end
|
22
|
-
s += "\t\t</ul>\n"
|
23
|
-
end
|
24
|
-
s += "</li>\n"
|
25
|
-
return s
|
26
|
-
end
|
27
|
-
|
28
|
-
end
|
22
|
+
s += "</li>\n"
|
23
|
+
s
|
24
|
+
end
|
25
|
+
end
|