defmastership 1.3.2 → 1.3.3

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.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/Guardfile +2 -5
  3. data/config/mutant.yml +2 -1
  4. data/config/rubocop.yml +20 -8
  5. data/defmastership.gemspec +4 -14
  6. data/features/changeref.feature +78 -0
  7. data/features/definition_checksum.feature +118 -0
  8. data/features/definition_version.feature +168 -0
  9. data/features/export.feature +67 -22
  10. data/features/external_ref_checksum.feature +169 -0
  11. data/features/external_ref_version.feature +173 -0
  12. data/features/internal_ref_checksum.feature +77 -0
  13. data/features/internal_ref_version.feature +81 -0
  14. data/features/rename_included_files.feature +28 -0
  15. data/lib/defmastership/app.rb +5 -6
  16. data/lib/defmastership/comment_filter.rb +2 -0
  17. data/lib/defmastership/def_type_list.rb +25 -0
  18. data/lib/defmastership/definition_parser.rb +2 -6
  19. data/lib/defmastership/document.rb +6 -9
  20. data/lib/defmastership/modifier/change_ref.rb +11 -34
  21. data/lib/defmastership/modifier/factory.rb +5 -1
  22. data/lib/defmastership/modifier/rename_included_files.rb +9 -0
  23. data/lib/defmastership/modifier/replacement_formatter.rb +37 -0
  24. data/lib/defmastership/modifier/update_def.rb +5 -1
  25. data/lib/defmastership/modifier/update_eref_checksum.rb +46 -0
  26. data/lib/defmastership/modifier/update_eref_common.rb +77 -0
  27. data/lib/defmastership/modifier/update_eref_version.rb +46 -0
  28. data/lib/defmastership/modifier/update_iref_checksum.rb +51 -0
  29. data/lib/defmastership/modifier/update_iref_common.rb +45 -0
  30. data/lib/defmastership/modifier/update_iref_version.rb +58 -0
  31. data/lib/defmastership/version.rb +1 -1
  32. data/spec/spec_helper.rb +11 -10
  33. data/spec/unit/defmastership/app_spec.rb +32 -19
  34. data/spec/unit/defmastership/batch_modifier_spec.rb +9 -7
  35. data/spec/unit/defmastership/def_type_list_spec.rb +22 -0
  36. data/spec/unit/defmastership/definition_spec.rb +8 -51
  37. data/spec/unit/defmastership/document_spec.rb +12 -36
  38. data/spec/unit/defmastership/export/body_formatter_spec.rb +5 -18
  39. data/spec/unit/defmastership/export/csv/formatter_spec.rb +1 -0
  40. data/spec/unit/defmastership/export/header_formatter_spec.rb +2 -6
  41. data/spec/unit/defmastership/hash_spec.rb +2 -0
  42. data/spec/unit/defmastership/modifier/change_ref_spec.rb +33 -70
  43. data/spec/unit/defmastership/modifier/factory_spec.rb +40 -17
  44. data/spec/unit/defmastership/modifier/modifier_common_spec.rb +2 -0
  45. data/spec/unit/defmastership/modifier/rename_included_files_spec.rb +62 -46
  46. data/spec/unit/defmastership/modifier/update_def_checksum_spec.rb +2 -9
  47. data/spec/unit/defmastership/modifier/update_def_spec.rb +76 -21
  48. data/spec/unit/defmastership/modifier/update_def_version_spec.rb +6 -32
  49. data/spec/unit/defmastership/modifier/update_eref_checksum_spec.rb +200 -0
  50. data/spec/unit/defmastership/modifier/update_eref_version_spec.rb +215 -0
  51. data/spec/unit/defmastership/modifier/update_iref_checksum_spec.rb +133 -0
  52. data/spec/unit/defmastership/modifier/update_iref_version_spec.rb +162 -0
  53. data/tasks/code_quality.rake +1 -8
  54. data/tasks/test.rake +15 -0
  55. metadata +34 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48dcfc9355927a24217b26f811929da3faa225f85429ad6c09502acb1a8d9330
4
- data.tar.gz: b18de20de3320444e7a30b2d93a63194672c8ae3d5abc6eab25d39877151234d
3
+ metadata.gz: 568d3b059a4327d2b486468b9867230d3547f9f499134c85e6c1d013761373a8
4
+ data.tar.gz: 8b9bf9d9abe528e104a3105a5ebd7c9fc83060282e56b81c7dfab8509eaa3b97
5
5
  SHA512:
6
- metadata.gz: 8d9432830f28f130973894adc2e7a973568338e6d418ea808257ef3bdac58dd81ae5ed2c6195db9a6045132d6ac0bceefd35329b7d5f52733d85b2bb0205b2d2
7
- data.tar.gz: ffdcbfffb2a16e5eb79432da1ce89b4d6264866336b3b20196d03432f6026e283db369cf9f99e71abdb885cfbf1747fcd0db74586bd5aab38c667b25d46e954e
6
+ metadata.gz: 21e893b27a124ae1cdd50fa3312f06fa767d87cd44953f3f5b133e29c7bf6c21bd9f53c5683738c27bafa5050159be2f548068433995d15c45b442df9b136ceb
7
+ data.tar.gz: d04e16d41f24eee527638d475101080de60115cdaabd8ee48cc2b81084256cb1db6556ca8f5ecf9b123154b45b2b7be77b6af5a8ba56877eaa6ec9338b7d27fe
data/Guardfile CHANGED
@@ -30,15 +30,12 @@ guard :rspec, cmd: 'bundle exec rspec --options config/rspec' do
30
30
  dsl.watch_spec_files_for(ruby.lib_files)
31
31
  end
32
32
 
33
- guard :rubocop,
34
- all_on_start: true,
35
- cli: ['--display-cop-names', '--config=config/rubocop.yml'] do
33
+ guard :rubocop, all_on_start: true, cli: ['--display-cop-names', '--config=config/rubocop.yml'] do
36
34
  watch(/.+\.rb$/)
37
35
  watch(%r{(?:.+/)?\.rubocop(?:_todo)?\.yml$}) { |m| File.dirname(m.first) }
38
36
  end
39
37
 
40
- guard :reek,
41
- cli: ['--config config/reek.yml', '--single-line'] do
38
+ guard :reek, cli: ['--config config/reek.yml', '--single-line'] do
42
39
  watch(/.+\.rb$/)
43
40
  watch('config/reek.yml')
44
41
  end
data/config/mutant.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  usage: opensource
3
- # fail_fast: true
4
3
  includes:
5
4
  - lib
6
5
  integration:
@@ -8,6 +7,8 @@ integration:
8
7
  arguments:
9
8
  - --options=config/rspec
10
9
  - spec
10
+ environment_variables:
11
+ CODE_COVERAGE_IN_RSPEC: disabled
11
12
  requires:
12
13
  - defmastership/batch_modifier
13
14
  - defmastership/comment_filter
data/config/rubocop.yml CHANGED
@@ -27,21 +27,25 @@ Style/Copyright:
27
27
  Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
28
28
  AutocorrectNotice: '# Copyright (c) 2023 Jerome Arbez-Gindre'
29
29
 
30
- Lint/ConstantResolution: # Not available ins rubocop 0.81
30
+ Lint/ConstantResolution:
31
31
  Enabled: false
32
32
 
33
33
  Style/DocumentationMethod:
34
- Enabled: false
34
+ Enabled: true
35
35
 
36
36
  Style/StringHashKeys :
37
37
  Enabled: true
38
38
  Exclude:
39
39
  - '*.gemspec'
40
- - 'spec/unit/defmastership/app_spec.rb'
41
- - 'spec/unit/defmastership/batch_modifier_spec.rb'
42
- - 'spec/unit/defmastership/modifier/update_def_checksum_spec.rb'
43
- - 'spec/unit/defmastership/modifier/update_def_spec.rb'
44
- - 'spec/unit/defmastership/modifier/update_def_version_spec.rb'
40
+ - spec/unit/defmastership/app_spec.rb
41
+ - spec/unit/defmastership/batch_modifier_spec.rb
42
+ - spec/unit/defmastership/modifier/update_def_checksum_spec.rb
43
+ - spec/unit/defmastership/modifier/update_def_spec.rb
44
+ - spec/unit/defmastership/modifier/update_def_version_spec.rb
45
+ - spec/unit/defmastership/modifier/update_eref_checksum_spec.rb
46
+ - spec/unit/defmastership/modifier/update_eref_version_spec.rb
47
+ - spec/unit/defmastership/modifier/update_iref_checksum_spec.rb
48
+ - spec/unit/defmastership/modifier/update_iref_version_spec.rb
45
49
 
46
50
  Style/MissingElse:
47
51
  EnforcedStyle: case
@@ -72,8 +76,16 @@ RSpec/SpecFilePathSuffix :
72
76
  RSpec/NestedGroups:
73
77
  Max: 4
74
78
 
79
+ RSpec/AnyInstance:
80
+ Enabled: true
81
+ Exclude:
82
+ - spec/unit/defmastership/modifier/update_eref_checksum_spec.rb
83
+ - spec/unit/defmastership/modifier/update_eref_version_spec.rb
84
+ - spec/unit/defmastership/modifier/update_iref_checksum_spec.rb
85
+ - spec/unit/defmastership/modifier/update_iref_version_spec.rb
86
+
75
87
  Layout/RedundantLineBreak:
76
- Enabled: false
88
+ Enabled: true
77
89
 
78
90
  Style/DisableCopsWithinSourceCodeDirective:
79
91
  Enabled: true
@@ -3,21 +3,10 @@
3
3
 
4
4
  # Ensure we require the local version and not one we might have
5
5
  # installed already
6
- require(
7
- File.join(
8
- [
9
- File.dirname(__FILE__),
10
- 'lib',
11
- 'defmastership',
12
- 'version.rb'
13
- ]
14
- )
15
- )
6
+ require(File.join([File.dirname(__FILE__), 'lib', 'defmastership', 'version.rb']))
16
7
 
17
8
  Gem::Specification.new do |spec|
18
- spec.metadata = {
19
- 'rubygems_mfa_required' => 'true'
20
- }
9
+ spec.metadata = { 'rubygems_mfa_required' => 'true' }
21
10
  spec.required_ruby_version = '>= 3.0'
22
11
  spec.name = 'defmastership'
23
12
  spec.version = Defmastership::VERSION
@@ -34,9 +23,10 @@ Gem::Specification.new do |spec|
34
23
  spec.add_dependency('aasm', '~> 5.5')
35
24
  spec.add_dependency('asciidoctor', '~> 2.0')
36
25
  spec.add_dependency('csv', '~> 3.3')
37
- spec.add_dependency('defmastership-core', '~> 1.5')
26
+ spec.add_dependency('defmastership-core', '~> 1.5.3')
38
27
  spec.add_dependency('facets', '~> 3.1')
39
28
  spec.add_dependency('git', '~> 3.1')
40
29
  spec.add_dependency('gli', '~> 2.22')
30
+ spec.add_dependency('memoist', '~> 0.16')
41
31
  spec.add_dependency('ostruct', '~> 0.6')
42
32
  end
@@ -383,3 +383,81 @@ Feature: The changeref command
383
383
  [define, requirement, TOTO-TEMP-XXX1]
384
384
  ....
385
385
  """
386
+
387
+ Scenario: Change a definition if the definitions's type fits with one value
388
+ Given a file named "modifications.yml" with:
389
+ """
390
+ ---
391
+ :toto:
392
+ :type: change_ref
393
+ :config:
394
+ :def_type: requirement
395
+ :from_regexp: TOTO-TEMP-[X\d]{4}
396
+ :to_template: TOTO-%<next_ref>04d
397
+ :next_ref: 123
398
+ """
399
+ And a file named "thedoc.adoc" with:
400
+ """
401
+ [define, requirement, TOTO-TEMP-XXX1]
402
+ [define, no_fit, TOTO-TEMP-XXX2]
403
+ """
404
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
405
+ Then the stdout should not contain anything
406
+ And the file "modifications.yml" should contain:
407
+ """
408
+ ---
409
+ :toto:
410
+ :type: change_ref
411
+ :config:
412
+ :def_type: requirement
413
+ :from_regexp: TOTO-TEMP-[X\d]{4}
414
+ :to_template: TOTO-%<next_ref>04d
415
+ :next_ref: 124
416
+ """
417
+ And the file "thedoc.adoc" should contain:
418
+ """
419
+ [define, requirement, TOTO-0123]
420
+ [define, no_fit, TOTO-TEMP-XXX2]
421
+ """
422
+
423
+ Scenario: Change a definition if the definitions's type fits with a liste of values
424
+ Given a file named "modifications.yml" with:
425
+ """
426
+ ---
427
+ :toto:
428
+ :type: change_ref
429
+ :config:
430
+ :def_type:
431
+ - requirement
432
+ - pouet
433
+ :from_regexp: TOTO-TEMP-[X\d]{4}
434
+ :to_template: TOTO-%<next_ref>04d
435
+ :next_ref: 123
436
+ """
437
+ And a file named "thedoc.adoc" with:
438
+ """
439
+ [define, requirement, TOTO-TEMP-XXX1]
440
+ [define, not_included, TOTO-TEMP-XXX2]
441
+ [define, pouet, TOTO-TEMP-XXX3]
442
+ """
443
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
444
+ Then the stdout should not contain anything
445
+ And the file "modifications.yml" should contain:
446
+ """
447
+ ---
448
+ :toto:
449
+ :type: change_ref
450
+ :config:
451
+ :def_type:
452
+ - requirement
453
+ - pouet
454
+ :from_regexp: TOTO-TEMP-[X\d]{4}
455
+ :to_template: TOTO-%<next_ref>04d
456
+ :next_ref: 125
457
+ """
458
+ And the file "thedoc.adoc" should contain:
459
+ """
460
+ [define, requirement, TOTO-0123]
461
+ [define, not_included, TOTO-TEMP-XXX2]
462
+ [define, pouet, TOTO-0124]
463
+ """
@@ -372,3 +372,121 @@ Feature: definition checksum
372
372
  the requirement value.
373
373
  --
374
374
  """
375
+
376
+ Scenario: Checksum update with not set def_type
377
+ Given a file named "modifications.yml" with:
378
+ """
379
+ ---
380
+ :update_requirement_checksum:
381
+ :type: update_def_checksum
382
+ """
383
+ And a file named "thedoc.adoc" with:
384
+ """
385
+ [define, requirement, TOTO-TEMP]
386
+ --
387
+ the requirement value.
388
+ --
389
+
390
+ [define, whatever, TUTU-TEMP]
391
+ --
392
+ the requirement value.
393
+ --
394
+ """
395
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
396
+ Then the stdout should not contain anything
397
+ And the file "thedoc.adoc" should contain:
398
+ """
399
+ [define, requirement, TOTO-TEMP(~244eed18)]
400
+ --
401
+ the requirement value.
402
+ --
403
+
404
+ [define, whatever, TUTU-TEMP(~244eed18)]
405
+ --
406
+ the requirement value.
407
+ --
408
+ """
409
+
410
+ Scenario: Checksum update with def_type set to all
411
+ Given a file named "modifications.yml" with:
412
+ """
413
+ ---
414
+ :update_requirement_checksum:
415
+ :type: update_def_checksum
416
+ :config:
417
+ :def_type: all
418
+ """
419
+ And a file named "thedoc.adoc" with:
420
+ """
421
+ [define, requirement, TOTO-TEMP]
422
+ --
423
+ the requirement value.
424
+ --
425
+
426
+ [define, whatever, TUTU-TEMP]
427
+ --
428
+ the requirement value.
429
+ --
430
+ """
431
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
432
+ Then the stdout should not contain anything
433
+ And the file "thedoc.adoc" should contain:
434
+ """
435
+ [define, requirement, TOTO-TEMP(~244eed18)]
436
+ --
437
+ the requirement value.
438
+ --
439
+
440
+ [define, whatever, TUTU-TEMP(~244eed18)]
441
+ --
442
+ the requirement value.
443
+ --
444
+ """
445
+
446
+ Scenario: Checksum update with def_type set to a list
447
+ Given a file named "modifications.yml" with:
448
+ """
449
+ ---
450
+ :update_requirement_checksum:
451
+ :type: update_def_checksum
452
+ :config:
453
+ :def_type:
454
+ - requirement
455
+ - pouet
456
+ """
457
+ And a file named "thedoc.adoc" with:
458
+ """
459
+ [define, requirement, TOTO-TEMP]
460
+ --
461
+ the requirement value.
462
+ --
463
+
464
+ [define, pouet, TITI-TEMP]
465
+ --
466
+ the requirement value.
467
+ --
468
+
469
+ [define, whatever, TUTU-TEMP]
470
+ --
471
+ the requirement value.
472
+ --
473
+ """
474
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
475
+ Then the stdout should not contain anything
476
+ And the file "thedoc.adoc" should contain:
477
+ """
478
+ [define, requirement, TOTO-TEMP(~244eed18)]
479
+ --
480
+ the requirement value.
481
+ --
482
+
483
+ [define, pouet, TITI-TEMP(~244eed18)]
484
+ --
485
+ the requirement value.
486
+ --
487
+
488
+ [define, whatever, TUTU-TEMP]
489
+ --
490
+ the requirement value.
491
+ --
492
+ """
@@ -435,3 +435,171 @@ Feature: definitions version
435
435
  --
436
436
  """
437
437
 
438
+ Scenario: Version update with not set def_type
439
+ Given a file named "ref_doc.adoc" with:
440
+ """
441
+ [define, requirement, TOTO-0001]
442
+ --
443
+ Requirement: initial text.
444
+ --
445
+
446
+ [define, whatever, TOTO-0002]
447
+ --
448
+ Whatever: initial text.
449
+ --
450
+
451
+ """
452
+ Given a file named "thedoc.adoc" with:
453
+ """
454
+ [define, requirement, TOTO-0001]
455
+ --
456
+ Requirement: modified text.
457
+ --
458
+
459
+ [define, whatever, TOTO-0002]
460
+ --
461
+ Whatever: modified text.
462
+ --
463
+ """
464
+ And a file named "modifications.yml" with:
465
+ """
466
+ ---
467
+ :update_requirement_version:
468
+ :type: update_def_version
469
+ :config:
470
+ :first_version: a
471
+ :ref_document: ./ref_doc.adoc
472
+ """
473
+ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
474
+ And the stdout should not contain anything
475
+ Then the file "thedoc.adoc" should contain:
476
+ """
477
+ [define, requirement, TOTO-0001(a)]
478
+ --
479
+ Requirement: modified text.
480
+ --
481
+
482
+ [define, whatever, TOTO-0002(a)]
483
+ --
484
+ Whatever: modified text.
485
+ --
486
+ """
487
+
488
+ Scenario: Version update with not set to all
489
+ Given a file named "ref_doc.adoc" with:
490
+ """
491
+ [define, requirement, TOTO-0001]
492
+ --
493
+ Requirement: initial text.
494
+ --
495
+
496
+ [define, whatever, TOTO-0002]
497
+ --
498
+ Whatever: initial text.
499
+ --
500
+
501
+ """
502
+ Given a file named "thedoc.adoc" with:
503
+ """
504
+ [define, requirement, TOTO-0001]
505
+ --
506
+ Requirement: modified text.
507
+ --
508
+
509
+ [define, whatever, TOTO-0002]
510
+ --
511
+ Whatever: modified text.
512
+ --
513
+ """
514
+ And a file named "modifications.yml" with:
515
+ """
516
+ ---
517
+ :update_requirement_version:
518
+ :type: update_def_version
519
+ :config:
520
+ :def_type: all
521
+ :first_version: a
522
+ :ref_document: ./ref_doc.adoc
523
+ """
524
+ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
525
+ And the stdout should not contain anything
526
+ Then the file "thedoc.adoc" should contain:
527
+ """
528
+ [define, requirement, TOTO-0001(a)]
529
+ --
530
+ Requirement: modified text.
531
+ --
532
+
533
+ [define, whatever, TOTO-0002(a)]
534
+ --
535
+ Whatever: modified text.
536
+ --
537
+ """
538
+
539
+ Scenario: Version update with not set to a list
540
+ Given a file named "ref_doc.adoc" with:
541
+ """
542
+ [define, requirement, TOTO-0001]
543
+ --
544
+ Requirement: initial text.
545
+ --
546
+
547
+ [define, pouet, TOTO-0003]
548
+ --
549
+ Pouet: initial text.
550
+ --
551
+
552
+ [define, whatever, TOTO-0002]
553
+ --
554
+ Whatever: initial text.
555
+ --
556
+
557
+ """
558
+ Given a file named "thedoc.adoc" with:
559
+ """
560
+ [define, requirement, TOTO-0001]
561
+ --
562
+ Requirement: modified text.
563
+ --
564
+
565
+ [define, pouet, TOTO-0003]
566
+ --
567
+ Pouet: modified text.
568
+ --
569
+
570
+ [define, whatever, TOTO-0002]
571
+ --
572
+ Whatever: modified text.
573
+ --
574
+ """
575
+ And a file named "modifications.yml" with:
576
+ """
577
+ ---
578
+ :update_requirement_version:
579
+ :type: update_def_version
580
+ :config:
581
+ :def_type:
582
+ - requirement
583
+ - pouet
584
+ :first_version: a
585
+ :ref_document: ./ref_doc.adoc
586
+ """
587
+ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
588
+ And the stdout should not contain anything
589
+ Then the file "thedoc.adoc" should contain:
590
+ """
591
+ [define, requirement, TOTO-0001(a)]
592
+ --
593
+ Requirement: modified text.
594
+ --
595
+
596
+ [define, pouet, TOTO-0003(a)]
597
+ --
598
+ Pouet: modified text.
599
+ --
600
+
601
+ [define, whatever, TOTO-0002]
602
+ --
603
+ Whatever: modified text.
604
+ --
605
+ """