defmastership 1.3.0 → 1.3.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +7 -44
  3. data/Gemfile +29 -57
  4. data/bin/defmastership +1 -109
  5. data/config/mutant.yml +27 -22
  6. data/config/rubocop.yml +5 -2
  7. data/defmastership.gemspec +9 -8
  8. data/features/changeref.feature +112 -1
  9. data/features/definition_version.feature +41 -1
  10. data/features/step_definitions/git_steps.rb +1 -1
  11. data/lib/defmastership/app.rb +115 -0
  12. data/lib/defmastership/batch_modifier.rb +2 -0
  13. data/lib/defmastership/config_preserver.rb +45 -0
  14. data/lib/defmastership/definition.rb +4 -2
  15. data/lib/defmastership/document.rb +6 -1
  16. data/lib/defmastership/export/body_formatter.rb +0 -2
  17. data/lib/defmastership/export/header_formatter.rb +0 -2
  18. data/lib/defmastership/hash_merge_no_new.rb +24 -0
  19. data/lib/defmastership/modifier/change_ref.rb +72 -7
  20. data/lib/defmastership/modifier/factory.rb +5 -0
  21. data/lib/defmastership/modifier/rename_included_files.rb +1 -3
  22. data/lib/defmastership/modifier/update_def.rb +1 -3
  23. data/lib/defmastership/modifier/update_def_checksum.rb +1 -1
  24. data/lib/defmastership/modifier/update_def_version.rb +4 -5
  25. data/lib/defmastership/version.rb +1 -1
  26. data/spec/spec_helper.rb +1 -10
  27. data/spec/unit/defmastership/app_spec.rb +235 -0
  28. data/spec/unit/defmastership/config_preserver_spec.rb +127 -0
  29. data/spec/unit/defmastership/export/csv/formatter_spec.rb +0 -2
  30. data/spec/unit/defmastership/hash_spec.rb +27 -0
  31. data/spec/unit/defmastership/modifier/change_ref_spec.rb +116 -1
  32. data/spec/unit/defmastership/modifier/modifier_common_spec.rb +0 -2
  33. data/spec/unit/defmastership/modifier/update_def_spec.rb +0 -2
  34. data/spec/unit/defmastership/modifier/update_def_version_spec.rb +4 -4
  35. metadata +38 -24
  36. data/lib/defmastership/set_join_hack.rb +0 -13
  37. data/lib/defmastership.rb +0 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3101cc665380665519681d6644d3ba5bd818772542e2877305f94fabcc3b0d5b
4
- data.tar.gz: 32a279c031db21c8bc9e58175c0842de490c922f8eb0538032bb8509ae39a3dc
3
+ metadata.gz: 53e14ee5a671db1f61203808a5136d16cf346cfd2880e5ff39ffa822b6131df7
4
+ data.tar.gz: f4235cec1338a38892901d804fba920cca1e907c1a622540ea5b6a3eead4a523
5
5
  SHA512:
6
- metadata.gz: a4029e2b886ba957c645381e00bd61007871075795a86c802bf618e0ca8f67609b62f16085e43ab7fcd54180d16474acfa72a1fc7effcf3c469995e9a7ed02be
7
- data.tar.gz: fcd4f16c6fdcd001b02dc5378bce594a3df0be78a0fda6560c628be35a10d9ddccddea213152ceb0d514bc92eaf74cf90a836c6293e92b128f7f0d29175136f1
6
+ metadata.gz: 0fd2843e5cf8b1e432696fb8d58c01c7c36b51d8a6c9509907717f8a9eb794d7c93361a0b18a285e4747ec5a821c5e388669c963ab9463a74bc9b455b948e45a
7
+ data.tar.gz: 2604bc1ee99150a82210c993219d941e1a2ca1ce43c2b8dc4adba385b5d5f880751f410f2975a82875db6453e22e58ef5616a7705c5cc6105b16ed2c46a1fc13
data/.gitlab-ci.yml CHANGED
@@ -1,9 +1,6 @@
1
1
  default:
2
- image: ruby:3.3
2
+ image: ruby:3.4
3
3
  before_script:
4
- - apt-get update
5
- - ruby -v
6
- - which ruby
7
4
  - gem install bundler --no-document
8
5
  - bundle install --jobs $(nproc) "${FLAGS[@]}"
9
6
  - git config --global user.email "you@example.com"
@@ -35,56 +32,22 @@ yard documentation:
35
32
  paths:
36
33
  - doc
37
34
 
38
- bdd ruby2.7:
39
- image: ruby:2.7
40
- before_script:
41
- - apt-get update
42
- - ruby -v
43
- - which ruby
44
- - gem install bundler -v 2.4.22 --no-document
45
- - bundle install --jobs $(nproc) "${FLAGS[@]}"
46
- - git config --global user.email "you@example.com"
47
- - git config --global user.name "Your Name"
48
- script:
49
- - bundle exec rake test:features
50
-
51
- bdd ruby3.0:
52
- image: ruby:3.0
53
- script:
54
- - bundle exec rake test:features
55
-
56
- bdd ruby3.1:
57
- image: ruby:3.1
58
- script:
59
- - bundle exec rake test:features
60
-
61
35
  bdd ruby3.2:
62
36
  image: ruby:3.2
63
37
  script:
64
38
  - bundle exec rake test:features
65
39
 
66
- unit tests ruby2.7:
67
- image: ruby:2.7
68
- before_script:
69
- - apt-get update
70
- - ruby -v
71
- - which ruby
72
- - gem install bundler -v 2.4.22 --no-document
73
- - bundle install --jobs $(nproc) "${FLAGS[@]}"
74
- script:
75
- - bundle exec rake test:spec
76
-
77
- unit tests ruby3.0:
78
- image: ruby:3.0
40
+ bdd ruby3.3:
41
+ image: ruby:3.3
79
42
  script:
80
- - bundle exec rake test:spec
43
+ - bundle exec rake test:features
81
44
 
82
- unit tests ruby3.1:
83
- image: ruby:3.1
45
+ unit tests ruby3.2:
46
+ image: ruby:3.2
84
47
  script:
85
48
  - bundle exec rake test:spec
86
49
 
87
- unit tests ruby3.2:
50
+ unit tests ruby3.3:
88
51
  image: ruby:3.2
89
52
  script:
90
53
  - bundle exec rake test:spec
data/Gemfile CHANGED
@@ -7,80 +7,52 @@ gemspec
7
7
 
8
8
  ruby RUBY_VERSION
9
9
 
10
- # rubocop:disable Metrics/BlockLength
11
10
  group :development do
12
11
  # cucumber steps for command line tests
13
- gem 'aruba', '~> 2'
12
+ gem 'aruba', '~> 2.3'
14
13
  # bdd
15
- gem 'cucumber', '~> 9'
16
-
14
+ gem 'cucumber', '~> 10.0'
17
15
  # code duplication
18
- gem 'flay', '~> 2'
19
-
16
+ gem 'flay', '~> 2.13'
20
17
  # automatic test run
21
- gem 'guard', '~> 2'
18
+ gem 'guard', '~> 2.19'
22
19
  # automatic update invocation
23
- gem 'guard-bundler', '~> 3'
24
- if RUBY_VERSION >= '3.0'
25
- # automatic style check
26
- gem 'guard-reek', '~> 1.2'
27
- end
20
+ gem 'guard-bundler', '~> 3.0'
21
+ # automatic style check
22
+ gem 'guard-reek', '~> 1.2'
28
23
  # automatic tdd
29
- gem 'guard-rspec', '~> 4'
24
+ gem 'guard-rspec', '~> 4.7'
30
25
  # automatic style check
31
- gem 'guard-rubocop', '~> 1'
32
-
33
- if RUBY_VERSION >= '3.0'
34
- # mutation testing
35
- plan = 'oss'
36
- key = '7oac4dMz95cTUuFPtGDfTDSQep6ZhdGW'
37
- source "https://#{plan}:#{key}@gem.mutant.dev" do
38
- # license needed
39
- gem 'mutant-license', '~> 0'
40
- end
41
- # mutation testing
42
- gem 'mutant-rspec', '~> 0'
43
- end
26
+ gem 'guard-rubocop', '~> 1.5'
27
+ # mutation testing
28
+ gem 'mutant-rspec', '~> 0.13'
44
29
  # to parse and execute Rakefile
45
- gem 'rake', '~> 13'
46
-
47
- if RUBY_VERSION >= '3.0'
48
- # needed by yard to render documentation
49
- gem 'rdoc', '~> 6'
50
- end
30
+ gem 'rake', '~> 13.3'
31
+ # detect selling code
32
+ gem 'reek', '~> 6.5'
33
+ # needed by yard to render documentation
34
+ gem 'rdoc', '~> 6.14'
51
35
  # tdd
52
- gem 'rspec', '~> 3'
53
- # # to test performances
54
- # gem 'rspec-benchmark', '~> 0'
36
+ gem 'rspec', '~> 3.13'
55
37
  # code needs to be clean
56
- gem 'rubocop', '1.68'
38
+ gem 'rubocop', '~> 1.77'
57
39
  # code needs to be clean
58
- gem 'rubocop-performance', '~> 1'
40
+ gem 'rubocop-performance', '~> 1.25'
59
41
  # test code needs to be clean
60
- gem 'rubocop-rspec', '~> 3'
42
+ gem 'rubocop-rspec', '~> 3.6'
61
43
  # Rakefiles need to be clean
62
- gem 'rubocop-rake', '~> 0'
63
-
64
- if RUBY_VERSION >= '3.0'
65
- # detect selling code
66
- gem 'reek', '~> 6'
67
- # my code needs to be critiqued
68
- gem 'rubycritic', '~> 4'
69
- # Doc need to be clean
70
- gem 'rubocop-yard', '~> 0'
71
- end
72
-
44
+ gem 'rubocop-rake', '~> 0.7'
45
+ # Doc need to be clean
46
+ gem 'rubocop-yard', '~> 0.10'
47
+ # my code needs to be critiqued
48
+ gem 'rubycritic', '~> 4.9'
73
49
  # What is tdd without code coverage ?
74
- gem 'simplecov', '~> 0'
75
-
76
- if RUBY_VERSION >= '3.0'
77
- # to document code
78
- gem 'yard', '~> 0'
79
- end
50
+ gem 'simplecov', '~> 0.22'
51
+ # to document code
52
+ gem 'yard', '~> 0.9'
80
53
  end
81
- # rubocop:enable Metrics/BlockLength
82
54
 
83
55
  group :debugging do
84
56
  # Sometimes, we need to debug
85
- gem 'pry', '~> 0'
57
+ gem 'pry', '~> 0.15'
86
58
  end
data/bin/defmastership CHANGED
@@ -2,114 +2,6 @@
2
2
  # Copyright (c) 2020 Jerome Arbez-Gindre
3
3
  # frozen_string_literal: true
4
4
 
5
- require('csv')
6
- require('defmastership')
7
- require('gli')
8
-
9
- module Defmastership
10
- # The start of everything !
11
- class App
12
- extend GLI::App
13
-
14
- program_desc 'Tool to handle Asciidoctor definition extension'
15
-
16
- version Defmastership::VERSION
17
-
18
- subcommand_option_handling :normal
19
- arguments :strict
20
-
21
- # desc 'Describe some switch here'
22
- # switch [:s,:switch]
23
-
24
- # desc 'Describe some flag here'
25
- # default_value 'the default'
26
- # arg_name 'The name of the argument'
27
- # flag [:f,:flagname]
28
-
29
- pre do |_global, _command, _options, _args|
30
- # Pre logic here
31
- # Return true to proceed; false to abort and not call the
32
- # chosen command
33
- # Use skips_pre before a command to skip this block
34
- # on that command only
35
- true
36
- end
37
-
38
- post do |_global, _command, _options, _args|
39
- # Post logic here
40
- # Use skips_post before a command to skip this
41
- # block on that command only
42
- end
43
-
44
- on_error do |_exception|
45
- # Error logic here
46
- # return false to skip default error handling
47
- true
48
- end
49
-
50
- desc 'Export the definition database in CSV'
51
- arg_name 'asciidoctor_files'
52
- command :export, :exp, :e do |c|
53
- c.flag(%i[separator sep s], default_value: ',', desc: 'CSV separator')
54
- c.switch(%i[no-fail], desc: 'Exit succes even in case of wrong explicit checksum')
55
-
56
- c.action do |_global_options, options, args|
57
- my_doc = Defmastership::Document.new
58
- my_doc.parse_file_with_preprocessor(args.first)
59
-
60
- output_file = args.first.sub(/\.adoc$/, '.csv')
61
-
62
- Defmastership::Export::CSV::Formatter.new(my_doc, options['separator']).export_to(output_file)
63
-
64
- if my_doc.wrong_explicit_checksum?
65
- my_doc.definitions.each do |definition|
66
- next if definition.wrong_explicit_checksum.nil?
67
-
68
- warn(
69
- "warning: #{definition.reference} has a wrong explicit " \
70
- "checksum (should be #{definition.sha256_short})"
71
- )
72
- end
73
- exit 1 unless options[:'no-fail']
74
- end
75
- end
76
- end
77
-
78
- desc 'Apply one or more modifications'
79
- arg_name 'asciidoctor_files'
80
- command :modify, :mod, :m do |c|
81
- c.flag(
82
- %i[modifications mod m],
83
- must_match: /(?:[\w-]+)(?:,[\w-]+)*/,
84
- default_value: 'all',
85
- desc: 'comma separated list of modifications to apply'
86
- )
87
- c.flag(%i[modifications-file mf], default_value: 'modifications.yml', desc: 'modifications description file')
88
- c.flag(%i[changes-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
89
-
90
- c.action do |_global_options, options, args|
91
- changer = BatchModifier.new(
92
- YAML.load_file(options[:'modifications-file']),
93
- args.to_h { |afile| [afile, File.read(afile)] }
94
- )
95
-
96
- changer.apply(options[:modifications].split(/\s*,\s*/).map(&:to_sym))
97
-
98
- changer.adoc_sources.each do |adoc_filename, adoc_text|
99
- File.write(adoc_filename, adoc_text)
100
- end
101
-
102
- File.write(options[:'modifications-file'], changer.config.to_yaml)
103
-
104
- unless options['changes-summary'].nil?
105
- CSV.open(options['changes-summary'], 'wb') do |csv|
106
- csv << %w[Modifier Was Becomes]
107
- changer.changes.each { |row| csv << row }
108
- end
109
- end
110
- end
111
- end
112
- end
113
- end
5
+ require('defmastership/app')
114
6
 
115
7
  exit(Defmastership::App.run(ARGV))
data/config/mutant.yml CHANGED
@@ -1,32 +1,37 @@
1
1
  ---
2
2
  usage: opensource
3
+ # fail_fast: true
3
4
  includes:
4
- - lib
5
+ - lib
5
6
  integration:
6
7
  name: rspec
7
8
  arguments:
8
- - --options=config/rspec
9
- - spec
9
+ - --options=config/rspec
10
+ - spec
10
11
  requires:
11
- - defmastership
12
+ - defmastership/batch_modifier
13
+ - defmastership/comment_filter
14
+ - defmastership/config_preserver
15
+ - defmastership/definition_parser
16
+ - defmastership/definition
17
+ - defmastership/document
18
+ - defmastership/export/body_formatter
19
+ - defmastership/export/csv/formatter
20
+ - defmastership/export/header_formatter
21
+ - defmastership/filters
22
+ - defmastership/hash_merge_no_new
23
+ - defmastership/matching_line
24
+ - defmastership/modifier/change_ref
25
+ - defmastership/modifier/factory
26
+ - defmastership/modifier/modifier_common
27
+ - defmastership/modifier/rename_included_files
28
+ - defmastership/modifier/update_def_checksum
29
+ - defmastership/modifier/update_def
30
+ - defmastership/modifier/update_def_version
31
+ mutation:
32
+ operators: full
12
33
  matcher:
13
34
  subjects:
14
- - Defmastership*
35
+ - Defmastership*
15
36
  ignore:
16
- - Defmastership::Core*
17
- # - Defmastership::BatchModifier*
18
- # - Defmastership::Export::CSV::Formatter*
19
- # - Defmastership::Export::CSV::BodyFormatter*
20
- # - Defmastership::Export::CSV::HeaderFormatter*
21
- # - Defmastership::Modifier::ChangeRef*
22
- # - Defmastership::Definition*
23
- # - Defmastership::DefinitionParser*
24
- # - Defmastership::Document*
25
- # - Defmastership::Factory*
26
- # - Defmastership::Modifier::ModifierCommon*
27
- # - Defmastership::Modifier::Factory*
28
- # - Defmastership::Modifier::RenameIncludedFiles*
29
- # - Defmastership::Modifier::UpdateDefChecksum*
30
- # - Defmastership::Modifier::UpdateDef*
31
- # - Defmastership::Modifier::UpdateDefVersion*
32
- # fail_fast: true
37
+ - Defmastership::Core*
data/config/rubocop.yml CHANGED
@@ -9,14 +9,16 @@
9
9
  #
10
10
  # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
11
11
 
12
- require:
12
+ plugins:
13
13
  - rubocop-performance
14
14
  - rubocop-rspec
15
15
  - rubocop-rake
16
+
17
+ require:
16
18
  - rubocop-yard
17
19
 
18
20
  AllCops:
19
- TargetRubyVersion: 2.7
21
+ TargetRubyVersion: 3.0
20
22
  EnabledByDefault: true
21
23
  DisplayCopNames: true
22
24
 
@@ -35,6 +37,7 @@ Style/StringHashKeys :
35
37
  Enabled: true
36
38
  Exclude:
37
39
  - '*.gemspec'
40
+ - 'spec/unit/defmastership/app_spec.rb'
38
41
  - 'spec/unit/defmastership/batch_modifier_spec.rb'
39
42
  - 'spec/unit/defmastership/modifier/update_def_checksum_spec.rb'
40
43
  - 'spec/unit/defmastership/modifier/update_def_spec.rb'
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.metadata = {
19
19
  'rubygems_mfa_required' => 'true'
20
20
  }
21
- spec.required_ruby_version = '>= 2.7'
21
+ spec.required_ruby_version = '>= 3.0'
22
22
  spec.name = 'defmastership'
23
23
  spec.version = Defmastership::VERSION
24
24
  spec.author = 'Jérôme Arbez-Gindre'
@@ -31,11 +31,12 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths << 'lib'
32
32
  spec.bindir = 'bin'
33
33
  spec.executables << 'defmastership'
34
- spec.add_dependency('aasm', '~> 5')
35
- spec.add_dependency('asciidoctor', '~> 2')
36
- spec.add_dependency('csv', '~> 3')
37
- spec.add_dependency('defmastership-core', '~> 1.4')
38
- spec.add_dependency('git', '~> 1')
39
- spec.add_dependency('gli', '~> 2')
40
- spec.add_dependency('ostruct', '~> 0')
34
+ spec.add_dependency('aasm', '~> 5.5')
35
+ spec.add_dependency('asciidoctor', '~> 2.0')
36
+ spec.add_dependency('csv', '~> 3.3')
37
+ spec.add_dependency('defmastership-core', '~> 1.5')
38
+ spec.add_dependency('facets', '~> 3.1')
39
+ spec.add_dependency('git', '~> 3.1')
40
+ spec.add_dependency('gli', '~> 2.22')
41
+ spec.add_dependency('ostruct', '~> 0.6')
41
42
  end
@@ -3,7 +3,7 @@ Feature: The changeref command
3
3
  In order to make references reliable
4
4
  I want defmastership to change reference for asciidoctor documents
5
5
 
6
- Scenario: Change a definition
6
+ Scenario: Change a definition
7
7
  Given a file named "modifications.yml" with:
8
8
  """
9
9
  ---
@@ -35,6 +35,39 @@ Feature: The changeref command
35
35
  [define, requirement, TOTO-0123]
36
36
  """
37
37
 
38
+ Scenario: Preserve modification file
39
+ Given a file named "modifications.yml" with:
40
+ """
41
+ ---
42
+ # the name of the modification
43
+ :toto:
44
+ :type: change_ref
45
+
46
+ :config:
47
+ :from_regexp: TOTO-TEMP-[X\d]{4}
48
+ :to_template: TOTO-%<next_ref>04d
49
+ # the next ref
50
+ :next_ref: 123 # will be incremented once this value is used
51
+ """
52
+ And a file named "thedoc.adoc" with:
53
+ """
54
+ [define, requirement, TOTO-TEMP-XXX1]
55
+ """
56
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
57
+ And the file "modifications.yml" should contain exactly:
58
+ """
59
+ ---
60
+ # the name of the modification
61
+ :toto:
62
+ :type: change_ref
63
+
64
+ :config:
65
+ :from_regexp: TOTO-TEMP-[X\d]{4}
66
+ :to_template: TOTO-%<next_ref>04d
67
+ # the next ref
68
+ :next_ref: 124 # will be incremented once this value is used
69
+ """
70
+
38
71
  Scenario: Change a definition with explicit checksum and version
39
72
  Given a file named "modifications.yml" with:
40
73
  """
@@ -237,6 +270,84 @@ Feature: The changeref command
237
270
  defs:iref[TOTO-0123]
238
271
  """
239
272
 
273
+ Scenario Outline: Change definitions, modify tags in include statements
274
+ Given a file named "modifications.yml" with:
275
+ """
276
+ ---
277
+ :toto:
278
+ :type: change_ref
279
+ :config:
280
+ :from_regexp: TOTO-TEMP-[X\d]{4}
281
+ :to_template: TOTO-%<next_ref>04d
282
+ :next_ref: 123
283
+ """
284
+ And a file named "thedoc.adoc" with:
285
+ """
286
+ [define, requirement, TOTO-TEMP-XXX1]
287
+ --
288
+ include::target[<initial options>]
289
+ --
290
+ """
291
+ And an empty file named "target"
292
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
293
+ Then the stdout should not contain anything
294
+ And the file "thedoc.adoc" should contain:
295
+ """
296
+ [define, requirement, TOTO-0123]
297
+ --
298
+ include::target[<modified options>]
299
+ --
300
+ """
301
+
302
+ Examples:
303
+ | initial options | modified options |
304
+ | tags=TOTO-TEMP-XXX1 | tags=TOTO-0123 |
305
+ | tag=TOTO-TEMP-XXX1 | tag=TOTO-0123 |
306
+ | tag=!TOTO-TEMP-XXX1 | tag=!TOTO-0123 |
307
+ | lines = "1..7,9", tag=TOTO-TEMP-XXX1, leveloffset=1 | lines = "1..7,9", tag=TOTO-0123, leveloffset=1 |
308
+ | lines=1..7;9, tag=TOTO-TEMP-XXX1 | lines=1..7;9, tag=TOTO-0123 |
309
+ | tag=!TOTO-TEMP-XXX2;TOTO-TEMP-XXX1 | tag=!TOTO-TEMP-XXX2;TOTO-0123 |
310
+
311
+ Scenario Outline: Change definitions, modify tags in included files
312
+ Given a file named "modifications.yml" with:
313
+ """
314
+ ---
315
+ :toto:
316
+ :type: change_ref
317
+ :config:
318
+ :from_regexp: TOTO-TEMP-[X\d]{4}
319
+ :to_template: TOTO-%<next_ref>04d
320
+ :next_ref: 123
321
+ """
322
+ And a file named "thedoc.adoc" with:
323
+ """
324
+ [define, requirement, TOTO-TEMP-XXX1]
325
+ --
326
+ include::target[TOTO-TEMP-XXX1 ]
327
+ --
328
+ """
329
+ And a file named "target" with:
330
+ """
331
+ <initial target comment>
332
+ """
333
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
334
+ Then the stdout should not contain anything
335
+ And the file named "target" should contain:
336
+ """
337
+ <modified target comment>
338
+ """
339
+
340
+ Examples:
341
+ | initial target comment | modified target comment |
342
+ | # tag::TOTO-TEMP-XXX1[] | # tag::TOTO-0123[] |
343
+ | # tags::TOTO-TEMP-XXX1[] | # tags::TOTO-TEMP-XXX1[] |
344
+ | # tag::TOTO-TEMP-XXX1 | # tag::TOTO-TEMP-XXX1 |
345
+ | # end::TOTO-TEMP-XXX1[] | # end::TOTO-0123[] |
346
+ | # tag::TOTO-TEMP-XXX2[] | # tag::TOTO-TEMP-XXX2[] |
347
+ | ; end::TOTO-TEMP-XXX1[] | ; end::TOTO-0123[] |
348
+ | // tag::TOTO-TEMP-XXX1[] Whatever | // tag::TOTO-0123[] Whatever |
349
+ | /* end::TOTO-TEMP-XXX1[] */ | /* end::TOTO-0123[] */ |
350
+
240
351
  Scenario: Do not change definitions when in literal
241
352
  Given a file named "modifications.yml" with:
242
353
  """
@@ -181,6 +181,46 @@ Feature: definitions version
181
181
  --
182
182
  """
183
183
 
184
+ Scenario: Preserve modification file
185
+ Given I initialize a git repo
186
+ And a file named "thedoc.adoc" with:
187
+ """
188
+ [define, requirement, TOTO-0001]
189
+ --
190
+ initial text.
191
+ --
192
+ """
193
+ And I add and commit the "thedoc.adoc" file
194
+ And I set the "THE_TAG" tag
195
+ And a file named "thedoc.adoc" with:
196
+ """
197
+ [define, requirement, TOTO-0001(whatever)]
198
+ --
199
+ modified text.
200
+ --
201
+ """
202
+ And a file named "modifications.yml" with:
203
+ """
204
+ ---
205
+ :update_requirement_version:
206
+ :type: update_def_version
207
+ :config:
208
+ :def_type: requirement
209
+ :first_version: a
210
+ :ref_tag: THE_TAG
211
+ """
212
+ When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
213
+ Then the file "modifications.yml" should contain exactly:
214
+ """
215
+ ---
216
+ :update_requirement_version:
217
+ :type: update_def_version
218
+ :config:
219
+ :def_type: requirement
220
+ :first_version: a
221
+ :ref_tag: THE_TAG
222
+ """
223
+
184
224
  Scenario: Update explicit version based on git tag on a different git repo
185
225
  And a file named "defmastership-example.adoc" with:
186
226
  """
@@ -243,7 +283,7 @@ Feature: definitions version
243
283
  :def_type: requirement
244
284
  :first_version: a
245
285
  :ref_document: ./ref_doc.adoc
246
- :ref_tag: 'THE_TAG'
286
+ :ref_tag: THE_TAG
247
287
  """
248
288
  When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
249
289
  And the stdout should not contain anything
@@ -1,7 +1,7 @@
1
1
  # Copyright (c) 2024 Jerome Arbez-Gindre
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'git'
4
+ require('git')
5
5
 
6
6
  Given('I initialize a git repo') do
7
7
  Git.init(Aruba.config.home_directory)