defmastership 1.0.5 → 1.0.10

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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/bin/defmastership +33 -22
  4. data/cucumber.yml +1 -1
  5. data/defmastership.gemspec +12 -6
  6. data/features/changeref.feature +82 -129
  7. data/features/definition_checksum.feature +298 -0
  8. data/features/definition_version.feature +204 -0
  9. data/features/export.feature +35 -34
  10. data/features/modify.feature +165 -0
  11. data/features/rename_included_files.feature +121 -0
  12. data/lib/defmastership.rb +17 -3
  13. data/lib/defmastership/batch_modifier.rb +35 -0
  14. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +18 -35
  15. data/lib/defmastership/change_ref_modifier.rb +15 -0
  16. data/lib/defmastership/constants.rb +14 -1
  17. data/lib/defmastership/csv_formatter.rb +22 -17
  18. data/lib/defmastership/csv_formatter_body.rb +19 -11
  19. data/lib/defmastership/csv_formatter_header.rb +15 -10
  20. data/lib/defmastership/definition.rb +14 -3
  21. data/lib/defmastership/definition_parser.rb +46 -0
  22. data/lib/defmastership/document.rb +59 -85
  23. data/lib/defmastership/filters.rb +30 -0
  24. data/lib/defmastership/line_modifier_base.rb +29 -0
  25. data/lib/defmastership/modifier_base.rb +29 -0
  26. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  27. data/lib/defmastership/rename_included_files_modifier.rb +15 -0
  28. data/lib/defmastership/update_def_checksum_line_modifier.rb +38 -0
  29. data/lib/defmastership/update_def_checksum_modifier.rb +21 -0
  30. data/lib/defmastership/update_def_version_line_modifier.rb +58 -0
  31. data/lib/defmastership/update_def_version_modifier.rb +25 -0
  32. data/lib/defmastership/version.rb +1 -1
  33. data/spec/spec_helper.rb +1 -0
  34. data/spec/unit/defmastership/batch_modifier_spec.rb +123 -0
  35. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +48 -26
  36. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  37. data/spec/unit/defmastership/comment_filter_spec.rb +8 -4
  38. data/spec/unit/defmastership/csv_formatter_body_spec.rb +88 -82
  39. data/spec/unit/defmastership/csv_formatter_header_spec.rb +68 -22
  40. data/spec/unit/defmastership/csv_formatter_spec.rb +207 -109
  41. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  42. data/spec/unit/defmastership/definition_spec.rb +45 -4
  43. data/spec/unit/defmastership/document_spec.rb +236 -35
  44. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  45. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  46. data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +78 -0
  47. data/spec/unit/defmastership/update_def_checksum_modifier_spec.rb +75 -0
  48. data/spec/unit/defmastership/update_def_version_line_modifier_spec.rb +127 -0
  49. data/spec/unit/defmastership/update_def_version_modifier_spec.rb +80 -0
  50. metadata +44 -9
  51. data/lib/defmastership/batch_changer.rb +0 -41
  52. data/lib/defmastership/project_ref_changer.rb +0 -28
  53. data/spec/unit/defmastership/batch_changer_spec.rb +0 -109
  54. data/spec/unit/defmastership/project_ref_changer_spec.rb +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a306f9f76179edc5687278ed6a5c1c1c2b3943ad01cd3925cdcb7d7e1466ac2
4
- data.tar.gz: dc3afb4b34d6e64e41ff0207242518317e3fe7615474ec17ca87f378436014df
3
+ metadata.gz: '0498ff0b39ccfc024d4988c4c1137726e827e841a1750b921bc4c8d3be06db62'
4
+ data.tar.gz: af1b86530d440a08417bac712f15e30db40aa01b07ea312b1d7d4f125dccef5c
5
5
  SHA512:
6
- metadata.gz: 6434c67db6ccf69c1f837b0ac664512d06563ded9d22faf9a890585ae3e2c3b072d10740fbaba91a23075244a21101801e1366e41ef2fe348c070dfb3467f92f
7
- data.tar.gz: 6c511e6138122b454a69a0a2ba27c51abb28b55d09ce0b0a39652a91927f4cd29f2ea015407ff7f4d9f9c9e9eee297e5f43955528fccd1a07fc7caaee48c2a0e
6
+ metadata.gz: ec47e5182f9586be6102eed5be90c459db84e54e334cbe867bee2be4bf34645f8a91d7e08aea0b89a4733e3ca6089c90f96e1a6969d8f6b329034cc4486bd8b2
7
+ data.tar.gz: 625fb3fb76aaac4189ce12cd2f9af3bfa83491a2ecbbe5192bb35ffe43e121e54a27a318afb60ad938a8e58818bccef38896b919d5b9678ea0af4565c09aab66
data/.rubocop.yml CHANGED
@@ -19,7 +19,7 @@ AllCops:
19
19
 
20
20
  Style/Copyright:
21
21
  Enabled: true
22
- Notice: 'Copyright (\(c\) )?2020 Jerome Arbez-Gindre'
22
+ Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
23
23
  AutocorrectNotice: '# Copyright (c) 2020 Jerome Arbez-Gindre'
24
24
 
25
25
  Lint/ConstantResolution: # Not available ins rubocop 0.81
data/bin/defmastership CHANGED
@@ -2,7 +2,6 @@
2
2
  # Copyright (c) 2020 Jerome Arbez-Gindre
3
3
  # frozen_string_literal: true
4
4
 
5
- require('asciidoctor')
6
5
  require('csv')
7
6
  require('defmastership')
8
7
  require('gli')
@@ -50,47 +49,59 @@ module DefMastership
50
49
 
51
50
  desc 'Export the definition database in CSV'
52
51
  arg_name 'asciidoctor_files'
53
- command :export do |c|
52
+ command :export, :exp, :e do |c|
54
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
+
55
56
  c.action do |_global_options, options, args|
56
- doc = Asciidoctor.load_file(args[0], safe: :unsafe, parse: false)
57
- # FIXME: also escape ifdef, ifndef, ifeval and endif directives
58
- # FIXME: do this more carefully by reading line by line; if input
59
- # differs by output by leading backslash, restore original line
60
- lines = doc.reader.read_lines
61
57
  my_doc = DefMastership::Document.new
62
- my_doc.parse(lines)
58
+ my_doc.parse_file_with_preprocessor(args[0])
63
59
 
64
60
  output_file = args[0].sub(/\.adoc$/, '.csv')
65
61
 
66
62
  DefMastership::CSVFormatter.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("warning: #{definition.reference} has a wrong explicit checksum (should be #{definition.sha256})")
69
+ end
70
+ exit 1 unless options[:"no-fail"]
71
+ end
67
72
  end
68
73
  end
69
74
 
70
- desc 'Change temp references to definitive references'
75
+ desc 'Apply one or more modifications'
71
76
  arg_name 'asciidoctor_files'
72
- command :changeref do |c|
73
- c.flag(%i[change-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
74
-
75
- c.flag(%i[change-file f], default_value: 'changeref.yaml', desc: 'set the change specification file')
77
+ command :modify, :mod, :m do |c|
78
+ c.flag(
79
+ %i[modifications mod m],
80
+ must_match: /(?:[\w-]+)(?:,[\w-]+)*/,
81
+ default_value: 'all',
82
+ desc: 'comma separated list of modifications to apply'
83
+ )
84
+ c.flag(%i[modifications-file mf], default_value: 'modifications.yml', desc: 'modifications description file')
85
+ c.flag(%i[changes-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
76
86
 
77
87
  c.action do |_global_options, options, args|
78
- ref_changer = ProjectRefChanger.new(
79
- YAML.load_file(options['change-file']),
88
+ changer = BatchModifier.new(
89
+ YAML.load_file(options[:'modifications-file']),
80
90
  args.map { |afile| [afile, File.open(afile).read] }.to_h
81
91
  )
82
92
 
83
- ref_changer.replace_all
93
+ changer.apply(options[:modifications])
84
94
 
85
- ref_changer.adoc_texts.each do |adoc_file, adoc_text|
95
+ changer.adoc_texts.each do |adoc_file, adoc_text|
86
96
  File.open(adoc_file, 'w') { |f| f.write(adoc_text) }
87
97
  end
88
- File.open(options['change-file'], 'w') { |f| f.write(ref_changer.yaml_config) }
89
98
 
90
- unless options['change-summary'].nil?
91
- CSV.open(options['change-summary'], 'wb') do |csv|
92
- csv << %w[Was Becomes]
93
- ref_changer.changes.each { |row| csv << row }
99
+ File.open(options[:'modifications-file'], 'w') { |f| f.write(changer.config.to_yaml) }
100
+
101
+ unless options['changes-summary'].nil?
102
+ CSV.open(options['changes-summary'], 'wb') do |csv|
103
+ csv << %w[Modifier Was Becomes]
104
+ changer.changes.each { |row| csv << row }
94
105
  end
95
106
  end
96
107
  end
data/cucumber.yml CHANGED
@@ -1,2 +1,2 @@
1
1
  ---
2
- default: --publish
2
+ default: --publish --format pretty
@@ -3,12 +3,17 @@
3
3
 
4
4
  # Ensure we require the local version and not one we might have
5
5
  # installed already
6
- require(File.join([
7
- File.dirname(__FILE__),
8
- 'lib',
9
- 'defmastership',
10
- 'version.rb'
11
- ]))
6
+ require(
7
+ File.join(
8
+ [
9
+ File.dirname(__FILE__),
10
+ 'lib',
11
+ 'defmastership',
12
+ 'version.rb'
13
+ ]
14
+ )
15
+ )
16
+
12
17
  Gem::Specification.new do |s|
13
18
  s.required_ruby_version = '>= 2.5'
14
19
  s.name = 'defmastership'
@@ -30,6 +35,7 @@ Gem::Specification.new do |s|
30
35
  s.add_development_dependency('rdoc', '~> 6')
31
36
  s.add_development_dependency('rspec', '~> 3')
32
37
  s.add_development_dependency('rubocop', '~> 1.3')
38
+ s.add_development_dependency('rubocop-rake', '~> 0.5')
33
39
  s.add_development_dependency('rubocop-rspec', '~> 2.0')
34
40
  s.add_development_dependency('simplecov', '~> 0')
35
41
  s.add_runtime_dependency('aasm', '~> 5')
@@ -4,57 +4,32 @@ Feature: The changeref command
4
4
  I want defmastership to change reference for asciidoctor documents
5
5
 
6
6
  Scenario: Change a definition
7
- Given a file named "changeref.yaml" with:
7
+ Given a file named "modifications.yml" with:
8
8
  """
9
9
  ---
10
10
  :toto:
11
- :from_regexp: TOTO-TEMP-[X\d]{4}
12
- :to_template: TOTO-%<next_ref>04d
13
- :next_ref: 123
11
+ :type: change_ref
12
+ :config:
13
+ :from_regexp: TOTO-TEMP-[X\d]{4}
14
+ :to_template: TOTO-%<next_ref>04d
15
+ :next_ref: 123
14
16
  """
15
17
  And a file named "thedoc.adoc" with:
16
18
  """
17
19
  [define, requirement, TOTO-TEMP-XXX1]
18
20
  """
19
- When I run `defmastership changeref thedoc.adoc`
21
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
20
22
  Then the stdout should not contain anything
21
23
  And the stderr should not contain anything
22
- And the file "changeref.yaml" should contain:
24
+ And the file "modifications.yml" should contain:
23
25
  """
24
26
  ---
25
27
  :toto:
26
- :from_regexp: TOTO-TEMP-[X\d]{4}
27
- :to_template: TOTO-%<next_ref>04d
28
- :next_ref: 124
29
- """
30
- And the file "thedoc.adoc" should contain:
31
- """
32
- [define, requirement, TOTO-0123]
33
- """
34
-
35
- Scenario: Change a definition with yaml file parameter
36
- Given a file named "pouet.yaml" with:
37
- """
38
- ---
39
- :toto:
40
- :from_regexp: TOTO-TEMP-[X\d]{4}
41
- :to_template: TOTO-%<next_ref>04d
42
- :next_ref: 123
43
- """
44
- And a file named "thedoc.adoc" with:
45
- """
46
- [define, requirement, TOTO-TEMP-XXX1]
47
- """
48
- When I run `defmastership changeref --change-file=pouet.yaml thedoc.adoc`
49
- Then the stdout should not contain anything
50
- And the stderr should not contain anything
51
- And the file "pouet.yaml" should contain:
52
- """
53
- ---
54
- :toto:
55
- :from_regexp: TOTO-TEMP-[X\d]{4}
56
- :to_template: TOTO-%<next_ref>04d
57
- :next_ref: 124
28
+ :type: change_ref
29
+ :config:
30
+ :from_regexp: TOTO-TEMP-[X\d]{4}
31
+ :to_template: TOTO-%<next_ref>04d
32
+ :next_ref: 124
58
33
  """
59
34
  And the file "thedoc.adoc" should contain:
60
35
  """
@@ -62,29 +37,33 @@ Feature: The changeref command
62
37
  """
63
38
 
64
39
  Scenario: Change two definitions
65
- Given a file named "changeref.yaml" with:
40
+ Given a file named "modifications.yml" with:
66
41
  """
67
42
  ---
68
43
  :toto:
69
- :from_regexp: TOTO-TEMP-[X\d]{4}
70
- :to_template: TOTO-%<next_ref>04d
71
- :next_ref: 123
44
+ :type: change_ref
45
+ :config:
46
+ :from_regexp: TOTO-TEMP-[X\d]{4}
47
+ :to_template: TOTO-%<next_ref>04d
48
+ :next_ref: 123
72
49
  """
73
50
  And a file named "thedoc.adoc" with:
74
51
  """
75
52
  [define, requirement, TOTO-TEMP-XXX1]
76
53
  [define, requirement, TOTO-TEMP-XXX2]
77
54
  """
78
- When I run `defmastership changeref thedoc.adoc`
55
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
79
56
  Then the stdout should not contain anything
80
57
  And the stderr should not contain anything
81
- And the file "changeref.yaml" should contain:
58
+ And the file "modifications.yml" should contain:
82
59
  """
83
60
  ---
84
61
  :toto:
85
- :from_regexp: TOTO-TEMP-[X\d]{4}
86
- :to_template: TOTO-%<next_ref>04d
87
- :next_ref: 125
62
+ :type: change_ref
63
+ :config:
64
+ :from_regexp: TOTO-TEMP-[X\d]{4}
65
+ :to_template: TOTO-%<next_ref>04d
66
+ :next_ref: 125
88
67
  """
89
68
  And the file "thedoc.adoc" should contain:
90
69
  """
@@ -92,77 +71,51 @@ Feature: The changeref command
92
71
  [define, requirement, TOTO-0124]
93
72
  """
94
73
 
95
- Scenario: Generate a table with changess
96
- Given a file named "changeref.yaml" with:
74
+ Scenario: Change definitions with variable from regexp
75
+ Given a file named "modifications.yml" with:
97
76
  """
98
77
  ---
99
- :toto:
100
- :from_regexp: TOTO-TEMP-[X\d]{4}
101
- :to_template: TOTO-%<next_ref>04d
102
- :next_ref: 123
103
- """
104
- And a file named "thedoc.adoc" with:
105
- """
106
- [define, requirement, TOTO-TEMP-XXX1]
107
- [define, requirement, TOTO-TEMP-XXX2]
108
- """
109
- When I run `defmastership changeref --change-summary=changes.csv thedoc.adoc`
110
- Then the stderr should not contain anything
111
- And the stdout should not contain anything
112
- And the file "changes.csv" should contain:
113
- """
114
- Was,Becomes
115
- TOTO-TEMP-XXX1,TOTO-0123
116
- TOTO-TEMP-XXX2,TOTO-0124
117
- """
118
-
119
- Scenario: Change two definitions with two schema
120
- Given a file named "changeref.yaml" with:
121
- """
122
- ---
123
- :toto:
124
- :from_regexp: TOTO-TEMP-[X\d]{4}
125
- :to_template: TOTO-%<next_ref>04d
126
- :next_ref: 123
127
78
  :tata_or_titi:
128
- :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
129
- :to_template: "%<tata_or_titi>s-%<next_ref>07d"
130
- :next_ref: 432
79
+ :type: change_ref
80
+ :config:
81
+ :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
82
+ :to_template: "%<tata_or_titi>s-%<next_ref>07d"
83
+ :next_ref: 432
131
84
  """
132
85
  And a file named "thedoc.adoc" with:
133
86
  """
134
- [define, requirement, TOTO-TEMP-XXX1]
135
87
  [define, requirement, TITI-TEMP-XXX2]
88
+ [define, requirement, TATA-TEMP-X2X3]
136
89
  """
137
- When I run `defmastership changeref thedoc.adoc`
90
+ When I successfully run `defmastership modify --modifications tata_or_titi thedoc.adoc`
138
91
  Then the stdout should not contain anything
139
92
  And the stderr should not contain anything
140
- And the file "changeref.yaml" should contain:
93
+ And the file "modifications.yml" should contain:
141
94
  """
142
95
  ---
143
- :toto:
144
- :from_regexp: TOTO-TEMP-[X\d]{4}
145
- :to_template: TOTO-%<next_ref>04d
146
- :next_ref: 124
147
96
  :tata_or_titi:
148
- :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
149
- :to_template: "%<tata_or_titi>s-%<next_ref>07d"
150
- :next_ref: 433
97
+ :type: change_ref
98
+ :config:
99
+ :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
100
+ :to_template: "%<tata_or_titi>s-%<next_ref>07d"
101
+ :next_ref: 434
151
102
  """
152
103
  And the file "thedoc.adoc" should contain:
153
104
  """
154
- [define, requirement, TOTO-0123]
155
105
  [define, requirement, TITI-0000432]
106
+ [define, requirement, TATA-0000433]
156
107
  """
157
108
 
158
109
  Scenario: Change definitions in two files
159
- Given a file named "changeref.yaml" with:
110
+ Given a file named "modifications.yml" with:
160
111
  """
161
112
  ---
162
113
  :toto:
163
- :from_regexp: TOTO-TEMP-[X\d]{4}
164
- :to_template: TOTO-%<next_ref>04d
165
- :next_ref: 123
114
+ :type: change_ref
115
+ :config:
116
+ :from_regexp: TOTO-TEMP-[X\d]{4}
117
+ :to_template: TOTO-%<next_ref>04d
118
+ :next_ref: 123
166
119
  """
167
120
  And a file named "thedoc.adoc" with:
168
121
  """
@@ -172,16 +125,18 @@ Feature: The changeref command
172
125
  """
173
126
  [define, requirement, TOTO-TEMP-XXX2]
174
127
  """
175
- When I run `defmastership changeref thedoc.adoc thedoc2.adoc`
128
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
176
129
  Then the stdout should not contain anything
177
130
  And the stderr should not contain anything
178
- And the file "changeref.yaml" should contain:
131
+ And the file "modifications.yml" should contain:
179
132
  """
180
133
  ---
181
134
  :toto:
182
- :from_regexp: TOTO-TEMP-[X\d]{4}
183
- :to_template: TOTO-%<next_ref>04d
184
- :next_ref: 125
135
+ :type: change_ref
136
+ :config:
137
+ :from_regexp: TOTO-TEMP-[X\d]{4}
138
+ :to_template: TOTO-%<next_ref>04d
139
+ :next_ref: 125
185
140
  """
186
141
  And the file "thedoc.adoc" should contain:
187
142
  """
@@ -193,13 +148,15 @@ Feature: The changeref command
193
148
  """
194
149
 
195
150
  Scenario: Change a internal refs
196
- Given a file named "changeref.yaml" with:
151
+ Given a file named "modifications.yml" with:
197
152
  """
198
153
  ---
199
154
  :toto:
200
- :from_regexp: TOTO-TEMP-[X\d]{4}
201
- :to_template: TOTO-%<next_ref>04d
202
- :next_ref: 123
155
+ :type: change_ref
156
+ :config:
157
+ :from_regexp: TOTO-TEMP-[X\d]{4}
158
+ :to_template: TOTO-%<next_ref>04d
159
+ :next_ref: 123
203
160
  """
204
161
  And a file named "thedoc.adoc" with:
205
162
  """
@@ -208,7 +165,7 @@ Feature: The changeref command
208
165
  [define, requirement, TOTO-TEMP-XXX2]
209
166
  is the same as defs:iref[TOTO-TEMP-XXX1]
210
167
  """
211
- When I run `defmastership changeref thedoc.adoc`
168
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
212
169
  Then the stdout should not contain anything
213
170
  And the stderr should not contain anything
214
171
  And the file "thedoc.adoc" should contain:
@@ -220,13 +177,15 @@ Feature: The changeref command
220
177
  """
221
178
 
222
179
  Scenario: Change definitions and iref in two files
223
- Given a file named "changeref.yaml" with:
180
+ Given a file named "modifications.yml" with:
224
181
  """
225
182
  ---
226
183
  :toto:
227
- :from_regexp: TOTO-TEMP-[X\d]{4}
228
- :to_template: TOTO-%<next_ref>04d
229
- :next_ref: 123
184
+ :type: change_ref
185
+ :config:
186
+ :from_regexp: TOTO-TEMP-[X\d]{4}
187
+ :to_template: TOTO-%<next_ref>04d
188
+ :next_ref: 123
230
189
  """
231
190
  And a file named "thedoc.adoc" with:
232
191
  """
@@ -238,17 +197,9 @@ Feature: The changeref command
238
197
  [define, requirement, TOTO-TEMP-XXX2]
239
198
  defs:iref[TOTO-TEMP-XXX1]
240
199
  """
241
- When I run `defmastership changeref thedoc.adoc thedoc2.adoc`
200
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
242
201
  Then the stdout should not contain anything
243
202
  And the stderr should not contain anything
244
- And the file "changeref.yaml" should contain:
245
- """
246
- ---
247
- :toto:
248
- :from_regexp: TOTO-TEMP-[X\d]{4}
249
- :to_template: TOTO-%<next_ref>04d
250
- :next_ref: 125
251
- """
252
203
  And the file "thedoc.adoc" should contain:
253
204
  """
254
205
  [define, requirement, TOTO-0123]
@@ -261,13 +212,15 @@ Feature: The changeref command
261
212
  """
262
213
 
263
214
  Scenario: Do not change definitions when in literal
264
- Given a file named "changeref.yaml" with:
215
+ Given a file named "modifications.yml" with:
265
216
  """
266
217
  ---
267
218
  :toto:
268
- :from_regexp: TOTO-TEMP-[X\d]{4}
269
- :to_template: TOTO-%<next_ref>04d
270
- :next_ref: 123
219
+ :type: change_ref
220
+ :config:
221
+ :from_regexp: TOTO-TEMP-[X\d]{4}
222
+ :to_template: TOTO-%<next_ref>04d
223
+ :next_ref: 123
271
224
  """
272
225
  And a file named "thedoc.adoc" with:
273
226
  """
@@ -275,16 +228,18 @@ Feature: The changeref command
275
228
  [define, requirement, TOTO-TEMP-XXX1]
276
229
  ....
277
230
  """
278
- When I run `defmastership changeref thedoc.adoc`
231
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
279
232
  Then the stdout should not contain anything
280
233
  And the stderr should not contain anything
281
- And the file "changeref.yaml" should contain:
234
+ And the file "modifications.yml" should contain:
282
235
  """
283
236
  ---
284
237
  :toto:
285
- :from_regexp: TOTO-TEMP-[X\d]{4}
286
- :to_template: TOTO-%<next_ref>04d
287
- :next_ref: 123
238
+ :type: change_ref
239
+ :config:
240
+ :from_regexp: TOTO-TEMP-[X\d]{4}
241
+ :to_template: TOTO-%<next_ref>04d
242
+ :next_ref: 123
288
243
  """
289
244
  And the file "thedoc.adoc" should contain:
290
245
  """
@@ -292,5 +247,3 @@ Feature: The changeref command
292
247
  [define, requirement, TOTO-TEMP-XXX1]
293
248
  ....
294
249
  """
295
-
296
-