Class: ProjectTemplate
- Inherits:
-
Object
- Object
- ProjectTemplate
- Defined in:
- lib/almirah/project_template.rb
Overview
rubocop:disable Style/Documentation
Instance Attribute Summary collapse
-
#project_root ⇒ Object
Returns the value of attribute project_root.
Instance Method Summary collapse
- #create_architecture ⇒ Object
- #create_decisions ⇒ Object
- #create_requirements ⇒ Object
- #create_test_001 ⇒ Object
- #create_test_002 ⇒ Object
- #create_test_003 ⇒ Object
- #create_test_runs ⇒ Object
- #create_tests ⇒ Object
-
#initialize(project_name) ⇒ ProjectTemplate
constructor
A new instance of ProjectTemplate.
- #run_test_001 ⇒ Object
- #run_test_002 ⇒ Object
- #run_test_003 ⇒ Object
Constructor Details
#initialize(project_name) ⇒ ProjectTemplate
Returns a new instance of ProjectTemplate.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/almirah/project_template.rb', line 8 def initialize(project_name) path = File.join(Dir.pwd, project_name) Kernel.abort 'Suggested project folder already exists' if Dir.exist? path FileUtils.mkdir_p path @project_root = path create_requirements create_architecture create_tests create_test_runs create_decisions end |
Instance Attribute Details
#project_root ⇒ Object
Returns the value of attribute project_root.
6 7 8 |
# File 'lib/almirah/project_template.rb', line 6 def project_root @project_root end |
Instance Method Details
#create_architecture ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/almirah/project_template.rb', line 56 def create_architecture path = File.join(@project_root, 'specifications/arch') FileUtils.mkdir_p path file_content = <<~EOS --- title: Architecture Specification author: put your name here --- # Overview This is an example of software architecture document. # System Overview This is a regular paragraph in the document. [ARCH-004] This is an architecture item that is related to requirement "REQ-001". >[REQ-001] [ARCH-002] This is a regular architecture item. # System Decomposition [ARCH-005] This is an architecture irem that is related to requirement "REQ-002". >[REQ-002] # Document Histrory | Revision | Description of changes | Date | |---|---|---| | A | Initial version | #{Time.now.strftime('%Y-%d-%m')} | EOS path = File.join(path, 'arch.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_decisions ⇒ Object
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/almirah/project_template.rb', line 300 def create_decisions path = File.join(@project_root, 'decisions') FileUtils.mkdir_p path file_content = <<~EOS --- title: "ADR-001: Start Project Decision" --- # Status | | Date | Status | |:---:|---|---| | * | #{Time.now.strftime('%d-%m-%Y')} | Proposed | # Context This is an example decision record. It demonstrates how Almirah captures a decision and links it to the requirements it affects. # Decision Describe the decision here. The leading "*" in the Status table marks the current state of the record. # Scope | Item | Status | Start Date | Target Date | Description | |---|---|---|---|---| | Requirements | To Do | | | | | Code | To Do | | | | | Tests | To Do | | | | # Out of Scope The ADR contains the most important sections with no detailed content. # Consequences ## Positive An ADR example will clearly show the approach Almirah framework use for any software changes. ## Negative The format of this ADR can be different that is required for the real project. ## Neutral TBD # Alternatives Considered - **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. # Affected Documents Table below shows a requirement whose text this decision creates or updates. | # | Proposed Text | Req-ID | |---|---|---| | 1 | This is a first requirement (controlled paragraph with ID equal to "REQ-001"). | >[REQ-001] | # Software Versions | Software Version Category | Software Version ID | |---|---| | Latest Released Version | n/a | | Issue Found in Version | n/a | | Target Release Version | 0.0.1 | # References TBD # Review Evidences TBD EOS path = File.join(path, 'adr-001-start-project-decision.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_requirements ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/almirah/project_template.rb', line 20 def create_requirements path = File.join(@project_root, 'specifications/req') FileUtils.mkdir_p path file_content = <<~EOS --- title: Requirements Specification author: put your name here --- # Overview This is an example of software requirements specification. # Requirements This is a regular paragraph in the document. [REQ-001] This is a first requirement (controlled paragraph with ID equal to "REQ-001"). [REQ-002] This is a second requirement. # Document Histrory | Revision | Description of changes | Date | |---|---|---| | A | Initial version | #{Time.now.strftime('%Y-%d-%m')} | EOS path = File.join(path, 'req.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_test_001 ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/almirah/project_template.rb', line 102 def create_test_001 path = File.join(@project_root, 'tests/protocols/tp-001') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TP-001 This is an example of test case for software requirement "REQ-001". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | | | | 2 | Some verification step for requirement "REQ-001" | | >[REQ-001] | EOS path = File.join(path, 'tp-001.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_test_002 ⇒ Object
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/almirah/project_template.rb', line 134 def create_test_002 path = File.join(@project_root, 'tests/protocols/tp-002') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TP-002 This is an example of test case for software requirement "REQ-002". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | | | | 2 | Some verification step for requirement "REQ-002" | | >[REQ-002] | EOS path = File.join(path, 'tp-002.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_test_003 ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/almirah/project_template.rb', line 166 def create_test_003 path = File.join(@project_root, 'tests/protocols/tq-001') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TQ-001 This is an example of test case for software architecture item "ARCH-002". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | | | | 2 | Some verification step for architecture item "ARCH-002" | | >[ARCH-002] | EOS path = File.join(path, 'tq-001.md') file = File.open(path, 'w') file.puts file_content file.close end |
#create_test_runs ⇒ Object
198 199 200 201 202 |
# File 'lib/almirah/project_template.rb', line 198 def create_test_runs run_test_001 run_test_002 run_test_003 end |
#create_tests ⇒ Object
96 97 98 99 100 |
# File 'lib/almirah/project_template.rb', line 96 def create_tests create_test_001 create_test_002 create_test_003 end |
#run_test_001 ⇒ Object
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/almirah/project_template.rb', line 204 def run_test_001 path = File.join(@project_root, 'tests/runs/001/tp-001') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TP-001 This is an example of test case for software requirement "REQ-001". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | n/a | | | 2 | Some verification step for requirement "REQ-001" | pass | >[REQ-001] | EOS path = File.join(path, 'tp-001.md') file = File.open(path, 'w') file.puts file_content file.close end |
#run_test_002 ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/almirah/project_template.rb', line 236 def run_test_002 path = File.join(@project_root, 'tests/runs/001/tp-002') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TP-002 This is an example of test case for software requirement "REQ-002". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | n/a | | | 2 | Some verification step for requirement "REQ-002" | fail | >[REQ-002] | EOS path = File.join(path, 'tp-002.md') file = File.open(path, 'w') file.puts file_content file.close end |
#run_test_003 ⇒ Object
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/almirah/project_template.rb', line 268 def run_test_003 path = File.join(@project_root, 'tests/runs/010/tq-001') FileUtils.mkdir_p path file_content = <<~EOS # Test Case TQ-001 This is an example of test case for software architecture item "ARCH-002". # Test Summary | Param | Value | |---|---| | Software Version | | | Tester Name | | | Date | | # Test Procedure | Test Step # | Test Step Description | Result | Req. Id | |---|---|---|---| | 1 | Some preparation step | n/a | | | 2 | Some verification step for architecture item "ARCH-002" | pass | >[ARCH-002] | EOS path = File.join(path, 'tq-001.md') file = File.open(path, 'w') file.puts file_content file.close end |