Almirah 0.0.7 → 0.0.8
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 +22 -1
- data/lib/almirah/doc_items/controlled_paragraph.rb +3 -3
- data/lib/almirah/doc_items/controlled_table.rb +6 -3
- data/lib/almirah/doc_items/doc_item.rb +4 -0
- data/lib/almirah/doc_types/base_document.rb +27 -0
- data/lib/almirah/doc_types/coverage.rb +82 -0
- data/lib/almirah/doc_types/protocol.rb +15 -0
- data/lib/almirah/doc_types/specification.rb +55 -0
- data/lib/almirah/doc_types/traceability.rb +73 -0
- data/lib/almirah/project.rb +16 -15
- data/lib/almirah/templates/page.html +7 -0
- data/lib/almirah.rb +4 -4
- metadata +4 -3
- data/lib/almirah/html_render.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1841cdb6a5d88bcbe36d8ed926fd8f659e9a630d58763ead2b78e8b7f17281dd
|
4
|
+
data.tar.gz: 13b91603331fe68ff13f4b1917806551f94f11d98084ce773a1e247abb4b1abb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed609c1862a9f33b46c2379ae8f08904c30a00767939418e28600267ccc449aa88b7bcf96efc661c1c3d39d9a720a12491c01eed4c0c30034623f342a47d5d70
|
7
|
+
data.tar.gz: e5c91e4efbd5d96d915ad2228b22982391ccc91eae8afc545dc8c1fd1a8f077a690d9da988e47794df470eda560e7f6a0a99ec7a173d33660c0cc532de1c5e97
|
data/lib/almirah/doc_fabric.rb
CHANGED
@@ -52,6 +52,7 @@ class DocFabric
|
|
52
52
|
level = res[1].length
|
53
53
|
value = res[2]
|
54
54
|
item = Heading.new(value, level)
|
55
|
+
item.parent_doc = doc
|
55
56
|
doc.items.append(item)
|
56
57
|
doc.headings.append(item)
|
57
58
|
|
@@ -85,12 +86,25 @@ class DocFabric
|
|
85
86
|
end
|
86
87
|
|
87
88
|
item = ControlledParagraph.new( text, id )
|
88
|
-
item.
|
89
|
+
item.parent_doc = doc
|
90
|
+
if up_link
|
91
|
+
item.up_link = up_link
|
92
|
+
doc.items_with_uplinks_number += 1 #for statistics
|
93
|
+
end
|
89
94
|
|
90
95
|
doc.items.append(item)
|
91
96
|
doc.dictionary[ id.to_s ] = item #for fast search
|
92
97
|
doc.controlled_items.append(item) #for fast search
|
93
98
|
|
99
|
+
#for statistics
|
100
|
+
n = /\d+/.match(id)[0].to_i
|
101
|
+
if n == doc.last_used_id_number
|
102
|
+
doc.duplicated_ids_number += 1
|
103
|
+
elsif n > doc.last_used_id_number
|
104
|
+
doc.last_used_id = id
|
105
|
+
doc.last_used_id_number = n
|
106
|
+
end
|
107
|
+
|
94
108
|
elsif res = /^[!]\[(.*)\]\((.*)\)/.match(s) # Image
|
95
109
|
|
96
110
|
if tempMdTable
|
@@ -106,6 +120,7 @@ class DocFabric
|
|
106
120
|
img_path = res[2]
|
107
121
|
|
108
122
|
item = Image.new( img_text, img_path )
|
123
|
+
item.parent_doc = doc
|
109
124
|
|
110
125
|
doc.items.append(item)
|
111
126
|
|
@@ -122,6 +137,7 @@ class DocFabric
|
|
122
137
|
tempMdList.addRow(row)
|
123
138
|
else
|
124
139
|
item = MarkdownList.new(row)
|
140
|
+
item.parent_doc = doc
|
125
141
|
tempMdList = item
|
126
142
|
end
|
127
143
|
|
@@ -139,6 +155,7 @@ class DocFabric
|
|
139
155
|
else
|
140
156
|
#separator out of table scope consider it just as a regular paragraph
|
141
157
|
item = Paragraph.new(s)
|
158
|
+
item.parent_doc = doc
|
142
159
|
doc.items.append(item)
|
143
160
|
end
|
144
161
|
|
@@ -150,11 +167,13 @@ class DocFabric
|
|
150
167
|
# check if it is a controlled table
|
151
168
|
unless tempMdTable.addRow(row)
|
152
169
|
tempMdTable = ControlledTable.new(tempMdTable, doc)
|
170
|
+
tempMdTable.parent_doc = doc
|
153
171
|
tempMdTable.addRow(row)
|
154
172
|
end
|
155
173
|
else
|
156
174
|
#start table from heading
|
157
175
|
tempMdTable = MarkdownTable.new(row)
|
176
|
+
tempMdTable.parent_doc = doc
|
158
177
|
end
|
159
178
|
end
|
160
179
|
|
@@ -170,6 +189,7 @@ class DocFabric
|
|
170
189
|
end
|
171
190
|
|
172
191
|
item = Blockquote.new(res[1])
|
192
|
+
item.parent_doc = doc
|
173
193
|
doc.items.append(item)
|
174
194
|
|
175
195
|
else # Reqular Paragraph
|
@@ -183,6 +203,7 @@ class DocFabric
|
|
183
203
|
end
|
184
204
|
|
185
205
|
item = Paragraph.new(s)
|
206
|
+
item.parent_doc = doc
|
186
207
|
doc.items.append(item)
|
187
208
|
end
|
188
209
|
end
|
@@ -8,7 +8,7 @@ class ControlledParagraph < Paragraph
|
|
8
8
|
attr_accessor :coverage_links
|
9
9
|
|
10
10
|
def initialize(text, id)
|
11
|
-
@text = text
|
11
|
+
@text = text.strip
|
12
12
|
@id = id
|
13
13
|
@up_link = nil
|
14
14
|
@down_links = nil
|
@@ -23,14 +23,14 @@ class ControlledParagraph < Paragraph
|
|
23
23
|
@@htmlTableRenderInProgress = true
|
24
24
|
end
|
25
25
|
s += "\t<tr>\n"
|
26
|
-
s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\"
|
26
|
+
s += "\t\t<td class=\"item_id\"> <a name=\"#{@id}\" id=\"#{@id}\" href=\"##{@id}\">#{@id}</a></td>\n"
|
27
27
|
s += "\t\t<td class=\"item_text\">#{@text}</td>\n"
|
28
28
|
|
29
29
|
if @up_link
|
30
30
|
if tmp = /^([a-zA-Z]+)[-]\d+/.match(@up_link)
|
31
31
|
up_link_doc_name = tmp[1].downcase
|
32
32
|
end
|
33
|
-
s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html\" class=\"external\">#{@up_link}</a></td>\n"
|
33
|
+
s += "\t\t<td class=\"item_id\"><a href=\"./../#{up_link_doc_name}/#{up_link_doc_name}.html##{@up_link}\" class=\"external\">#{@up_link}</a></td>\n"
|
34
34
|
else
|
35
35
|
s += "\t\t<td class=\"item_id\"></td>\n"
|
36
36
|
end
|
@@ -23,15 +23,17 @@ end
|
|
23
23
|
class TestStepNumberColumn < ControlledTableColumn
|
24
24
|
|
25
25
|
attr_accessor :step_number
|
26
|
+
attr_accessor :row_id
|
26
27
|
|
27
28
|
def initialize(text)
|
28
29
|
text = text.strip
|
29
30
|
@step_number = text.to_i
|
30
31
|
@text = text
|
32
|
+
@row_id = ""
|
31
33
|
end
|
32
34
|
|
33
35
|
def to_html
|
34
|
-
"\t\t<td style=\"text-align: center;\">#{@text}</td>\n\r"
|
36
|
+
"\t\t<td style=\"text-align: center;\"><a name=\"#{@row_id}\" id=\"#{@row_id}\" href=\"##{@row_id}\">#{@text}</a></td>\n\r"
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -70,7 +72,7 @@ class TestStepReferenceColumn < ControlledTableColumn
|
|
70
72
|
|
71
73
|
def to_html
|
72
74
|
if @up_link
|
73
|
-
"\t\t<td class=\"item_id\"><a href=\"./../../../specifications/#{@up_link_doc_id}/#{@up_link_doc_id}.html\" class=\"external\">#{@up_link}</a></td>\n\r"
|
75
|
+
"\t\t<td class=\"item_id\"><a href=\"./../../../specifications/#{@up_link_doc_id}/#{@up_link_doc_id}.html##{@up_link}\" class=\"external\">#{@up_link}</a></td>\n\r"
|
74
76
|
else
|
75
77
|
"\t\t<td style=\"text-align: center;\"></td>\n\r"
|
76
78
|
end
|
@@ -83,7 +85,6 @@ class ControlledTable < DocItem
|
|
83
85
|
|
84
86
|
attr_accessor :column_names
|
85
87
|
attr_accessor :rows
|
86
|
-
attr_accessor :parent_doc
|
87
88
|
|
88
89
|
def initialize(markdown_table, parent_doc)
|
89
90
|
@parent_doc = parent_doc
|
@@ -108,6 +109,7 @@ class ControlledTable < DocItem
|
|
108
109
|
def format_columns(columns)
|
109
110
|
|
110
111
|
new_row = ControlledTableRow.new
|
112
|
+
new_row.parent_doc = @parent_doc
|
111
113
|
|
112
114
|
columns.each_with_index do | element, index |
|
113
115
|
|
@@ -116,6 +118,7 @@ class ControlledTable < DocItem
|
|
116
118
|
col = TestStepNumberColumn.new element
|
117
119
|
new_row.columns.append col
|
118
120
|
new_row.id = @parent_doc.id + '.' + col.text
|
121
|
+
col.row_id = new_row.id
|
119
122
|
|
120
123
|
elsif index + 1 == columns.length # it is expected that a link is placed to the last column only
|
121
124
|
|
@@ -15,4 +15,31 @@ class BaseDocument
|
|
15
15
|
@title = ""
|
16
16
|
@id = ""
|
17
17
|
end
|
18
|
+
|
19
|
+
def save_html_to_file html_rows, nav_pane, output_file_path
|
20
|
+
|
21
|
+
gem_root = File.expand_path './../../..', File.dirname(__FILE__)
|
22
|
+
template_file = gem_root + "/lib/almirah/templates/page.html"
|
23
|
+
|
24
|
+
file = File.open( template_file )
|
25
|
+
file_data = file.readlines
|
26
|
+
file.close
|
27
|
+
|
28
|
+
output_file_path += "#{@id}/#{@id}.html"
|
29
|
+
file = File.open( output_file_path, "w" )
|
30
|
+
file_data.each do |s|
|
31
|
+
if s.include?('{{CONTENT}}')
|
32
|
+
html_rows.each do |r|
|
33
|
+
file.puts r
|
34
|
+
end
|
35
|
+
elsif s.include?('{{NAV_PANE}}')
|
36
|
+
if nav_pane
|
37
|
+
file.puts nav_pane.to_html
|
38
|
+
end
|
39
|
+
else
|
40
|
+
file.puts s
|
41
|
+
end
|
42
|
+
end
|
43
|
+
file.close
|
44
|
+
end
|
18
45
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require_relative "base_document"
|
2
|
+
|
3
|
+
class Coverage < BaseDocument
|
4
|
+
|
5
|
+
attr_accessor :top_doc
|
6
|
+
attr_accessor :bottom_doc
|
7
|
+
attr_accessor :items
|
8
|
+
|
9
|
+
def initialize(top_doc)
|
10
|
+
|
11
|
+
@top_doc = top_doc
|
12
|
+
@bottom_doc = bottom_doc
|
13
|
+
|
14
|
+
@items = Array.new
|
15
|
+
@headings = Array.new
|
16
|
+
|
17
|
+
@id = top_doc.id + "-" + "tests"
|
18
|
+
@title = "Coverage Matrix: " + @id
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_console
|
22
|
+
puts "\e[35m" + "Traceability: " + @id + "\e[0m"
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_html(nav_pane, output_file_path)
|
26
|
+
|
27
|
+
html_rows = Array.new
|
28
|
+
|
29
|
+
html_rows.append('')
|
30
|
+
s = "<h1>#{@title}</h1>\n"
|
31
|
+
s += "<table class=\"controlled\">\n"
|
32
|
+
s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> <th>#</th> <th style='font-weight: bold;'>Test CaseId.StepId</th> </thead>\n"
|
33
|
+
html_rows.append s
|
34
|
+
|
35
|
+
sorted_items = @top_doc.controlled_items.sort_by { |w| w.id }
|
36
|
+
|
37
|
+
sorted_items.each do |top_item|
|
38
|
+
row = render_table_row top_item
|
39
|
+
html_rows.append row
|
40
|
+
end
|
41
|
+
html_rows.append "</table>\n"
|
42
|
+
|
43
|
+
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def render_table_row(top_item)
|
48
|
+
s = ""
|
49
|
+
if top_item.coverage_links
|
50
|
+
if top_item.coverage_links.length > 1
|
51
|
+
id_color = "" # "style='background-color: #fff8c5;'" # disabled for now
|
52
|
+
else
|
53
|
+
id_color = ""
|
54
|
+
end
|
55
|
+
top_item.coverage_links.each do |bottom_item|
|
56
|
+
s += "\t<tr>\n"
|
57
|
+
s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
58
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
59
|
+
|
60
|
+
if bottom_item.columns[-2].text.downcase == "pass"
|
61
|
+
test_step_color = "style='background-color: #cfc;'"
|
62
|
+
elsif bottom_item.columns[-2].text.downcase == "fail"
|
63
|
+
test_step_color = "style='background-color: #fcc;'"
|
64
|
+
else
|
65
|
+
test_step_color = ""
|
66
|
+
end
|
67
|
+
|
68
|
+
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"
|
69
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_item.columns[1].text}</td>\n"
|
70
|
+
s += "\t</tr>\n"
|
71
|
+
end
|
72
|
+
else
|
73
|
+
s += "\t<tr>\n"
|
74
|
+
s += "\t\t<td class=\"item_id\"><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
75
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
76
|
+
s += "\t\t<td class=\"item_id\"></td>\n"
|
77
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'></td>\n"
|
78
|
+
s += "\t</tr>\n"
|
79
|
+
end
|
80
|
+
return s
|
81
|
+
end
|
82
|
+
end
|
@@ -19,4 +19,19 @@ class Protocol < BaseDocument
|
|
19
19
|
@up_link_doc_id = ""
|
20
20
|
end
|
21
21
|
|
22
|
+
def to_html(nav_pane, output_file_path)
|
23
|
+
|
24
|
+
html_rows = Array.new
|
25
|
+
|
26
|
+
html_rows.append('')
|
27
|
+
|
28
|
+
@items.each do |item|
|
29
|
+
a = item.to_html
|
30
|
+
html_rows.append a
|
31
|
+
end
|
32
|
+
|
33
|
+
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
22
37
|
end
|
@@ -6,6 +6,13 @@ class Specification < BaseDocument
|
|
6
6
|
attr_accessor :dictionary
|
7
7
|
attr_accessor :controlled_items
|
8
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 :last_used_id
|
14
|
+
attr_accessor :last_used_id_number
|
15
|
+
|
9
16
|
def initialize(fele_path)
|
10
17
|
|
11
18
|
@path = fele_path
|
@@ -15,8 +22,56 @@ class Specification < BaseDocument
|
|
15
22
|
@controlled_items = Array.new
|
16
23
|
@dictionary = Hash.new
|
17
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
|
+
|
18
32
|
@id = File.basename(fele_path, File.extname(fele_path)).downcase
|
19
33
|
@up_link_doc_id = ""
|
20
34
|
end
|
21
35
|
|
36
|
+
def to_console
|
37
|
+
puts ""
|
38
|
+
puts "\e[33m" + "Specification: " + @title + "\e[0m"
|
39
|
+
puts "-" * 53
|
40
|
+
puts "| Number of Controlled Items | %10d |" % @controlled_items.length
|
41
|
+
puts "| Number of Items w/ Up-links | %10d |" % @items_with_uplinks_number
|
42
|
+
puts "| Number of Items w/ Down-links | %10d |" % @items_with_downlinks_number
|
43
|
+
|
44
|
+
# coverage
|
45
|
+
if (@controlled_items.length > 0) && (@controlled_items.length == @items_with_coverage_number)
|
46
|
+
puts "| Number of Items w/ Test Coverage |\e[1m\e[32m %10d \e[0m|" % @items_with_coverage_number
|
47
|
+
else
|
48
|
+
puts "| Number of Items w/ Test Coverage | %10d |" % @items_with_coverage_number
|
49
|
+
end
|
50
|
+
|
51
|
+
# duplicates
|
52
|
+
if @duplicated_ids_number >0
|
53
|
+
puts "| Duplicated Item Ids found |\e[1m\e[31m %10d \e[0m|" % @duplicated_ids_number
|
54
|
+
else
|
55
|
+
puts "| Duplicated Item Ids found | %10d |" % @duplicated_ids_number
|
56
|
+
end
|
57
|
+
|
58
|
+
puts "| Last used Item Id |\e[1m\e[37m %10s \e[0m|" % @last_used_id
|
59
|
+
puts "-" * 53
|
60
|
+
end
|
61
|
+
|
62
|
+
def to_html(nav_pane, output_file_path)
|
63
|
+
|
64
|
+
html_rows = Array.new
|
65
|
+
|
66
|
+
html_rows.append('')
|
67
|
+
|
68
|
+
@items.each do |item|
|
69
|
+
a = item.to_html
|
70
|
+
html_rows.append a
|
71
|
+
end
|
72
|
+
|
73
|
+
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
74
|
+
|
75
|
+
end
|
76
|
+
|
22
77
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative "base_document"
|
2
|
+
|
3
|
+
class Traceability < BaseDocument
|
4
|
+
|
5
|
+
attr_accessor :top_doc
|
6
|
+
attr_accessor :bottom_doc
|
7
|
+
attr_accessor :items
|
8
|
+
|
9
|
+
def initialize(top_doc, bottom_doc)
|
10
|
+
|
11
|
+
@top_doc = top_doc
|
12
|
+
@bottom_doc = bottom_doc
|
13
|
+
|
14
|
+
@items = Array.new
|
15
|
+
@headings = Array.new
|
16
|
+
|
17
|
+
@id = top_doc.id + "-" + bottom_doc.id
|
18
|
+
@title = "Traceability Matrix: " + @id
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_console
|
22
|
+
puts "\e[35m" + "Traceability: " + @id + "\e[0m"
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_html(nav_pane, output_file_path)
|
26
|
+
|
27
|
+
html_rows = Array.new
|
28
|
+
|
29
|
+
html_rows.append('')
|
30
|
+
s = "<h1>#{@title}</h1>\n"
|
31
|
+
s += "<table class=\"controlled\">\n"
|
32
|
+
s += "\t<thead> <th>#</th> <th style='font-weight: bold;'>#{@top_doc.title}</th> <th>#</th> <th style='font-weight: bold;'>#{@bottom_doc.title}</th> </thead>\n"
|
33
|
+
html_rows.append s
|
34
|
+
|
35
|
+
sorted_items = @top_doc.controlled_items.sort_by { |w| w.id }
|
36
|
+
|
37
|
+
sorted_items.each do |top_item|
|
38
|
+
row = render_table_row top_item
|
39
|
+
html_rows.append row
|
40
|
+
end
|
41
|
+
html_rows.append "</table>\n"
|
42
|
+
|
43
|
+
self.save_html_to_file(html_rows, nav_pane, output_file_path)
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def render_table_row(top_item)
|
48
|
+
s = ""
|
49
|
+
if top_item.down_links
|
50
|
+
if top_item.down_links.length > 1
|
51
|
+
id_color = "style='background-color: #fff8c5;'"
|
52
|
+
else
|
53
|
+
id_color = ""
|
54
|
+
end
|
55
|
+
top_item.down_links.each do |bottom_item|
|
56
|
+
s += "\t<tr>\n"
|
57
|
+
s += "\t\t<td class=\"item_id\" #{id_color}><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
58
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
59
|
+
s += "\t\t<td class=\"item_id\"><a href=\"./../#{bottom_item.parent_doc.id}/#{bottom_item.parent_doc.id}.html##{bottom_item.id}\" class=\"external\">#{bottom_item.id}</a></td>\n"
|
60
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{bottom_item.text}</td>\n"
|
61
|
+
s += "\t</tr>\n"
|
62
|
+
end
|
63
|
+
else
|
64
|
+
s += "\t<tr>\n"
|
65
|
+
s += "\t\t<td class=\"item_id\"><a href=\"./../#{top_item.parent_doc.id}/#{top_item.parent_doc.id}.html##{top_item.id}\" class=\"external\">#{top_item.id}</a></td>\n"
|
66
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'>#{top_item.text}</td>\n"
|
67
|
+
s += "\t\t<td class=\"item_id\"></td>\n"
|
68
|
+
s += "\t\t<td class=\"item_text\" style='width: 42%;'></td>\n"
|
69
|
+
s += "\t</tr>\n"
|
70
|
+
end
|
71
|
+
return s
|
72
|
+
end
|
73
|
+
end
|
data/lib/almirah/project.rb
CHANGED
@@ -1,20 +1,19 @@
|
|
1
1
|
require_relative "doc_fabric"
|
2
|
-
require_relative "html_render"
|
3
2
|
require_relative "navigation_pane"
|
3
|
+
require_relative "doc_types/traceability"
|
4
|
+
require_relative "doc_types/coverage"
|
4
5
|
|
5
6
|
class Project
|
6
7
|
|
7
8
|
attr_accessor :specifications
|
8
9
|
attr_accessor :protocols
|
9
10
|
attr_accessor :project_root_directory
|
10
|
-
attr_accessor :gem_root
|
11
11
|
attr_accessor :specifications_dictionary
|
12
12
|
|
13
|
-
def initialize(path
|
13
|
+
def initialize(path)
|
14
14
|
@project_root_directory = path
|
15
15
|
@specifications = Array.new
|
16
16
|
@protocols = Array.new
|
17
|
-
@gem_root = gem_root
|
18
17
|
@specifications_dictionary = Hash.new
|
19
18
|
|
20
19
|
FileUtils.remove_dir(@project_root_directory + "/build", true)
|
@@ -102,14 +101,14 @@ class Project
|
|
102
101
|
|
103
102
|
unless topItem.down_links
|
104
103
|
topItem.down_links = Array.new
|
104
|
+
top_document.items_with_downlinks_number += 1 # for statistics
|
105
105
|
end
|
106
106
|
topItem.down_links.append(item)
|
107
|
-
|
108
|
-
#if tmp = /^([a-zA-Z]+)[-]\d+/.match(item.id)
|
109
|
-
# top_document.downlinkKey = tmp[1].upcase
|
110
|
-
#end
|
111
107
|
end
|
112
108
|
end
|
109
|
+
# create treceability document
|
110
|
+
trx = Traceability.new top_document, bottom_document
|
111
|
+
@specifications.append trx
|
113
112
|
end
|
114
113
|
|
115
114
|
def link_protocol_to_spec(protocol, specification)
|
@@ -125,10 +124,14 @@ class Project
|
|
125
124
|
|
126
125
|
unless topItem.coverage_links
|
127
126
|
topItem.coverage_links = Array.new
|
127
|
+
top_document.items_with_coverage_number += 1 # for statistics
|
128
128
|
end
|
129
129
|
topItem.coverage_links.append(item)
|
130
130
|
end
|
131
131
|
end
|
132
|
+
# create coverage document
|
133
|
+
trx = Coverage.new top_document
|
134
|
+
@specifications.append trx
|
132
135
|
end
|
133
136
|
|
134
137
|
def render_all_specifications
|
@@ -142,6 +145,8 @@ class Project
|
|
142
145
|
|
143
146
|
@specifications.each do |doc|
|
144
147
|
|
148
|
+
doc.to_console
|
149
|
+
|
145
150
|
img_src_dir = pass + "/specifications/" + doc.id + "/img"
|
146
151
|
img_dst_dir = pass + "/build/specifications/" + doc.id + "/img"
|
147
152
|
|
@@ -151,16 +156,14 @@ class Project
|
|
151
156
|
FileUtils.copy_entry( img_src_dir, img_dst_dir )
|
152
157
|
end
|
153
158
|
|
154
|
-
|
155
|
-
@gem_root + "/lib/almirah/templates/page.html",
|
156
|
-
"#{pass}/build/specifications/#{doc.id}/#{doc.id}.html" )
|
159
|
+
doc.to_html( nav_pane, "#{pass}/build/specifications/" )
|
157
160
|
end
|
158
161
|
end
|
159
162
|
|
160
163
|
def render_all_protocols
|
161
164
|
|
162
165
|
# create a sidebar first
|
163
|
-
|
166
|
+
nav_pane = NavigationPane.new(@specifications)
|
164
167
|
|
165
168
|
pass = @project_root_directory
|
166
169
|
|
@@ -178,9 +181,7 @@ class Project
|
|
178
181
|
FileUtils.copy_entry( img_src_dir, img_dst_dir )
|
179
182
|
end
|
180
183
|
|
181
|
-
|
182
|
-
@gem_root + "/lib/almirah/templates/page.html",
|
183
|
-
"#{pass}/build/tests/protocols/#{doc.id}/#{doc.id}.html" )
|
184
|
+
doc.to_html( nav_pane, "#{pass}/build/tests/protocols/" )
|
184
185
|
end
|
185
186
|
end
|
186
187
|
end
|
@@ -126,6 +126,13 @@
|
|
126
126
|
a, a:link, a:visited {
|
127
127
|
color: #169;
|
128
128
|
text-decoration: none;
|
129
|
+
display: inline-block;
|
130
|
+
}
|
131
|
+
a:active {
|
132
|
+
color: #555;
|
133
|
+
background-color:#deb887;
|
134
|
+
text-decoration: none;
|
135
|
+
display: inline-block;
|
129
136
|
}
|
130
137
|
div.blockquote {
|
131
138
|
display: block;
|
data/lib/almirah.rb
CHANGED
@@ -18,11 +18,11 @@ class Almirah
|
|
18
18
|
|
19
19
|
attr_accessor :project
|
20
20
|
|
21
|
-
def initialize
|
22
|
-
@project = Project.new project_folder
|
21
|
+
def initialize(project_folder)
|
22
|
+
@project = Project.new project_folder
|
23
23
|
end
|
24
24
|
|
25
|
-
def getGemRoot
|
25
|
+
def getGemRoot()
|
26
26
|
File.expand_path './..', File.dirname(__FILE__)
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ class Almirah
|
|
30
30
|
@project.specifications_and_results test_run
|
31
31
|
end
|
32
32
|
|
33
|
-
def default
|
33
|
+
def default()
|
34
34
|
@project.specifications_and_protocols
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Almirah
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleksandr Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The software part of the Almirah system
|
14
14
|
email: oleksandr.ivanov.development@gmail.com
|
@@ -31,9 +31,10 @@ files:
|
|
31
31
|
- lib/almirah/doc_items/markdown_table.rb
|
32
32
|
- lib/almirah/doc_items/paragraph.rb
|
33
33
|
- lib/almirah/doc_types/base_document.rb
|
34
|
+
- lib/almirah/doc_types/coverage.rb
|
34
35
|
- lib/almirah/doc_types/protocol.rb
|
35
36
|
- lib/almirah/doc_types/specification.rb
|
36
|
-
- lib/almirah/
|
37
|
+
- lib/almirah/doc_types/traceability.rb
|
37
38
|
- lib/almirah/navigation_pane.rb
|
38
39
|
- lib/almirah/project.rb
|
39
40
|
- lib/almirah/templates/page.html
|
data/lib/almirah/html_render.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
|
2
|
-
class HtmlRender
|
3
|
-
|
4
|
-
attr_accessor :template
|
5
|
-
attr_accessor :htmlRows
|
6
|
-
attr_accessor :outputFile
|
7
|
-
attr_accessor :document
|
8
|
-
attr_accessor :nav_pane
|
9
|
-
|
10
|
-
def initialize(document, nav_pane, template, outputFile)
|
11
|
-
|
12
|
-
@template = template
|
13
|
-
@outputFile = outputFile
|
14
|
-
@htmlRows = Array.new
|
15
|
-
@document = document
|
16
|
-
@nav_pane = nav_pane
|
17
|
-
|
18
|
-
self.render()
|
19
|
-
self.saveRenderToFile()
|
20
|
-
end
|
21
|
-
|
22
|
-
def render()
|
23
|
-
self.htmlRows.append('')
|
24
|
-
|
25
|
-
self.document.items.each do |item|
|
26
|
-
a = item.to_html
|
27
|
-
self.htmlRows.append a
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def saveRenderToFile()
|
32
|
-
|
33
|
-
file = File.open( self.template )
|
34
|
-
file_data = file.readlines
|
35
|
-
file.close
|
36
|
-
|
37
|
-
file = File.open( self.outputFile, "w" )
|
38
|
-
file_data.each do |s|
|
39
|
-
if s.include?('{{CONTENT}}')
|
40
|
-
self.htmlRows.each do |r|
|
41
|
-
file.puts r
|
42
|
-
end
|
43
|
-
elsif s.include?('{{NAV_PANE}}')
|
44
|
-
if @nav_pane
|
45
|
-
file.puts self.nav_pane.to_html
|
46
|
-
end
|
47
|
-
else
|
48
|
-
file.puts s
|
49
|
-
end
|
50
|
-
end
|
51
|
-
file.close
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|