Almirah 0.3.1 → 0.4.1

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.
@@ -14,6 +14,7 @@ class ProjectTemplate # rubocop:disable Style/Documentation
14
14
  create_architecture
15
15
  create_tests
16
16
  create_test_runs
17
+ create_decisions
17
18
  end
18
19
 
19
20
  def create_requirements
@@ -265,7 +266,7 @@ class ProjectTemplate # rubocop:disable Style/Documentation
265
266
  end
266
267
 
267
268
  def run_test_003
268
- path = File.join(@project_root, 'tests/runs/010/tq-002')
269
+ path = File.join(@project_root, 'tests/runs/010/tq-001')
269
270
  FileUtils.mkdir_p path
270
271
 
271
272
  file_content = <<~EOS
@@ -295,4 +296,91 @@ class ProjectTemplate # rubocop:disable Style/Documentation
295
296
  file.puts file_content
296
297
  file.close
297
298
  end
299
+
300
+ def create_decisions
301
+ path = File.join(@project_root, 'decisions')
302
+ FileUtils.mkdir_p path
303
+
304
+ file_content = <<~EOS
305
+ ---
306
+ title: "ADR-001: Start Project Decision"
307
+ ---
308
+
309
+ # Status
310
+
311
+ | | Date | Status |
312
+ |:---:|---|---|
313
+ | * | #{Time.now.strftime('%d-%m-%Y')} | Proposed |
314
+
315
+ # Context
316
+
317
+ This is an example decision record. It demonstrates how Almirah captures a
318
+ decision and links it to the requirements it affects.
319
+
320
+ # Decision
321
+
322
+ Describe the decision here. The leading "*" in the Status table marks the
323
+ current state of the record.
324
+
325
+ # Scope
326
+
327
+ | Item | Status | Start Date | Target Date | Description |
328
+ |---|---|---|---|---|
329
+ | Requirements | To Do | | | |
330
+ | Code | To Do | | | |
331
+ | Tests | To Do | | | |
332
+
333
+ # Out of Scope
334
+
335
+ The ADR contains the most important sections with no detailed content.
336
+
337
+ # Consequences
338
+
339
+ ## Positive
340
+
341
+ An ADR example will clearly show the approach Almirah framework use for any software changes.
342
+
343
+ ## Negative
344
+
345
+ The format of this ADR can be different that is required for the real project.
346
+
347
+ ## Neutral
348
+
349
+ TBD
350
+
351
+ # Alternatives Considered
352
+
353
+ - **Add an empty `decisions/` directory only.** Rejected: an empty folder neither teaches the format nor causes the overview page to render, so it would not exercise the feature.
354
+
355
+ # Affected Documents
356
+
357
+ Table below shows a requirement whose text this decision creates or updates.
358
+
359
+ | # | Proposed Text | Req-ID |
360
+ |---|---|---|
361
+ | 1 | This is a first requirement (controlled paragraph with ID equal to "REQ-001"). | >[REQ-001] |
362
+
363
+ # Software Versions
364
+
365
+ | Software Version Category | Software Version ID |
366
+ |---|---|
367
+ | Latest Released Version | n/a |
368
+ | Issue Found in Version | n/a |
369
+ | Target Release Version | 0.0.1 |
370
+
371
+ # References
372
+
373
+ TBD
374
+
375
+ # Review Evidences
376
+
377
+ TBD
378
+
379
+ EOS
380
+
381
+ path = File.join(path, 'adr-001-start-project-decision.md')
382
+ file = File.open(path, 'w')
383
+ file.puts file_content
384
+ file.close
385
+ end
298
386
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
5
+ # Computes the relative URL between two generated pages, each given as a path
6
+ # relative to the build root (e.g. "decisions/release 0.4.1/adr-185.html").
7
+ # Produces forward-slash separators with spaces percent-encoded. Shared by all
8
+ # internal cross-document links (ADR-186).
9
+ module RelativeUrl
10
+ module_function
11
+
12
+ def between(from_output_rel, to_output_rel, fragment: nil)
13
+ from_dir = Pathname.new(from_output_rel).dirname
14
+ rel = Pathname.new(to_output_rel).relative_path_from(from_dir).to_s
15
+ url = rel.split('/').map { |segment| encode_segment(segment) }.join('/')
16
+ fragment && !fragment.empty? ? "#{url}##{fragment}" : url
17
+ end
18
+
19
+ def encode_segment(segment)
20
+ segment.gsub(' ', '%20')
21
+ end
22
+ end
@@ -16,7 +16,7 @@ class SpecificationsDb
16
16
  @specifications.each do |sp|
17
17
  sp.items.each do |i|
18
18
  if (i.instance_of? Paragraph) or (i.instance_of? ControlledParagraph)
19
- e = { 'document' => i.parent_doc.title, \
19
+ e = { 'doc_title' => i.parent_doc.title, \
20
20
  'doc_color' => i.parent_doc.color, \
21
21
  'text' => i.text, \
22
22
  'heading_url' => i.parent_heading.get_url, \
@@ -36,7 +36,7 @@ class SpecificationsDb
36
36
  item_to_process.rows.each do |r|
37
37
  if r.is_a?(MarkdownList)
38
38
  f_text = r.text
39
- e = { 'document' => item_for_reference.parent_doc.title, \
39
+ e = { 'doc_title' => item_for_reference.parent_doc.title, \
40
40
  'doc_color' => item_for_reference.parent_doc.color, \
41
41
  'text' => f_text, \
42
42
  'heading_url' => item_for_reference.parent_heading.get_url, \
@@ -45,7 +45,7 @@ class SpecificationsDb
45
45
  add_markdown_list_item_to_db(data, item_for_reference, r)
46
46
  else
47
47
  f_text = r
48
- e = { 'document' => item_for_reference.parent_doc.title, \
48
+ e = { 'doc_title' => item_for_reference.parent_doc.title, \
49
49
  'doc_color' => item_for_reference.parent_doc.color, \
50
50
  'text' => f_text, \
51
51
  'heading_url' => item_for_reference.parent_heading.get_url, \
@@ -61,7 +61,7 @@ class SpecificationsDb
61
61
  item_to_process.rows.each do |row|
62
62
  table_text += "| #{row.join(' | ')} |"
63
63
  end
64
- e = { 'document' => item_for_reference.parent_doc.title, \
64
+ e = { 'doc_title' => item_for_reference.parent_doc.title, \
65
65
  'doc_color' => item_for_reference.parent_doc.color, \
66
66
  'text' => table_text, \
67
67
  'heading_url' => item_for_reference.parent_heading.get_url, \
@@ -64,11 +64,14 @@ table.markdown_table th{
64
64
  background-color:#EEEEEE;
65
65
  }
66
66
  table.markdown_table td{
67
- border: 1px solid #bbb;
67
+ border: 1px solid #bbb;
68
68
  padding: 4px;
69
69
  display: table-cell;
70
70
  vertical-align: inherit;
71
71
  }
72
+ table.markdown_table tr.current_status td {
73
+ background-color: #ffffee;
74
+ }
72
75
  table.controlled{
73
76
  border: 1px solid #e4e4e4;
74
77
  border-collapse: collapse;
@@ -110,9 +113,32 @@ table.controlled td.item_id {
110
113
  width: 3%;
111
114
  text-align: center;
112
115
  }
116
+ table.controlled td.item_type {
117
+ width: 5%;
118
+ text-align: center;
119
+ font-weight: normal;
120
+ }
121
+ table.controlled td.item_status {
122
+ width: 5%;
123
+ text-align: center;
124
+ white-space: nowrap;
125
+ }
113
126
  table.controlled td.item_text{
114
127
  text-align: left;
115
128
  }
129
+ .decisions_overview_charts {
130
+ display: grid;
131
+ grid-template-columns: repeat(3, 1fr);
132
+ gap: 16px;
133
+ margin-bottom: 16px;
134
+ }
135
+ .decisions_overview_charts .chart_cell {
136
+ min-height: 240px;
137
+ }
138
+ .decisions_overview_charts .chart_cell canvas {
139
+ max-width: 100%;
140
+ max-height: 300px;
141
+ }
116
142
  table.controlled:not(.odd-even) tbody tr:nth-child(odd) { background-color:#f6f7f8; }
117
143
  table.controlled:not(.odd-even) tbody tr:nth-child(even) { background-color: #fff; }
118
144
  table.controlled:not(.odd-even) tbody tr:nth-child(odd):hover,
@@ -128,6 +154,11 @@ a:active {
128
154
  text-decoration: none;
129
155
  display: inline-block;
130
156
  }
157
+ a.broken_link, a.broken_link:link, a.broken_link:visited, span.broken_link {
158
+ color: #c00;
159
+ text-decoration: underline wavy #c00;
160
+ cursor: help;
161
+ }
131
162
  div.blockquote {
132
163
  display: block;
133
164
  background:#f9f9fb;
@@ -146,6 +177,15 @@ code {
146
177
  margin-top: 4px;
147
178
  margin-bottom: 4px;
148
179
  }
180
+ code.inline {
181
+ display: inline;
182
+ background:#f4f4f4;
183
+ border: 1px solid #ddd;
184
+ border-left: 1px solid #ddd;
185
+ border-radius: 3px;
186
+ padding: 0 4px;
187
+ margin: 0;
188
+ }
149
189
  div.todoblock {
150
190
  display: block;
151
191
  background:#fcc;
@@ -50,7 +50,13 @@ function openNav() {
50
50
  clicked.style.display = 'none';
51
51
  id_parts = clicked.id.split("_");
52
52
  required_id = "COVS_" + id_parts[1];
53
- document.getElementById(required_id).style.display = 'block';
53
+ document.getElementById(required_id).style.display = 'block';
54
+ }
55
+ function decisionLink_OnClick(clicked){
56
+ clicked.style.display = 'none';
57
+ id_parts = clicked.id.split("_");
58
+ required_id = "DRS_" + id_parts[1];
59
+ document.getElementById(required_id).style.display = 'block';
54
60
  }
55
61
  function upLink_OnClick(clicked){
56
62
  clicked.style.display = 'none';
@@ -1,5 +1,5 @@
1
1
  // Do search only on the Index Page
2
- import { create, search, insert } from 'https://unpkg.com/@orama/orama@latest/dist/index.js'
2
+ import { create, search, insert } from 'https://unpkg.com/@orama/orama@3.1.18/dist/browser/index.js'
3
3
 
4
4
  // Create DB
5
5
  const db = await create({
@@ -19,7 +19,7 @@ const data_rows = await response.json();
19
19
  let i = 0;
20
20
  while (i < data_rows.length) {
21
21
  await insert(db, {
22
- document: data_rows[i]["document"],
22
+ doc_title: data_rows[i]["doc_title"],
23
23
  doc_color: data_rows[i]["doc_color"],
24
24
  text: data_rows[i]["text"],
25
25
  heading_url: data_rows[i]["heading_url"],
@@ -66,7 +66,7 @@ async function search_onKeyUp(){
66
66
  }else{
67
67
 
68
68
  searchResult.hits.forEach ((value, index, array) =>{
69
- const doc_title = value.document["document"]
69
+ const doc_title = value.document["doc_title"]
70
70
  const doc_color = value.document["doc_color"]
71
71
  const heading_url = value.document["heading_url"]
72
72
  const heading_text = value.document["heading_text"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Almirah
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleksandr Ivanov
@@ -58,6 +58,7 @@ extra_rdoc_files: []
58
58
  files:
59
59
  - bin/almirah
60
60
  - lib/almirah.rb
61
+ - lib/almirah/console_reporter.rb
61
62
  - lib/almirah/doc_fabric.rb
62
63
  - lib/almirah/doc_items/blockquote.rb
63
64
  - lib/almirah/doc_items/code_block.rb
@@ -78,6 +79,8 @@ files:
78
79
  - lib/almirah/doc_parser.rb
79
80
  - lib/almirah/doc_types/base_document.rb
80
81
  - lib/almirah/doc_types/coverage.rb
82
+ - lib/almirah/doc_types/decision.rb
83
+ - lib/almirah/doc_types/decisions_overview.rb
81
84
  - lib/almirah/doc_types/implementation.rb
82
85
  - lib/almirah/doc_types/index.rb
83
86
  - lib/almirah/doc_types/persistent_document.rb
@@ -87,6 +90,7 @@ files:
87
90
  - lib/almirah/doc_types/traceability.rb
88
91
  - lib/almirah/dom/doc_section.rb
89
92
  - lib/almirah/dom/document.rb
93
+ - lib/almirah/link_registry.rb
90
94
  - lib/almirah/navigation_pane.rb
91
95
  - lib/almirah/project.rb
92
96
  - lib/almirah/project/doc_linker.rb
@@ -94,6 +98,7 @@ files:
94
98
  - lib/almirah/project_configuration.rb
95
99
  - lib/almirah/project_template.rb
96
100
  - lib/almirah/project_utility.rb
101
+ - lib/almirah/relative_url.rb
97
102
  - lib/almirah/search/specifications_db.rb
98
103
  - lib/almirah/source_file_parser.rb
99
104
  - lib/almirah/templates/css/main.css