defmastership 1.0.2 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitlab-ci.yml +20 -0
  4. data/.rubocop.yml +6 -8
  5. data/Gemfile +1 -0
  6. data/LICENSE +22 -0
  7. data/Rakefile +2 -2
  8. data/bin/defmastership +37 -24
  9. data/cucumber.yml +2 -0
  10. data/defmastership.gemspec +17 -10
  11. data/features/changeref.feature +82 -129
  12. data/features/checksum.feature +244 -0
  13. data/features/export.feature +49 -31
  14. data/features/modify.feature +143 -0
  15. data/features/rename_included_files.feature +121 -0
  16. data/features/step_definitions/defmastership_steps.rb +1 -0
  17. data/features/support/env.rb +1 -0
  18. data/lib/defmastership.rb +15 -3
  19. data/lib/defmastership/batch_modifier.rb +33 -0
  20. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +19 -35
  21. data/lib/defmastership/change_ref_modifier.rb +15 -0
  22. data/lib/defmastership/comment_filter.rb +1 -0
  23. data/lib/defmastership/constants.rb +15 -1
  24. data/lib/defmastership/csv_formatter.rb +19 -18
  25. data/lib/defmastership/csv_formatter_body.rb +12 -6
  26. data/lib/defmastership/csv_formatter_header.rb +12 -10
  27. data/lib/defmastership/definition.rb +12 -0
  28. data/lib/defmastership/definition_parser.rb +46 -0
  29. data/lib/defmastership/document.rb +54 -75
  30. data/lib/defmastership/filters.rb +30 -0
  31. data/lib/defmastership/line_modifier_base.rb +29 -0
  32. data/lib/defmastership/modifier_base.rb +29 -0
  33. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  34. data/lib/defmastership/rename_included_files_modifier.rb +15 -0
  35. data/lib/defmastership/update_def_checksum_line_modifier.rb +39 -0
  36. data/lib/defmastership/update_def_checksum_modifier.rb +21 -0
  37. data/lib/defmastership/version.rb +2 -1
  38. data/spec/spec_helper.rb +2 -0
  39. data/spec/unit/defmastership/batch_modifier_spec.rb +115 -0
  40. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +49 -26
  41. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  42. data/spec/unit/defmastership/comment_filter_spec.rb +9 -4
  43. data/spec/unit/defmastership/csv_formatter_body_spec.rb +62 -37
  44. data/spec/unit/defmastership/csv_formatter_header_spec.rb +47 -22
  45. data/spec/unit/defmastership/csv_formatter_spec.rb +67 -105
  46. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  47. data/spec/unit/defmastership/definition_spec.rb +31 -4
  48. data/spec/unit/defmastership/document_spec.rb +170 -35
  49. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  50. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  51. data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +68 -0
  52. data/spec/unit/defmastership/update_def_checksum_modifier_spec.rb +75 -0
  53. data/spec/unit/defmastership_spec.rb +1 -0
  54. metadata +50 -18
  55. data/Gemfile.lock +0 -137
  56. data/lib/defmastership/batch_changer.rb +0 -40
  57. data/lib/defmastership/project_ref_changer.rb +0 -27
  58. data/spec/unit/defmastership/batch_changer_spec.rb +0 -108
  59. data/spec/unit/defmastership/project_ref_changer_spec.rb +0 -79
@@ -0,0 +1,244 @@
1
+ Feature: checksum
2
+ As a Responsible of definitions for a given document
3
+ In order to detect modifications of defintiions
4
+ I want defmastership to export and update checksum in definitions
5
+
6
+ Scenario: Extract one definition with WRONG explicit checksum to CSV
7
+ Given a file named "thedoc.adoc" with:
8
+ """
9
+ [define, requirement, TOTO-0001(babe1234)]
10
+ def one
11
+ """
12
+ When I run `defmastership export thedoc.adoc`
13
+ Then it should fail with:
14
+ """
15
+ WARNING: TOTO-0001 has a wrong explicit checksum (should be d27cb5c3)
16
+ """
17
+ And the file "thedoc.csv" should contain:
18
+ """
19
+ Type,Reference,Value,sha256,Wrong explicit checksum
20
+ requirement,TOTO-0001,def one,d27cb5c3,babe1234
21
+ """
22
+ And the stdout should not contain anything
23
+
24
+ Scenario: Extract two definitions with one WRONG explicit checksum to CSV
25
+ Given a file named "thedoc.adoc" with:
26
+ """
27
+ [define, requirement, TOTO-0001(d27cb5c3)]
28
+ def one
29
+
30
+ [define, requirement, TOTO-0002(babe1234)]
31
+ def two
32
+ """
33
+ When I run `defmastership export thedoc.adoc`
34
+ Then it should fail with:
35
+ """
36
+ WARNING: TOTO-0002 has a wrong explicit checksum (should be b80e1be5)
37
+ """
38
+ Then the file "thedoc.csv" should contain:
39
+ """
40
+ Type,Reference,Value,sha256,Wrong explicit checksum
41
+ requirement,TOTO-0001,def one,d27cb5c3,\"\"
42
+ requirement,TOTO-0002,def two,b80e1be5,babe1234
43
+ """
44
+ And the stdout should not contain anything
45
+
46
+ Scenario: Export not failing even if WRONG explicit checksum
47
+ Given a file named "thedoc.adoc" with:
48
+ """
49
+ [define, requirement, TOTO-0001(d27cb5c3)]
50
+ def one
51
+
52
+ [define, requirement, TOTO-0002(babe1234)]
53
+ def two
54
+ """
55
+ When I successfully run `defmastership export --no-fail thedoc.adoc`
56
+ Then the file "thedoc.csv" should contain:
57
+ """
58
+ Type,Reference,Value,sha256,Wrong explicit checksum
59
+ requirement,TOTO-0001,def one,d27cb5c3,\"\"
60
+ requirement,TOTO-0002,def two,b80e1be5,babe1234
61
+ """
62
+ And the stdout should not contain anything
63
+ And the stderr should contain:
64
+ """
65
+ WARNING: TOTO-0002 has a wrong explicit checksum (should be b80e1be5)
66
+ """
67
+
68
+ Scenario: Extract one definition with explicit checksum to CSV
69
+ Given a file named "thedoc.adoc" with:
70
+ """
71
+ [define, requirement, TOTO-0001(b86dcbde)]
72
+ --
73
+ Exemple of multiline requirement.
74
+ Second line.
75
+ --
76
+ """
77
+ When I successfully run `defmastership export thedoc.adoc`
78
+ Then the file "thedoc.csv" should contain:
79
+ """
80
+ Type,Reference,Value,sha256
81
+ requirement,TOTO-0001,"Exemple of multiline requirement.
82
+ Second line.",b86dcbde
83
+ """
84
+ And the stdout should not contain anything
85
+ And the stderr should not contain anything
86
+
87
+ Scenario: Change one modifier
88
+ Given a file named "modifications.yml" with:
89
+ """
90
+ ---
91
+ :update_requirement_checksum:
92
+ :type: update_def_checksum
93
+ :config:
94
+ :def_type: requirement
95
+ """
96
+ And a file named "thedoc.adoc" with:
97
+ """
98
+ [define, requirement, TOTO-TEMP-XXX1]
99
+ --
100
+ the requirement value.
101
+ --
102
+ """
103
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
104
+ Then the stdout should not contain anything
105
+ And the stderr should not contain anything
106
+ And the file "thedoc.adoc" should contain:
107
+ """
108
+ [define, requirement, TOTO-TEMP-XXX1(244eed18)]
109
+ --
110
+ the requirement value.
111
+ --
112
+ """
113
+
114
+ Scenario: Change one modifier with already set checksum
115
+ Given a file named "modifications.yml" with:
116
+ """
117
+ ---
118
+ :update_requirement_checksum:
119
+ :type: update_def_checksum
120
+ :config:
121
+ :def_type: requirement
122
+ """
123
+ And a file named "thedoc.adoc" with:
124
+ """
125
+ [define, requirement, TOTO-TEMP-XXX1(abcd1234)]
126
+ --
127
+ the requirement value.
128
+ --
129
+ """
130
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
131
+ Then the stdout should not contain anything
132
+ And the stderr should not contain anything
133
+ And the file "thedoc.adoc" should contain:
134
+ """
135
+ [define, requirement, TOTO-TEMP-XXX1(244eed18)]
136
+ --
137
+ the requirement value.
138
+ --
139
+ """
140
+
141
+ Scenario: Checksum is calculated on included file for export
142
+ Given a file named "thedoc.adoc" with:
143
+ """
144
+ [define, requirement, TOTO-0001]
145
+ --
146
+ include::included.txt[]
147
+ --
148
+ """
149
+ And a file named "included.txt" with:
150
+ """
151
+ Exemple of multiline requirement.
152
+ Second line.
153
+ """
154
+ When I successfully run `defmastership export thedoc.adoc`
155
+ Then the file "thedoc.csv" should contain:
156
+ """
157
+ Type,Reference,Value,sha256
158
+ requirement,TOTO-0001,"Exemple of multiline requirement.
159
+ Second line.",b86dcbde
160
+ """
161
+ And the stdout should not contain anything
162
+ And the stderr should not contain anything
163
+
164
+ Scenario: Checksum is calculated on included file in ref modifcation
165
+ Given a file named "modifications.yml" with:
166
+ """
167
+ ---
168
+ :update_requirement_checksum:
169
+ :type: update_def_checksum
170
+ :config:
171
+ :def_type: requirement
172
+ """
173
+ And a file named "thedoc.adoc" with:
174
+ """
175
+ [define, requirement, TOTO-0001]
176
+ --
177
+ include::included.txt[]
178
+ --
179
+ """
180
+ And a file named "included.txt" with:
181
+ """
182
+ Exemple of multiline requirement.
183
+ Second line.
184
+ """
185
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
186
+ Then the file "thedoc.adoc" should contain:
187
+ """
188
+ [define, requirement, TOTO-0001(b86dcbde)]
189
+ --
190
+ include::included.txt[]
191
+ --
192
+ """
193
+ And the stdout should not contain anything
194
+ And the stderr should not contain anything
195
+
196
+ Scenario: Checksum take into account variables in CSV export
197
+ Given a file named "thedoc.adoc" with:
198
+ """
199
+ :variable: multiline
200
+ [define, requirement, TOTO-0001]
201
+ --
202
+ Exemple of {variable} requirement.
203
+ Second line.
204
+ --
205
+ """
206
+ When I successfully run `defmastership export thedoc.adoc`
207
+ Then the file "thedoc.csv" should contain:
208
+ """
209
+ Type,Reference,Value,sha256
210
+ requirement,TOTO-0001,"Exemple of multiline requirement.
211
+ Second line.",b86dcbde
212
+ """
213
+ And the stdout should not contain anything
214
+ And the stderr should not contain anything
215
+
216
+ Scenario: Checksum take into account variables in ref modifcation
217
+ Given a file named "modifications.yml" with:
218
+ """
219
+ ---
220
+ :update_requirement_checksum:
221
+ :type: update_def_checksum
222
+ :config:
223
+ :def_type: requirement
224
+ """
225
+ And a file named "thedoc.adoc" with:
226
+ """
227
+ :variable: multiline
228
+ [define, requirement, TOTO-0001]
229
+ --
230
+ Exemple of {variable} requirement.
231
+ Second line.
232
+ --
233
+ """
234
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
235
+ Then the file "thedoc.adoc" should contain:
236
+ """
237
+ [define, requirement, TOTO-0001(b86dcbde)]
238
+ --
239
+ Exemple of {variable} requirement.
240
+ Second line.
241
+ --
242
+ """
243
+ And the stdout should not contain anything
244
+ And the stderr should not contain anything
@@ -12,16 +12,33 @@ Feature: The extract command
12
12
  Second line.
13
13
  --
14
14
  """
15
- When I run `defmastership export toto.adoc`
15
+ When I successfully run `defmastership export toto.adoc`
16
16
  Then the file "toto.csv" should contain:
17
17
  """
18
- Type,Reference,Value
18
+ Type,Reference,Value,sha256
19
19
  requirement,TOTO-0001,"Exemple of multiline requirement.
20
- Second line."
20
+ Second line.",b86dcbde
21
21
  """
22
22
  And the stdout should not contain anything
23
23
  And the stderr should not contain anything
24
24
 
25
+ Scenario: Extract to CSV with alternative CSV separator
26
+ Given a file named "toto.adoc" with:
27
+ """
28
+ [define, requirement, TOTO-0001]
29
+ --
30
+ Exemple of multiline requirement.
31
+ Second line.
32
+ --
33
+ """
34
+ When I successfully run `defmastership export --separator=';' toto.adoc`
35
+ Then the file "toto.csv" should contain:
36
+ """
37
+ Type;Reference;Value;sha256
38
+ requirement;TOTO-0001;"Exemple of multiline requirement.
39
+ Second line.";b86dcbde
40
+ """
41
+
25
42
  Scenario: Extract one definition with variable to CSV
26
43
  Given a file named "toto.adoc" with:
27
44
  """
@@ -34,13 +51,13 @@ Feature: The extract command
34
51
  Third line with {not_defined_variable}.
35
52
  --
36
53
  """
37
- When I run `defmastership export toto.adoc`
54
+ When I successfully run `defmastership export toto.adoc`
38
55
  Then the file "toto.csv" should contain:
39
56
  """
40
- Type,Reference,Value
57
+ Type,Reference,Value,sha256
41
58
  requirement,TOTO-0001,"Exemple of multiline requirement with variable: Variable content.
42
59
  Variable content : Variable content Toto.
43
- Third line with {not_defined_variable}."
60
+ Third line with {not_defined_variable}.",3bf370ed
44
61
  """
45
62
  And the stdout should not contain anything
46
63
  And the stderr should not contain anything
@@ -62,13 +79,14 @@ Feature: The extract command
62
79
  Second line.
63
80
  --
64
81
  """
65
- When I run `defmastership export toto.adoc`
82
+ When I successfully run `defmastership export toto.adoc`
66
83
  Then the file "toto.csv" should contain:
67
84
  """
68
- Type,Reference,Value
85
+ Type,Reference,Value,sha256
69
86
  requirement,TOTO-0001,"Exemple of multiline requirement.
70
- Second line."
71
- something_else,TOTO-0003,"only one paragraphe.\nwith two sentences."
87
+ Second line.",b86dcbde
88
+ something_else,TOTO-0003,"only one paragraphe.
89
+ with two sentences.",4761e172
72
90
  """
73
91
  And the file "toto.csv" should not contain:
74
92
  """
@@ -90,7 +108,7 @@ Feature: The extract command
90
108
  only one line
91
109
  ....
92
110
  """
93
- When I run `defmastership export toto.adoc`
111
+ When I successfully run `defmastership export toto.adoc`
94
112
  Then the file "toto.csv" should not contain:
95
113
  """
96
114
  something_else
@@ -111,7 +129,7 @@ Feature: The extract command
111
129
  only one line
112
130
  ////
113
131
  """
114
- When I run `defmastership export toto.adoc`
132
+ When I successfully run `defmastership export toto.adoc`
115
133
  Then the file "toto.csv" should not contain:
116
134
  """
117
135
  something_else
@@ -134,7 +152,7 @@ Feature: The extract command
134
152
  ////
135
153
  [define, something_else, TOTO-0003]
136
154
  """
137
- When I run `defmastership export toto.adoc`
155
+ When I successfully run `defmastership export toto.adoc`
138
156
  Then the file "toto.csv" should contain:
139
157
  """
140
158
  something_else
@@ -151,12 +169,12 @@ Feature: The extract command
151
169
  Second line.
152
170
  --
153
171
  """
154
- When I run `defmastership export toto.adoc`
172
+ When I successfully run `defmastership export toto.adoc`
155
173
  Then the file "toto.csv" should contain:
156
174
  """
157
- Type,Reference,Value,Labels
175
+ Type,Reference,Value,sha256,Labels
158
176
  requirement,TOTO-0001,"Exemple of multiline requirement.
159
- Second line.","label1
177
+ Second line.",b86dcbde,"label1
160
178
  label2"
161
179
  """
162
180
  And the stdout should not contain anything
@@ -174,12 +192,12 @@ Feature: The extract command
174
192
  --
175
193
  defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
176
194
  """
177
- When I run `defmastership export toto.adoc`
195
+ When I successfully run `defmastership export toto.adoc`
178
196
  Then the file "toto.csv" should contain:
179
197
  """
180
- Type,Reference,Value,Participate to: ./the_other_document.html
198
+ Type,Reference,Value,sha256,Participate to:
181
199
  requirement,TOTO-0001,"Exemple of multiline requirement.
182
- Second line.","SYSTEM-0012
200
+ Second line.",b86dcbde,"SYSTEM-0012
183
201
  SYSTEM-0014"
184
202
  """
185
203
  And the stdout should not contain anything
@@ -197,12 +215,12 @@ Feature: The extract command
197
215
  --
198
216
  defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
199
217
  """
200
- When I run `defmastership export toto.adoc`
218
+ When I successfully run `defmastership export toto.adoc`
201
219
  Then the file "toto.csv" should contain:
202
220
  """
203
- Type,Reference,Value,Participate to:
221
+ Type,Reference,Value,sha256,Participate to:
204
222
  requirement,TOTO-0001,"Exemple of multiline requirement.
205
- Second line.","SYSTEM-0012
223
+ Second line.",b86dcbde,"SYSTEM-0012
206
224
  SYSTEM-0014"
207
225
  """
208
226
  And the stdout should not contain anything
@@ -219,14 +237,14 @@ Feature: The extract command
219
237
  --
220
238
  defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
221
239
  """
222
- When I run `defmastership export toto.adoc`
240
+ When I successfully run `defmastership export toto.adoc`
223
241
  Then the stdout should not contain anything
224
242
  And the stderr should not contain anything
225
243
  And the file "toto.csv" should contain:
226
244
  """
227
- Type,Reference,Value,Participate to:
245
+ Type,Reference,Value,sha256,Participate to:
228
246
  requirement,TOTO-0001,"Exemple of multiline requirement.
229
- Second line.","SYSTEM-0012
247
+ Second line.",b86dcbde,"SYSTEM-0012
230
248
  SYSTEM-0014"
231
249
  """
232
250
 
@@ -240,12 +258,12 @@ Feature: The extract command
240
258
  --
241
259
  please see defs:iref[TOTO-0002]
242
260
  """
243
- When I run `defmastership export toto.adoc`
261
+ When I successfully run `defmastership export toto.adoc`
244
262
  Then the file "toto.csv" should contain:
245
263
  """
246
- Type,Reference,Value,Internal links
264
+ Type,Reference,Value,sha256,Internal links
247
265
  requirement,TOTO-0001,"Exemple of multiline requirement.
248
- Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123].","TOTO-0001
266
+ Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123].",059b7188,"TOTO-0001
249
267
  TOTO-0123
250
268
  TOTO-0002"
251
269
  """
@@ -264,12 +282,12 @@ Feature: The extract command
264
282
  defs:attribute[verifiedby, Beautiful Test]
265
283
  defs:attribute[criticity, Very cool]
266
284
  """
267
- When I run `defmastership export toto.adoc`
285
+ When I successfully run `defmastership export toto.adoc`
268
286
  And the stdout should not contain anything
269
287
  Then the file "toto.csv" should contain:
270
288
  """
271
- Type,Reference,Value,Verified by:,Criticity:
272
- requirement,TOTO-0001,One single line.,Beautiful Test,Very cool
289
+ Type,Reference,Value,sha256,Verified by:,Criticity:
290
+ requirement,TOTO-0001,One single line.,554b0ff5,Beautiful Test,Very cool
273
291
  """
274
292
  And the stdout should not contain anything
275
293
  And the stderr should not contain anything
@@ -0,0 +1,143 @@
1
+ Feature: The modify command
2
+ As a Responsible of definitions for a given document
3
+ In order to manage to applu predefined modifications
4
+ I want defmastership to apply automatic modifications
5
+
6
+ Scenario: Change one modifier
7
+ Given a file named "modifications.yml" with:
8
+ """
9
+ ---
10
+ :temp-references:
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
16
+ """
17
+ And a file named "thedoc.adoc" with:
18
+ """
19
+ [define, requirement, TOTO-TEMP-XXX1]
20
+ """
21
+ When I successfully run `defmastership modify --modifications temp-references thedoc.adoc`
22
+ Then the stdout should not contain anything
23
+ And the stderr should not contain anything
24
+ And the file "modifications.yml" should contain:
25
+ """
26
+ ---
27
+ :temp-references:
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
33
+ """
34
+ And the file "thedoc.adoc" should contain:
35
+ """
36
+ [define, requirement, TOTO-0123]
37
+ """
38
+
39
+ Scenario: Make modifications with yaml file parameter
40
+ Given a file named "pouet.yml" with:
41
+ """
42
+ ---
43
+ :toto:
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
49
+ """
50
+ And a file named "thedoc.adoc" with:
51
+ """
52
+ [define, requirement, TOTO-TEMP-XXX1]
53
+ """
54
+ When I successfully run `defmastership modify --modifications-file=pouet.yml --modifications toto thedoc.adoc`
55
+ Then the stdout should not contain anything
56
+ And the stderr should not contain anything
57
+ And the file "pouet.yml" should contain:
58
+ """
59
+ ---
60
+ :toto:
61
+ :type: change_ref
62
+ :config:
63
+ :from_regexp: TOTO-TEMP-[X\d]{4}
64
+ :to_template: TOTO-%<next_ref>04d
65
+ :next_ref: 124
66
+ """
67
+ And the file "thedoc.adoc" should contain:
68
+ """
69
+ [define, requirement, TOTO-0123]
70
+ """
71
+
72
+ Scenario: Generate a table with changes
73
+ Given a file named "modifications.yml" with:
74
+ """
75
+ ---
76
+ :temp-references:
77
+ :type: change_ref
78
+ :config:
79
+ :from_regexp: TOTO-TEMP-[X\d]{4}
80
+ :to_template: TOTO-%<next_ref>04d
81
+ :next_ref: 123
82
+ """
83
+ And a file named "thedoc.adoc" with:
84
+ """
85
+ [define, requirement, TOTO-TEMP-XXX1]
86
+ [define, requirement, TOTO-TEMP-XXX2]
87
+ """
88
+ When I successfully run `defmastership modify --modifications temp-references --changes-summary=changes.csv thedoc.adoc`
89
+ Then the stderr should not contain anything
90
+ And the stdout should not contain anything
91
+ And the file "changes.csv" should contain:
92
+ """
93
+ Modifier,Was,Becomes
94
+ temp-references,TOTO-TEMP-XXX1,TOTO-0123
95
+ temp-references,TOTO-TEMP-XXX2,TOTO-0124
96
+ """
97
+
98
+ Scenario: Apply two modifcations
99
+ Given a file named "modifications.yml" with:
100
+ """
101
+ ---
102
+ :temp-references:
103
+ :type: change_ref
104
+ :config:
105
+ :from_regexp: TOTO-TEMP-[X\d]{4}
106
+ :to_template: TOTO-%<next_ref>04d
107
+ :next_ref: 123
108
+ :tata_or_titi:
109
+ :type: change_ref
110
+ :config:
111
+ :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
112
+ :to_template: "%<tata_or_titi>s-%<next_ref>07d"
113
+ :next_ref: 432
114
+ """
115
+ And a file named "thedoc.adoc" with:
116
+ """
117
+ [define, requirement, TOTO-TEMP-XXX1]
118
+ [define, requirement, TITI-TEMP-XXX2]
119
+ """
120
+ When I successfully run `defmastership modify --modifications temp-references,tata_or_titi --changes-summary=changes.csv thedoc.adoc`
121
+ Then the stdout should not contain anything
122
+ And the stderr should not contain anything
123
+ And the file "modifications.yml" should contain:
124
+ """
125
+ ---
126
+ :temp-references:
127
+ :type: change_ref
128
+ :config:
129
+ :from_regexp: TOTO-TEMP-[X\d]{4}
130
+ :to_template: TOTO-%<next_ref>04d
131
+ :next_ref: 124
132
+ :tata_or_titi:
133
+ :type: change_ref
134
+ :config:
135
+ :from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
136
+ :to_template: "%<tata_or_titi>s-%<next_ref>07d"
137
+ :next_ref: 433
138
+ """
139
+ And the file "thedoc.adoc" should contain:
140
+ """
141
+ [define, requirement, TOTO-0123]
142
+ [define, requirement, TITI-0000432]
143
+ """