Revision b0e38c17
Added by Oleksandr Ivanov over 1 year ago
| lib/almirah/doc_fabric.rb | ||
|---|---|---|
|
require_relative 'doc_types/base_document'
|
||
|
require_relative 'doc_types/specification'
|
||
|
require_relative 'doc_types/protocol'
|
||
|
require_relative 'doc_types/coverage'
|
||
|
require_relative 'doc_parser'
|
||
|
require_relative 'dom/document'
|
||
|
require_relative 'doc_items/heading'
|
||
|
|
||
|
class DocFabric
|
||
|
@@color_index = 0
|
||
| ... | ... | |
|
doc
|
||
|
end
|
||
|
|
||
|
def self.create_coverage_matrix(specification)
|
||
|
doc = Coverage.new specification
|
||
|
Heading.reset_global_section_number
|
||
|
doc.headings << Heading.new(doc, doc.title, 0)
|
||
|
# Build dom
|
||
|
doc.dom = Document.new(doc.headings)
|
||
|
doc
|
||
|
end
|
||
|
|
||
|
def self.create_traceability_document(top_document, bottom_document)
|
||
|
doc = Traceability.new top_document, bottom_document
|
||
|
Heading.reset_global_section_number
|
||
|
doc.headings << Heading.new(doc, doc.title, 0)
|
||
|
# Build dom
|
||
|
doc.dom = Document.new(doc.headings)
|
||
|
doc
|
||
|
end
|
||
|
|
||
|
def self.parse_document(doc)
|
||
|
|
||
|
file = File.open(doc.path)
|
||
| lib/almirah/doc_types/base_document.rb | ||
|---|---|---|
|
attr_accessor :title
|
||
|
attr_accessor :id
|
||
|
attr_accessor :dom
|
||
|
attr_accessor :headings
|
||
|
|
||
|
def initialize()
|
||
|
@items = Array.new
|
||
| lib/almirah/doc_types/traceability.rb | ||
|---|---|---|
|
attr_accessor :is_agregated
|
||
|
attr_accessor :traced_items
|
||
|
|
||
|
def initialize(top_doc, bottom_doc, is_agregated)
|
||
|
def initialize(top_doc, bottom_doc)
|
||
|
super()
|
||
|
@top_doc = top_doc
|
||
|
@bottom_doc = bottom_doc
|
||
|
@is_agregated = is_agregated
|
||
|
@is_agregated = if bottom_doc
|
||
|
false
|
||
|
else
|
||
|
true
|
||
|
end
|
||
|
@traced_items = {}
|
||
|
|
||
|
if @is_agregated
|
||
| lib/almirah/project.rb | ||
|---|---|---|
|
require_relative 'doc_fabric'
|
||
|
require_relative 'navigation_pane'
|
||
|
require_relative 'doc_types/traceability'
|
||
|
require_relative 'doc_types/coverage'
|
||
|
require_relative 'doc_types/index'
|
||
|
require_relative 'search/specifications_db'
|
||
|
|
||
| ... | ... | |
|
|
||
|
document = @specifications_dictionary[i.to_s.downcase]
|
||
|
if document
|
||
|
trx = Traceability.new document, nil, true
|
||
|
@traceability_matrices.append trx
|
||
|
doc = DocFabric.create_traceability_document(document, nil)
|
||
|
@traceability_matrices.append doc
|
||
|
end
|
||
|
end
|
||
|
end
|
||
| ... | ... | |
|
end
|
||
|
# create coverage documents
|
||
|
@covered_specifications_dictionary.each do |_key, value|
|
||
|
trx = Coverage.new value
|
||
|
@coverage_matrices.append trx
|
||
|
doc = DocFabric.create_coverage_matrix(value)
|
||
|
@coverage_matrices.append doc
|
||
|
end
|
||
|
end
|
||
|
|
||
| ... | ... | |
|
end
|
||
|
end
|
||
|
# create treceability document
|
||
|
trx = Traceability.new top_document, bottom_document, false
|
||
|
@traceability_matrices.append trx
|
||
|
doc = DocFabric.create_traceability_document(top_document, bottom_document)
|
||
|
@traceability_matrices.append doc
|
||
|
end
|
||
|
|
||
|
def link_protocol_to_spec(protocol, specification) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
||
| ... | ... | |
|
end
|
||
|
|
||
|
def render_all_protocols
|
||
|
# create a sidebar first
|
||
|
# nav_pane = NavigationPane.new(@specifications)
|
||
|
|
||
|
path = @configuration.project_root_directory
|
||
|
|
||
|
FileUtils.mkdir_p("#{path}/build/tests/protocols")
|
||
Also available in: Unified diff
Impl: Unify navigation pane behavior for all the docs (#130)