Class: DocFabric
- Inherits:
-
Object
- Object
- DocFabric
- Defined in:
- lib/almirah/doc_fabric.rb
Constant Summary collapse
- @@color_index =
0- @@spec_colors =
%w[cff4d2 fbeee6 ffcad4 bce6ff e4dfd9 f9e07f cbe54e d3e7ee eab595 86e3c3 ffdca2 ffffff ffdd94 d0e6a5 ffb284 f3dbcf c9bbc8 c6c09c]
Class Method Summary collapse
- .create_coverage_matrix(specification) ⇒ Object
- .create_decision(path) ⇒ Object
- .create_decisions_overview(project) ⇒ Object
- .create_implementation_document(top_document) ⇒ Object
- .create_protocol(path) ⇒ Object
- .create_risk_record(path) ⇒ Object
- .create_risk_registry_page(registry, records, preface, columns, rpn_groups = []) ⇒ Object
- .create_risks_overview(registries, configuration, prefaces = {}) ⇒ Object
- .create_source_file(repository_path, path, repository_name) ⇒ Object
- .create_specification(path) ⇒ Object
- .create_traceability_document(top_document, bottom_document) ⇒ Object
- .parse_document(doc) ⇒ Object
- .parse_source_file(doc) ⇒ Object
Class Method Details
.create_coverage_matrix(specification) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/almirah/doc_fabric.rb', line 39 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 |
.create_decision(path) ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/almirah/doc_fabric.rb', line 66 def self.create_decision(path) doc = Decision.new path DocFabric.parse_document doc doc.extract_current_status doc.extract_start_date doc.extract_target_date doc.extract_target_release_version doc.extract_owners doc end |
.create_decisions_overview(project) ⇒ Object
92 93 94 |
# File 'lib/almirah/doc_fabric.rb', line 92 def self.create_decisions_overview(project) DecisionsOverview.new project end |
.create_implementation_document(top_document) ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/almirah/doc_fabric.rb', line 57 def self.create_implementation_document(top_document) doc = Implementation.new top_document Heading.reset_global_section_number doc.headings << Heading.new(doc, doc.title, 0) # Build dom doc.dom = Document.new(doc.headings) doc end |
.create_protocol(path) ⇒ Object
33 34 35 36 37 |
# File 'lib/almirah/doc_fabric.rb', line 33 def self.create_protocol(path) doc = Protocol.new path DocFabric.parse_document doc doc end |
.create_risk_record(path) ⇒ Object
77 78 79 80 81 82 |
# File 'lib/almirah/doc_fabric.rb', line 77 def self.create_risk_record(path) doc = RiskRecord.new path DocFabric.parse_document doc doc.extract_current_status doc end |
.create_risk_registry_page(registry, records, preface, columns, rpn_groups = []) ⇒ Object
84 85 86 |
# File 'lib/almirah/doc_fabric.rb', line 84 def self.create_risk_registry_page(registry, records, preface, columns, rpn_groups = []) RiskRegistryPage.new registry, records, preface, columns, rpn_groups end |
.create_risks_overview(registries, configuration, prefaces = {}) ⇒ Object
88 89 90 |
# File 'lib/almirah/doc_fabric.rb', line 88 def self.create_risks_overview(registries, configuration, prefaces = {}) RisksOverview.new registries, configuration, prefaces end |
.create_source_file(repository_path, path, repository_name) ⇒ Object
96 97 98 99 100 |
# File 'lib/almirah/doc_fabric.rb', line 96 def self.create_source_file(repository_path, path, repository_name) doc = SourceFile.new repository_path, path, repository_name DocFabric.parse_source_file doc doc end |
.create_specification(path) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/almirah/doc_fabric.rb', line 23 def self.create_specification(path) color = @@spec_colors[@@color_index] @@color_index += 1 @@color_index = 0 if @@color_index >= @@spec_colors.length doc = Specification.new path DocFabric.parse_document doc doc.color = color doc end |
.create_traceability_document(top_document, bottom_document) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/almirah/doc_fabric.rb', line 48 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 |
.parse_document(doc) ⇒ Object
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/almirah/doc_fabric.rb', line 102 def self.parse_document(doc) file = File.open(doc.path) file_lines = file.readlines file.close DocParser.parse(doc, file_lines) # Build dom doc.dom = Document.new(doc.headings) if doc.is_a?(Specification) || doc.is_a?(Protocol) || doc.is_a?(Decision) end |
.parse_source_file(doc) ⇒ Object
113 114 115 116 117 118 119 |
# File 'lib/almirah/doc_fabric.rb', line 113 def self.parse_source_file(doc) file = File.open(doc.path) file_lines = file.readlines file.close SourceFileParser.parse(doc, file_lines) end |