Almirah 0.2.5 → 0.2.6

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/bin/almirah +4 -4
  3. data/lib/almirah/doc_fabric.rb +65 -65
  4. data/lib/almirah/doc_items/blockquote.rb +21 -21
  5. data/lib/almirah/doc_items/code_block.rb +26 -26
  6. data/lib/almirah/doc_items/controlled_paragraph.rb +112 -112
  7. data/lib/almirah/doc_items/controlled_table.rb +224 -224
  8. data/lib/almirah/doc_items/controlled_table_row.rb +22 -22
  9. data/lib/almirah/doc_items/doc_footer.rb +16 -16
  10. data/lib/almirah/doc_items/doc_item.rb +22 -22
  11. data/lib/almirah/doc_items/frontmatter.rb +9 -9
  12. data/lib/almirah/doc_items/heading.rb +93 -93
  13. data/lib/almirah/doc_items/image.rb +27 -27
  14. data/lib/almirah/doc_items/markdown_list.rb +156 -156
  15. data/lib/almirah/doc_items/markdown_table.rb +61 -61
  16. data/lib/almirah/doc_items/paragraph.rb +25 -25
  17. data/lib/almirah/doc_items/text_line.rb +296 -296
  18. data/lib/almirah/doc_items/todo_block.rb +21 -21
  19. data/lib/almirah/doc_parser.rb +378 -378
  20. data/lib/almirah/doc_types/base_document.rb +64 -64
  21. data/lib/almirah/doc_types/coverage.rb +95 -80
  22. data/lib/almirah/doc_types/index.rb +173 -173
  23. data/lib/almirah/doc_types/persistent_document.rb +17 -17
  24. data/lib/almirah/doc_types/protocol.rb +24 -24
  25. data/lib/almirah/doc_types/specification.rb +67 -67
  26. data/lib/almirah/doc_types/traceability.rb +142 -142
  27. data/lib/almirah/dom/doc_section.rb +25 -25
  28. data/lib/almirah/dom/document.rb +78 -78
  29. data/lib/almirah/navigation_pane.rb +16 -16
  30. data/lib/almirah/project.rb +287 -287
  31. data/lib/almirah/project_configuration.rb +41 -41
  32. data/lib/almirah/project_template.rb +298 -298
  33. data/lib/almirah/project_utility.rb +52 -0
  34. data/lib/almirah/search/specifications_db.rb +79 -79
  35. data/lib/almirah/templates/css/main.css +300 -300
  36. data/lib/almirah/templates/css/search.css +40 -40
  37. data/lib/almirah/templates/page.html +42 -42
  38. data/lib/almirah/templates/scripts/main.js +111 -111
  39. data/lib/almirah/templates/scripts/orama_search.js +138 -138
  40. data/lib/almirah.rb +93 -58
  41. metadata +4 -3
@@ -1,173 +1,173 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_document'
4
-
5
- class Index < BaseDocument # rubocop:disable Metrics/ClassLength,Style/Documentation
6
- attr_accessor :project
7
-
8
- def initialize(project)
9
- super()
10
- @project = project
11
- @title = 'Document Index'
12
- @id = 'index'
13
- end
14
-
15
- def to_console
16
- puts "\e[36mIndex: #{@id}\e[0m"
17
- end
18
-
19
- def to_html(output_file_path) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
20
- html_rows = []
21
-
22
- html_rows.append('')
23
- s = "<h1>#{@title}</h1>\n"
24
-
25
- # Specifications
26
- s = "<h2>Specifications</h2>\n"
27
- s += "<table class=\"controlled\">\n"
28
- s += "\t<thead>\n"
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
- s += "</thead>\n"
39
- html_rows.append s
40
-
41
- sorted_items = @project.specifications.sort_by(&:id)
42
-
43
- sorted_items.each do |doc| # rubocop:disable Metrics/BlockLength
44
- s = "\t<tr>\n"
45
- s += "\t\t<td class=\"item_text\" style='padding: 5px;'><a href=\"./specifications/#{doc.id}/#{doc.id}.html\" class=\"external\"><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.color};'> </i>&nbsp#{doc.title}</a></td>\n"
46
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.controlled_items.length}</td>\n"
47
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_uplinks_number}</td>\n"
48
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_downlinks_number}</td>\n"
49
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_coverage_number}</td>\n"
50
-
51
- if doc.duplicated_ids_number.positive?
52
- s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
53
- s += "<div id=\"DL_#{doc.id}\" style=\"display: block;\">"
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}</a>"
55
- s += '</div>'
56
- s += "<div id=\"DLS_#{doc.id}\" style=\"display: none;\">"
57
- doc.duplicates_list.each do |lnk|
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
- end
60
- s += '</div>'
61
- s += "</td>\n"
62
- else
63
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.duplicated_ids_number}</td>\n"
64
- end
65
-
66
- if !doc.wrong_links_hash.empty?
67
- s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
68
- s += "<div id=\"DL_#{doc.id}wl\" style=\"display: block;\">"
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}</a>"
70
- s += '</div>'
71
- s += "<div id=\"DLS_#{doc.id}wl\" style=\"display: none;\">"
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\" title=\"Controlled Paragraphs that link to non-existing items\">#{wrong_lnk}</a>\n<br>"
74
- end
75
- s += '</div>'
76
- s += "</td>\n"
77
- else
78
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.wrong_links_hash.length}</td>\n"
79
- end
80
-
81
- color = if !doc.todo_blocks.empty?
82
- 'background-color: #fcc;'
83
- else
84
- ''
85
- end
86
- s += "\t\t<td class=\"item_id\" style='width: 7%; #{color}'>#{doc.todo_blocks.length}</td>\n"
87
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.last_used_id}</td>\n"
88
- s += "</tr>\n"
89
- html_rows.append s
90
- end
91
- html_rows.append "</table>\n"
92
-
93
- # Traceability Matrices
94
- s = "<h2>Traceability Matrices</h2>\n"
95
- s += "<table class=\"controlled\">\n"
96
- s += "\t<thead>\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
- s += "</thead>\n"
102
- html_rows.append s
103
-
104
- sorted_items = @project.traceability_matrices.sort_by(&:id)
105
- # buble-up design inputs
106
- design_inputs = []
107
- others = []
108
- sorted_items.each do |doc|
109
- if doc.bottom_doc
110
- others.append doc
111
- else
112
- design_inputs.append doc
113
- end
114
- end
115
- sorted_items = design_inputs + others
116
-
117
- sorted_items.each do |doc|
118
- s = "\t<tr>\n"
119
- coverage = doc.traced_items.length.to_f / doc.top_doc.controlled_items.length * 100.0
120
- 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"
121
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{'%.2f' % coverage}%</td>\n"
122
- s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.top_doc.color};'> </i>&nbsp#{doc.top_doc.title}</td>\n"
123
- if doc.bottom_doc
124
- s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.bottom_doc.color};'> </i>&nbsp#{doc.bottom_doc.title}</td>\n"
125
- else
126
- s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-circle-o\"'> </i>&nbspAll References</td>\n"
127
- end
128
- s += "</tr>\n"
129
- html_rows.append s
130
- end
131
- html_rows.append "</table>\n"
132
-
133
- # Coverage Matrices
134
- unless @project.coverage_matrices.empty?
135
- s = "<h2>Coverage Matrices</h2>\n"
136
- s += "<table class=\"controlled\">\n"
137
- s += "\t<thead>\n"
138
- s += "\t\t<th>Title</th>\n"
139
- s += "\t\t<th title=\"The ratio of Controlled Paragraphs mentioned in test protocols and total number of Controlled Paragraphs\">Coverage</th>\n"
140
- s += "\t\t<th title=\"Numbers of passed and failed test steps\">Test Results</th>\n"
141
- s += "\t\t<th>Specification Covered</th>\n"
142
- s += "</thead>\n"
143
- html_rows.append s
144
-
145
- sorted_items = @project.coverage_matrices.sort_by(&:id)
146
-
147
- sorted_items.each do |doc|
148
- s = "\t<tr>\n"
149
- coverage = doc.covered_items.length.to_f / doc.top_doc.controlled_items.length * 100.0
150
-
151
- test_step_color = if doc.failed_steps_number.positive?
152
- 'background-color: #fcc;'
153
- elsif !doc.failed_steps_number.positive? && doc.passed_steps_number.positive?
154
- 'background-color: #cfc;'
155
- else
156
- 'background-color: #ffffee;'
157
- end
158
-
159
- 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"
160
- s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{'%.2f' % coverage}%</td>\n" # rubocop:disable Style/FormatString
161
- s += "\t\t<td class=\"item_id\" style='width: 7%; #{test_step_color}' title='pass/fail'> #{doc.passed_steps_number}/#{doc.failed_steps_number} </td>\n"
162
- s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'>\
163
- <i class=\"fa fa-file-text-o\" style='background-color: ##{doc.top_doc.color};'> </i>\
164
- #{doc.top_doc.title}</td>\n"
165
- s += "</tr>\n"
166
- html_rows.append s
167
- end
168
- html_rows.append "</table>\n"
169
- end
170
-
171
- save_html_to_file(html_rows, nil, output_file_path)
172
- end
173
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_document'
4
+
5
+ class Index < BaseDocument # rubocop:disable Metrics/ClassLength,Style/Documentation
6
+ attr_accessor :project
7
+
8
+ def initialize(project)
9
+ super()
10
+ @project = project
11
+ @title = 'Document Index'
12
+ @id = 'index'
13
+ end
14
+
15
+ def to_console
16
+ puts "\e[36mIndex: #{@id}\e[0m"
17
+ end
18
+
19
+ def to_html(output_file_path) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
20
+ html_rows = []
21
+
22
+ html_rows.append('')
23
+ s = "<h1>#{@title}</h1>\n"
24
+
25
+ # Specifications
26
+ s = "<h2>Specifications</h2>\n"
27
+ s += "<table class=\"controlled\">\n"
28
+ s += "\t<thead>\n"
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
+ s += "</thead>\n"
39
+ html_rows.append s
40
+
41
+ sorted_items = @project.specifications.sort_by(&:id)
42
+
43
+ sorted_items.each do |doc| # rubocop:disable Metrics/BlockLength
44
+ s = "\t<tr>\n"
45
+ s += "\t\t<td class=\"item_text\" style='padding: 5px;'><a href=\"./specifications/#{doc.id}/#{doc.id}.html\" class=\"external\"><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.color};'> </i>&nbsp#{doc.title}</a></td>\n"
46
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.controlled_items.length}</td>\n"
47
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_uplinks_number}</td>\n"
48
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_downlinks_number}</td>\n"
49
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.items_with_coverage_number}</td>\n"
50
+
51
+ if doc.duplicated_ids_number.positive?
52
+ s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
53
+ s += "<div id=\"DL_#{doc.id}\" style=\"display: block;\">"
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}</a>"
55
+ s += '</div>'
56
+ s += "<div id=\"DLS_#{doc.id}\" style=\"display: none;\">"
57
+ doc.duplicates_list.each do |lnk|
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
+ end
60
+ s += '</div>'
61
+ s += "</td>\n"
62
+ else
63
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.duplicated_ids_number}</td>\n"
64
+ end
65
+
66
+ if !doc.wrong_links_hash.empty?
67
+ s += "\t\t<td class=\"item_id\" style='width: 7%; background-color: #fcc;'>"
68
+ s += "<div id=\"DL_#{doc.id}wl\" style=\"display: block;\">"
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}</a>"
70
+ s += '</div>'
71
+ s += "<div id=\"DLS_#{doc.id}wl\" style=\"display: none;\">"
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\" title=\"Controlled Paragraphs that link to non-existing items\">#{wrong_lnk}</a>\n<br>"
74
+ end
75
+ s += '</div>'
76
+ s += "</td>\n"
77
+ else
78
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.wrong_links_hash.length}</td>\n"
79
+ end
80
+
81
+ color = if !doc.todo_blocks.empty?
82
+ 'background-color: #fcc;'
83
+ else
84
+ ''
85
+ end
86
+ s += "\t\t<td class=\"item_id\" style='width: 7%; #{color}'>#{doc.todo_blocks.length}</td>\n"
87
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{doc.last_used_id}</td>\n"
88
+ s += "</tr>\n"
89
+ html_rows.append s
90
+ end
91
+ html_rows.append "</table>\n"
92
+
93
+ # Traceability Matrices
94
+ s = "<h2>Traceability Matrices</h2>\n"
95
+ s += "<table class=\"controlled\">\n"
96
+ s += "\t<thead>\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
+ s += "</thead>\n"
102
+ html_rows.append s
103
+
104
+ sorted_items = @project.traceability_matrices.sort_by(&:id)
105
+ # buble-up design inputs
106
+ design_inputs = []
107
+ others = []
108
+ sorted_items.each do |doc|
109
+ if doc.bottom_doc
110
+ others.append doc
111
+ else
112
+ design_inputs.append doc
113
+ end
114
+ end
115
+ sorted_items = design_inputs + others
116
+
117
+ sorted_items.each do |doc|
118
+ s = "\t<tr>\n"
119
+ coverage = doc.traced_items.length.to_f / doc.top_doc.controlled_items.length * 100.0
120
+ 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"
121
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{'%.2f' % coverage}%</td>\n"
122
+ s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.top_doc.color};'> </i>&nbsp#{doc.top_doc.title}</td>\n"
123
+ if doc.bottom_doc
124
+ s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-file-text-o\" style='background-color: ##{doc.bottom_doc.color};'> </i>&nbsp#{doc.bottom_doc.title}</td>\n"
125
+ else
126
+ s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'><i class=\"fa fa-circle-o\"'> </i>&nbspAll References</td>\n"
127
+ end
128
+ s += "</tr>\n"
129
+ html_rows.append s
130
+ end
131
+ html_rows.append "</table>\n"
132
+
133
+ # Coverage Matrices
134
+ unless @project.coverage_matrices.empty?
135
+ s = "<h2>Coverage Matrices</h2>\n"
136
+ s += "<table class=\"controlled\">\n"
137
+ s += "\t<thead>\n"
138
+ s += "\t\t<th>Title</th>\n"
139
+ s += "\t\t<th title=\"The ratio of Controlled Paragraphs mentioned in test protocols and total number of Controlled Paragraphs\">Coverage</th>\n"
140
+ s += "\t\t<th title=\"Numbers of passed and failed test steps\">Test Results</th>\n"
141
+ s += "\t\t<th>Specification Covered</th>\n"
142
+ s += "</thead>\n"
143
+ html_rows.append s
144
+
145
+ sorted_items = @project.coverage_matrices.sort_by(&:id)
146
+
147
+ sorted_items.each do |doc|
148
+ s = "\t<tr>\n"
149
+ coverage = doc.covered_items.length.to_f / doc.top_doc.controlled_items.length * 100.0
150
+
151
+ test_step_color = if doc.failed_steps_number.positive?
152
+ 'background-color: #fcc;'
153
+ elsif !doc.failed_steps_number.positive? && doc.passed_steps_number.positive?
154
+ 'background-color: #cfc;'
155
+ else
156
+ 'background-color: #ffffee;'
157
+ end
158
+
159
+ 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"
160
+ s += "\t\t<td class=\"item_id\" style='width: 7%;'>#{'%.2f' % coverage}%</td>\n" # rubocop:disable Style/FormatString
161
+ s += "\t\t<td class=\"item_id\" style='width: 7%; #{test_step_color}' title='pass/fail'> #{doc.passed_steps_number}/#{doc.failed_steps_number} </td>\n"
162
+ s += "\t\t<td class=\"item_text\" style='width: 25%; padding: 5px;'>\
163
+ <i class=\"fa fa-file-text-o\" style='background-color: ##{doc.top_doc.color};'> </i>\
164
+ #{doc.top_doc.title}</td>\n"
165
+ s += "</tr>\n"
166
+ html_rows.append s
167
+ end
168
+ html_rows.append "</table>\n"
169
+ end
170
+
171
+ save_html_to_file(html_rows, nil, output_file_path)
172
+ end
173
+ end
@@ -1,17 +1,17 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'base_document'
4
-
5
- class PersistentDocument < BaseDocument # rubocop:disable Style/Documentation
6
- attr_accessor :path, :items, :controlled_items, :headings, :up_link_docs, :frontmatter
7
-
8
- def initialize(fele_path)
9
- super()
10
- @path = fele_path
11
- @items = []
12
- @controlled_items = []
13
- @headings = []
14
- @up_link_docs = {}
15
- @frontmatter = nil
16
- end
17
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'base_document'
4
+
5
+ class PersistentDocument < BaseDocument # rubocop:disable Style/Documentation
6
+ attr_accessor :path, :items, :controlled_items, :headings, :up_link_docs, :frontmatter
7
+
8
+ def initialize(fele_path)
9
+ super()
10
+ @path = fele_path
11
+ @items = []
12
+ @controlled_items = []
13
+ @headings = []
14
+ @up_link_docs = {}
15
+ @frontmatter = nil
16
+ end
17
+ end
@@ -1,25 +1,25 @@
1
- require_relative "persistent_document"
2
-
3
- class Protocol < PersistentDocument
4
-
5
- def initialize(fele_path)
6
- super
7
- @id = File.basename(fele_path, File.extname(fele_path)).downcase
8
- end
9
-
10
- def to_html(nav_pane, output_file_path)
11
-
12
- html_rows = Array.new
13
-
14
- html_rows.append('')
15
-
16
- @items.each do |item|
17
- a = item.to_html
18
- html_rows.append a
19
- end
20
-
21
- self.save_html_to_file(html_rows, nav_pane, output_file_path)
22
-
23
- end
24
-
1
+ require_relative "persistent_document"
2
+
3
+ class Protocol < PersistentDocument
4
+
5
+ def initialize(fele_path)
6
+ super
7
+ @id = File.basename(fele_path, File.extname(fele_path)).downcase
8
+ end
9
+
10
+ def to_html(nav_pane, output_file_path)
11
+
12
+ html_rows = Array.new
13
+
14
+ html_rows.append('')
15
+
16
+ @items.each do |item|
17
+ a = item.to_html
18
+ html_rows.append a
19
+ end
20
+
21
+ self.save_html_to_file(html_rows, nav_pane, output_file_path)
22
+
23
+ end
24
+
25
25
  end
@@ -1,67 +1,67 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'persistent_document'
4
-
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)
42
- end
43
-
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)
49
- end
50
-
51
- puts format("| Last used Item Id |\e[1m\e[37m %10s \e[0m|", @last_used_id)
52
- puts '-' * 53
53
- end
54
-
55
- def to_html(nav_pane, output_file_path)
56
- html_rows = []
57
-
58
- html_rows.append('')
59
-
60
- @items.each do |item|
61
- a = item.to_html
62
- html_rows.append a
63
- end
64
-
65
- save_html_to_file(html_rows, nav_pane, output_file_path)
66
- end
67
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'persistent_document'
4
+
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)
42
+ end
43
+
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)
49
+ end
50
+
51
+ puts format("| Last used Item Id |\e[1m\e[37m %10s \e[0m|", @last_used_id)
52
+ puts '-' * 53
53
+ end
54
+
55
+ def to_html(nav_pane, output_file_path)
56
+ html_rows = []
57
+
58
+ html_rows.append('')
59
+
60
+ @items.each do |item|
61
+ a = item.to_html
62
+ html_rows.append a
63
+ end
64
+
65
+ save_html_to_file(html_rows, nav_pane, output_file_path)
66
+ end
67
+ end