defmastership 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +15 -1
- data/Gemfile +27 -7
- data/Guardfile +44 -0
- data/config/cucumber.yml +3 -0
- data/config/mutant.yml +4 -0
- data/config/reek.yml +129 -105
- data/config/rubocop.yml +72 -28
- data/defmastership.gemspec +5 -3
- data/features/changeref.feature +0 -8
- data/features/definition_checksum.feature +0 -10
- data/features/definition_version.feature +168 -10
- data/features/export.feature +23 -18
- data/features/modify.feature +1 -5
- data/features/rename_included_files.feature +0 -5
- data/features/step_definitions/git_steps.rb +19 -0
- data/lib/defmastership/constants.rb +5 -3
- data/lib/defmastership/definition.rb +2 -2
- data/lib/defmastership/document.rb +6 -14
- data/lib/defmastership/update_def_modifier.rb +1 -1
- data/lib/defmastership/update_def_version_modifier.rb +30 -5
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/def_mastership/batch_modifier_spec.rb +2 -0
- data/spec/unit/def_mastership/modifier_factory_spec.rb +1 -0
- data/spec/unit/def_mastership/modifier_spec.rb +8 -6
- data/spec/unit/def_mastership/update_def_modifier_spec.rb +2 -0
- data/spec/unit/def_mastership/update_def_version_modifier_spec.rb +225 -33
- data/tasks/code_quality.rake +74 -0
- data/tasks/test.rake +6 -21
- metadata +36 -11
- data/.rubocop.yml +0 -76
- data/config/devtools.yml +0 -2
- data/config/flay.yml +0 -3
- data/config/flog.yml +0 -2
- data/config/yardstick.yml +0 -2
- data/cucumber.yml +0 -2
- data/tasks/smelling_code.rake +0 -38
- /data/{.rspec → config/rspec} +0 -0
@@ -82,7 +82,6 @@ Feature: definition checksum
|
|
82
82
|
Second line.",~b86dcbde
|
83
83
|
"""
|
84
84
|
And the stdout should not contain anything
|
85
|
-
And the stderr should not contain anything
|
86
85
|
|
87
86
|
Scenario: Change one modifier
|
88
87
|
Given a file named "modifications.yml" with:
|
@@ -102,7 +101,6 @@ Feature: definition checksum
|
|
102
101
|
"""
|
103
102
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
104
103
|
Then the stdout should not contain anything
|
105
|
-
And the stderr should not contain anything
|
106
104
|
And the file "thedoc.adoc" should contain:
|
107
105
|
"""
|
108
106
|
[define, requirement, TOTO-TEMP-XXX1(~244eed18)]
|
@@ -129,7 +127,6 @@ Feature: definition checksum
|
|
129
127
|
"""
|
130
128
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
131
129
|
Then the stdout should not contain anything
|
132
|
-
And the stderr should not contain anything
|
133
130
|
And the file "thedoc.adoc" should contain:
|
134
131
|
"""
|
135
132
|
[define, requirement, TOTO-TEMP-XXX1(~244eed18)]
|
@@ -159,7 +156,6 @@ Feature: definition checksum
|
|
159
156
|
Second line.",~b86dcbde
|
160
157
|
"""
|
161
158
|
And the stdout should not contain anything
|
162
|
-
And the stderr should not contain anything
|
163
159
|
|
164
160
|
Scenario: Checksum is calculated on included file in ref modification
|
165
161
|
Given a file named "modifications.yml" with:
|
@@ -191,7 +187,6 @@ Feature: definition checksum
|
|
191
187
|
--
|
192
188
|
"""
|
193
189
|
And the stdout should not contain anything
|
194
|
-
And the stderr should not contain anything
|
195
190
|
|
196
191
|
Scenario: Checksum take into account variables in CSV export
|
197
192
|
Given a file named "thedoc.adoc" with:
|
@@ -211,7 +206,6 @@ Feature: definition checksum
|
|
211
206
|
Second line.",~b86dcbde
|
212
207
|
"""
|
213
208
|
And the stdout should not contain anything
|
214
|
-
And the stderr should not contain anything
|
215
209
|
|
216
210
|
Scenario: Checksum takes into account variables in ref modification
|
217
211
|
Given a file named "modifications.yml" with:
|
@@ -241,7 +235,6 @@ Feature: definition checksum
|
|
241
235
|
--
|
242
236
|
"""
|
243
237
|
And the stdout should not contain anything
|
244
|
-
And the stderr should not contain anything
|
245
238
|
|
246
239
|
Scenario: Checksum does not take into account bad variables definition
|
247
240
|
Given a file named "modifications.yml" with:
|
@@ -271,7 +264,6 @@ Feature: definition checksum
|
|
271
264
|
--
|
272
265
|
"""
|
273
266
|
And the stdout should not contain anything
|
274
|
-
And the stderr should not contain anything
|
275
267
|
|
276
268
|
Scenario: Checksum keep explicit version in ref modification
|
277
269
|
Given a file named "modifications.yml" with:
|
@@ -291,7 +283,6 @@ Feature: definition checksum
|
|
291
283
|
"""
|
292
284
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
293
285
|
Then the stdout should not contain anything
|
294
|
-
And the stderr should not contain anything
|
295
286
|
And the file "thedoc.adoc" should contain:
|
296
287
|
"""
|
297
288
|
[define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
|
@@ -318,7 +309,6 @@ Feature: definition checksum
|
|
318
309
|
"""
|
319
310
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
320
311
|
Then the stdout should not contain anything
|
321
|
-
And the stderr should not contain anything
|
322
312
|
And the file "thedoc.adoc" should contain:
|
323
313
|
"""
|
324
314
|
[define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
|
@@ -1,9 +1,9 @@
|
|
1
|
-
Feature: definitions version
|
2
|
-
As a Responsible of definitions for a given document
|
1
|
+
Feature: definitions version
|
2
|
+
As a Responsible of definitions for a given document
|
3
3
|
In order to detect handle versions definitions
|
4
4
|
I want defmastership to export explicit versions in definitions
|
5
5
|
|
6
|
-
Scenario: Extract one definition with explicit version to CSV
|
6
|
+
Scenario: Extract one definition with explicit version to CSV
|
7
7
|
Given a file named "thedoc.adoc" with:
|
8
8
|
"""
|
9
9
|
[define, requirement, TOTO-0001(pouet)]
|
@@ -20,9 +20,8 @@ Feature: definitions version
|
|
20
20
|
Second line.",~b86dcbde,pouet
|
21
21
|
"""
|
22
22
|
And the stdout should not contain anything
|
23
|
-
And the stderr should not contain anything
|
24
23
|
|
25
|
-
Scenario: Set initial explicit version when definition has changed
|
24
|
+
Scenario: Set initial explicit version when definition has changed
|
26
25
|
Given a file named "ref_doc.adoc" with:
|
27
26
|
"""
|
28
27
|
[define, requirement, TOTO-0001]
|
@@ -49,7 +48,170 @@ Feature: definitions version
|
|
49
48
|
"""
|
50
49
|
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
51
50
|
And the stdout should not contain anything
|
52
|
-
|
51
|
+
Then the file "thedoc.adoc" should contain:
|
52
|
+
"""
|
53
|
+
[define, requirement, TOTO-0001(a)]
|
54
|
+
--
|
55
|
+
modified text.
|
56
|
+
--
|
57
|
+
"""
|
58
|
+
|
59
|
+
Scenario: Set initial explicit version when definition has changed with multiple ref_files
|
60
|
+
Given a file named "ref_doc1.adoc" with:
|
61
|
+
"""
|
62
|
+
[define, requirement, TOTO-0001]
|
63
|
+
--
|
64
|
+
initial text 1.
|
65
|
+
--
|
66
|
+
"""
|
67
|
+
Given a file named "ref_doc2.adoc" with:
|
68
|
+
"""
|
69
|
+
[define, requirement, TOTO-0002(z)]
|
70
|
+
--
|
71
|
+
initial text 2.
|
72
|
+
--
|
73
|
+
"""
|
74
|
+
Given a file named "thedoc.adoc" with:
|
75
|
+
"""
|
76
|
+
[define, requirement, TOTO-0001(whatever)]
|
77
|
+
--
|
78
|
+
modified text.
|
79
|
+
--
|
80
|
+
|
81
|
+
[define, requirement, TOTO-0002(whatever)]
|
82
|
+
--
|
83
|
+
modified text again.
|
84
|
+
--
|
85
|
+
"""
|
86
|
+
And a file named "modifications.yml" with:
|
87
|
+
"""
|
88
|
+
---
|
89
|
+
:update_requirement_version:
|
90
|
+
:type: update_def_version
|
91
|
+
:config:
|
92
|
+
:def_type: requirement
|
93
|
+
:first_version: a
|
94
|
+
:ref_document: ['./ref_doc1.adoc', './ref_doc2.adoc']
|
95
|
+
"""
|
96
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
97
|
+
And the stdout should not contain anything
|
98
|
+
Then the file "thedoc.adoc" should contain:
|
99
|
+
"""
|
100
|
+
[define, requirement, TOTO-0001(a)]
|
101
|
+
--
|
102
|
+
modified text.
|
103
|
+
--
|
104
|
+
|
105
|
+
[define, requirement, TOTO-0002(aa)]
|
106
|
+
--
|
107
|
+
modified text again.
|
108
|
+
--
|
109
|
+
"""
|
110
|
+
|
111
|
+
Scenario: Update explicit version based on git tag
|
112
|
+
Given I initialize a git repo
|
113
|
+
And a file named "thedoc.adoc" with:
|
114
|
+
"""
|
115
|
+
[define, requirement, TOTO-0001]
|
116
|
+
--
|
117
|
+
initial text.
|
118
|
+
--
|
119
|
+
"""
|
120
|
+
And I add and commit the "thedoc.adoc" file
|
121
|
+
And I set the "THE_TAG" tag
|
122
|
+
And a file named "thedoc.adoc" with:
|
123
|
+
"""
|
124
|
+
[define, requirement, TOTO-0001(whatever)]
|
125
|
+
--
|
126
|
+
modified text.
|
127
|
+
--
|
128
|
+
"""
|
129
|
+
And a file named "modifications.yml" with:
|
130
|
+
"""
|
131
|
+
---
|
132
|
+
:update_requirement_version:
|
133
|
+
:type: update_def_version
|
134
|
+
:config:
|
135
|
+
:def_type: requirement
|
136
|
+
:first_version: a
|
137
|
+
:ref_tag: 'THE_TAG'
|
138
|
+
"""
|
139
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
140
|
+
And the stdout should not contain anything
|
141
|
+
Then the file "thedoc.adoc" should contain:
|
142
|
+
"""
|
143
|
+
[define, requirement, TOTO-0001(a)]
|
144
|
+
--
|
145
|
+
modified text.
|
146
|
+
--
|
147
|
+
"""
|
148
|
+
|
149
|
+
Scenario: Update explicit version based on git tag on a different git repo
|
150
|
+
And a file named "defmastership-example.adoc" with:
|
151
|
+
"""
|
152
|
+
[define, whatever, WHATEVER-0001]
|
153
|
+
Simplest ever definition. !modified!
|
154
|
+
With a single paragraph.
|
155
|
+
"""
|
156
|
+
And a file named "modifications.yml" with:
|
157
|
+
"""
|
158
|
+
---
|
159
|
+
:update_requirement_version:
|
160
|
+
:type: update_def_version
|
161
|
+
:config:
|
162
|
+
:def_type: whatever
|
163
|
+
:first_version: a
|
164
|
+
:ref_tag: 'TEST_UPDATE_VERSION'
|
165
|
+
:ref_repo: 'https://gitlab.com/defmastership/defmastership-example.git'
|
166
|
+
"""
|
167
|
+
When I successfully run `defmastership modify --modifications update_requirement_version defmastership-example.adoc`
|
168
|
+
And the stdout should not contain anything
|
169
|
+
Then the file "defmastership-example.adoc" should contain:
|
170
|
+
"""
|
171
|
+
[define, whatever, WHATEVER-0001(a)]
|
172
|
+
Simplest ever definition. !modified!
|
173
|
+
With a single paragraph.
|
174
|
+
"""
|
175
|
+
|
176
|
+
Scenario: Update explicit version based on git tag and different filename
|
177
|
+
Given I initialize a git repo
|
178
|
+
And a file named "ref_doc.adoc" with:
|
179
|
+
"""
|
180
|
+
[define, requirement, TOTO-0001]
|
181
|
+
--
|
182
|
+
initial text.
|
183
|
+
--
|
184
|
+
"""
|
185
|
+
And I add and commit the "ref_doc.adoc" file
|
186
|
+
And I set the "THE_TAG" tag
|
187
|
+
And I remove the file "ref_doc.adoc"
|
188
|
+
And a file named "thedoc.adoc" with:
|
189
|
+
"""
|
190
|
+
[define, requirement, TOTO-0001(whatever)]
|
191
|
+
--
|
192
|
+
modified text.
|
193
|
+
--
|
194
|
+
"""
|
195
|
+
And a file named "ref_doc.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_document: ./ref_doc.adoc
|
211
|
+
:ref_tag: 'THE_TAG'
|
212
|
+
"""
|
213
|
+
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
214
|
+
And the stdout should not contain anything
|
53
215
|
Then the file "thedoc.adoc" should contain:
|
54
216
|
"""
|
55
217
|
[define, requirement, TOTO-0001(a)]
|
@@ -85,7 +247,6 @@ Feature: definitions version
|
|
85
247
|
"""
|
86
248
|
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
87
249
|
And the stdout should not contain anything
|
88
|
-
And the stderr should not contain anything
|
89
250
|
Then the file "thedoc.adoc" should contain:
|
90
251
|
"""
|
91
252
|
[define, requirement, TOTO-0001]
|
@@ -121,7 +282,6 @@ Feature: definitions version
|
|
121
282
|
"""
|
122
283
|
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
123
284
|
And the stdout should not contain anything
|
124
|
-
And the stderr should not contain anything
|
125
285
|
Then the file "thedoc.adoc" should contain:
|
126
286
|
"""
|
127
287
|
[define, requirement, TOTO-0001(4)]
|
@@ -157,7 +317,6 @@ Feature: definitions version
|
|
157
317
|
"""
|
158
318
|
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
159
319
|
And the stdout should not contain anything
|
160
|
-
And the stderr should not contain anything
|
161
320
|
Then the file "thedoc.adoc" should contain:
|
162
321
|
"""
|
163
322
|
[define, requirement, TOTO-0001]
|
@@ -193,7 +352,6 @@ Feature: definitions version
|
|
193
352
|
"""
|
194
353
|
When I successfully run `defmastership modify --modifications update_requirement_version thedoc.adoc`
|
195
354
|
And the stdout should not contain anything
|
196
|
-
And the stderr should not contain anything
|
197
355
|
Then the file "thedoc.adoc" should contain:
|
198
356
|
"""
|
199
357
|
[define, requirement, TOTO-0001(a~abcd1234)]
|
data/features/export.feature
CHANGED
@@ -20,7 +20,6 @@ Feature: The extract command
|
|
20
20
|
Second line.",~b86dcbde
|
21
21
|
"""
|
22
22
|
And the stdout should not contain anything
|
23
|
-
And the stderr should not contain anything
|
24
23
|
|
25
24
|
Scenario: Extract to CSV with alternative CSV separator
|
26
25
|
Given a file named "toto.adoc" with:
|
@@ -60,7 +59,6 @@ Feature: The extract command
|
|
60
59
|
Third line with {not_defined_variable}.",~3bf370ed
|
61
60
|
"""
|
62
61
|
And the stdout should not contain anything
|
63
|
-
And the stderr should not contain anything
|
64
62
|
|
65
63
|
|
66
64
|
Scenario: Extract some definitions to CSV
|
@@ -93,7 +91,6 @@ Feature: The extract command
|
|
93
91
|
ignored multiline
|
94
92
|
"""
|
95
93
|
And the stdout should not contain anything
|
96
|
-
And the stderr should not contain anything
|
97
94
|
|
98
95
|
Scenario: Ignore definitions in literal block
|
99
96
|
Given a file named "toto.adoc" with:
|
@@ -114,7 +111,6 @@ Feature: The extract command
|
|
114
111
|
something_else
|
115
112
|
"""
|
116
113
|
And the stdout should not contain anything
|
117
|
-
And the stderr should not contain anything
|
118
114
|
|
119
115
|
Scenario: Ignore definitions in example block
|
120
116
|
Given a file named "toto.adoc" with:
|
@@ -135,7 +131,6 @@ Feature: The extract command
|
|
135
131
|
something_else
|
136
132
|
"""
|
137
133
|
And the stdout should not contain anything
|
138
|
-
And the stderr should not contain anything
|
139
134
|
|
140
135
|
Scenario: Ignore definitions in commment block
|
141
136
|
Given a file named "toto.adoc" with:
|
@@ -156,7 +151,6 @@ Feature: The extract command
|
|
156
151
|
something_else
|
157
152
|
"""
|
158
153
|
And the stdout should not contain anything
|
159
|
-
And the stderr should not contain anything
|
160
154
|
|
161
155
|
Scenario: Handle mixes comment and literal blocks
|
162
156
|
Given a file named "toto.adoc" with:
|
@@ -179,7 +173,6 @@ Feature: The extract command
|
|
179
173
|
something_else
|
180
174
|
"""
|
181
175
|
And the stdout should not contain anything
|
182
|
-
And the stderr should not contain anything
|
183
176
|
|
184
177
|
Scenario: Extract definition with labels
|
185
178
|
Given a file named "toto.adoc" with:
|
@@ -199,7 +192,6 @@ Feature: The extract command
|
|
199
192
|
label2"
|
200
193
|
"""
|
201
194
|
And the stdout should not contain anything
|
202
|
-
And the stderr should not contain anything
|
203
195
|
|
204
196
|
Scenario: Extract one definition with external ref to CSV
|
205
197
|
Given a file named "toto.adoc" with:
|
@@ -222,7 +214,29 @@ Feature: The extract command
|
|
222
214
|
SYSTEM-0014"
|
223
215
|
"""
|
224
216
|
And the stdout should not contain anything
|
225
|
-
|
217
|
+
|
218
|
+
Scenario: Extract one definition with external ref (with version and checksum) to CSV
|
219
|
+
Given a file named "toto.adoc" with:
|
220
|
+
"""
|
221
|
+
:eref-implements-prefix: Participate to:
|
222
|
+
:eref-implements-url: ./the_other_document.html
|
223
|
+
[define, requirement, TOTO-0001]
|
224
|
+
--
|
225
|
+
Exemple of multiline requirement.
|
226
|
+
Second line.
|
227
|
+
--
|
228
|
+
defs:eref[implements, [SYSTEM-0012(a), SYSTEM-0014, SYSTEM-0015(b~1223abcd)]]
|
229
|
+
"""
|
230
|
+
When I successfully run `defmastership export toto.adoc`
|
231
|
+
Then the file "toto.csv" should contain:
|
232
|
+
"""
|
233
|
+
Type,Reference,Value,Checksum,Participate to:
|
234
|
+
requirement,TOTO-0001,"Exemple of multiline requirement.
|
235
|
+
Second line.",~b86dcbde,"SYSTEM-0012(a)
|
236
|
+
SYSTEM-0014
|
237
|
+
SYSTEM-0015(b~1223abcd)"
|
238
|
+
"""
|
239
|
+
And the stdout should not contain anything
|
226
240
|
|
227
241
|
Scenario: Extract one definition with missing external ref to CSV
|
228
242
|
Given a file named "toto.adoc" with:
|
@@ -243,7 +257,6 @@ Feature: The extract command
|
|
243
257
|
Second line.",~b86dcbde,
|
244
258
|
"""
|
245
259
|
And the stdout should not contain anything
|
246
|
-
And the stderr should not contain anything
|
247
260
|
|
248
261
|
Scenario: Extract one definition with external ref without url to CSV
|
249
262
|
Given a file named "toto.adoc" with:
|
@@ -266,7 +279,6 @@ Feature: The extract command
|
|
266
279
|
SYSTEM-0014"
|
267
280
|
"""
|
268
281
|
And the stdout should not contain anything
|
269
|
-
And the stderr should not contain anything
|
270
282
|
|
271
283
|
Scenario: Extract one definition with external ref to CSV without URL
|
272
284
|
Given a file named "toto.adoc" with:
|
@@ -281,7 +293,6 @@ Feature: The extract command
|
|
281
293
|
"""
|
282
294
|
When I successfully run `defmastership export toto.adoc`
|
283
295
|
Then the stdout should not contain anything
|
284
|
-
And the stderr should not contain anything
|
285
296
|
And the file "toto.csv" should contain:
|
286
297
|
"""
|
287
298
|
Type,Reference,Value,Checksum,Participate to:
|
@@ -310,7 +321,6 @@ Feature: The extract command
|
|
310
321
|
TOTO-0002"
|
311
322
|
"""
|
312
323
|
And the stdout should not contain anything
|
313
|
-
And the stderr should not contain anything
|
314
324
|
|
315
325
|
Scenario: Extract one definition with attributes to CSV
|
316
326
|
Given a file named "toto.adoc" with:
|
@@ -332,7 +342,6 @@ Feature: The extract command
|
|
332
342
|
requirement,TOTO-0001,One single line.,~554b0ff5,Beautiful Test,Very cool
|
333
343
|
"""
|
334
344
|
And the stdout should not contain anything
|
335
|
-
And the stderr should not contain anything
|
336
345
|
|
337
346
|
Scenario: Extract one definition with missing attributes to CSV
|
338
347
|
Given a file named "toto.adoc" with:
|
@@ -353,7 +362,6 @@ Feature: The extract command
|
|
353
362
|
requirement,TOTO-0001,One single line.,~554b0ff5,Beautiful Test,
|
354
363
|
"""
|
355
364
|
And the stdout should not contain anything
|
356
|
-
And the stderr should not contain anything
|
357
365
|
|
358
366
|
Scenario: Extract one definition with example in it
|
359
367
|
Given a file named "toto.adoc" with:
|
@@ -378,7 +386,6 @@ Feature: The extract command
|
|
378
386
|
----",~8f20a443
|
379
387
|
"""
|
380
388
|
And the stdout should not contain anything
|
381
|
-
And the stderr should not contain anything
|
382
389
|
|
383
390
|
Scenario: Extract one definition with single line comment in it
|
384
391
|
Given a file named "toto.adoc" with:
|
@@ -395,7 +402,6 @@ Feature: The extract command
|
|
395
402
|
requirement,TOTO-0001,// comment,~b0b506c3
|
396
403
|
"""
|
397
404
|
And the stdout should not contain anything
|
398
|
-
And the stderr should not contain anything
|
399
405
|
|
400
406
|
Scenario: Extract one definition with multi line comment or literal in it
|
401
407
|
Given a file named "toto.adoc" with:
|
@@ -422,4 +428,3 @@ Feature: The extract command
|
|
422
428
|
....",~7eb3c490
|
423
429
|
"""
|
424
430
|
And the stdout should not contain anything
|
425
|
-
And the stderr should not contain anything
|
data/features/modify.feature
CHANGED
@@ -20,7 +20,6 @@ Feature: The modify command
|
|
20
20
|
"""
|
21
21
|
When I successfully run `defmastership modify --modifications temp-references thedoc.adoc`
|
22
22
|
Then the stdout should not contain anything
|
23
|
-
And the stderr should not contain anything
|
24
23
|
And the file "modifications.yml" should contain:
|
25
24
|
"""
|
26
25
|
---
|
@@ -75,7 +74,6 @@ Feature: The modify command
|
|
75
74
|
"""
|
76
75
|
When I successfully run `defmastership modify --modifications-file=pouet.yml --modifications toto thedoc.adoc`
|
77
76
|
Then the stdout should not contain anything
|
78
|
-
And the stderr should not contain anything
|
79
77
|
And the file "pouet.yml" should contain:
|
80
78
|
"""
|
81
79
|
---
|
@@ -108,8 +106,7 @@ Feature: The modify command
|
|
108
106
|
[define, requirement, TOTO-TEMP-XXX2]
|
109
107
|
"""
|
110
108
|
When I successfully run `defmastership modify --modifications temp-references --changes-summary=changes.csv thedoc.adoc`
|
111
|
-
Then the
|
112
|
-
And the stdout should not contain anything
|
109
|
+
Then the stdout should not contain anything
|
113
110
|
And the file "changes.csv" should contain:
|
114
111
|
"""
|
115
112
|
Modifier,Was,Becomes
|
@@ -141,7 +138,6 @@ Feature: The modify command
|
|
141
138
|
"""
|
142
139
|
When I successfully run `defmastership modify --modifications temp-references,tata_or_titi --changes-summary=changes.csv thedoc.adoc`
|
143
140
|
Then the stdout should not contain anything
|
144
|
-
And the stderr should not contain anything
|
145
141
|
And the file "modifications.yml" should contain:
|
146
142
|
"""
|
147
143
|
---
|
@@ -23,7 +23,6 @@ Feature: The rename_included_files command
|
|
23
23
|
And an empty file named "any_path/one_file.png"
|
24
24
|
When I successfully run `defmastership modify --modifications rename_included_png thedoc.adoc`
|
25
25
|
Then the stdout should not contain anything
|
26
|
-
And the stderr should not contain anything
|
27
26
|
And the file "thedoc.adoc" should contain:
|
28
27
|
"""
|
29
28
|
include::any_path/one_file.png[]
|
@@ -49,7 +48,6 @@ Feature: The rename_included_files command
|
|
49
48
|
And an empty file named "any_path/one_file.png"
|
50
49
|
When I successfully run `defmastership modify --modifications rename_included_png thedoc.adoc`
|
51
50
|
Then the stdout should not contain anything
|
52
|
-
And the stderr should not contain anything
|
53
51
|
And the file "thedoc.adoc" should contain:
|
54
52
|
"""
|
55
53
|
[define, requirement, TOTO-WHATEVER-123]
|
@@ -77,7 +75,6 @@ Feature: The rename_included_files command
|
|
77
75
|
And an empty file named "any_path/one_file.png"
|
78
76
|
When I successfully run `defmastership modify --modifications rename_included_png thedoc.adoc`
|
79
77
|
Then the stdout should not contain anything
|
80
|
-
And the stderr should not contain anything
|
81
78
|
And the file "thedoc.adoc" should contain:
|
82
79
|
"""
|
83
80
|
[define, requirement, TOTO-WHATEVER-123]
|
@@ -109,7 +106,6 @@ Feature: The rename_included_files command
|
|
109
106
|
And an empty file named "one_two/one_file.png"
|
110
107
|
When I successfully run `defmastership modify --modifications rename_included_png thedoc.adoc`
|
111
108
|
Then the stdout should not contain anything
|
112
|
-
And the stderr should not contain anything
|
113
109
|
And the file "thedoc.adoc" should contain:
|
114
110
|
"""
|
115
111
|
:any: one
|
@@ -142,7 +138,6 @@ Feature: The rename_included_files command
|
|
142
138
|
And an empty file named "any_path/TOTO-WHATEVER-123_one_file.png"
|
143
139
|
When I successfully run `defmastership modify --modifications rename_included_png thedoc.adoc`
|
144
140
|
Then the stdout should not contain anything
|
145
|
-
And the stderr should not contain anything
|
146
141
|
And the file "thedoc.adoc" should contain:
|
147
142
|
"""
|
148
143
|
[define, requirement, TOTO-WHATEVER-123]
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2024 Jerome Arbez-Gindre
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'git'
|
5
|
+
|
6
|
+
Given('I initialize a git repo') do
|
7
|
+
Git.init(Aruba.config.home_directory)
|
8
|
+
end
|
9
|
+
|
10
|
+
Given('I add and commit the {string} file') do |filename|
|
11
|
+
git = Git.open(Aruba.config.home_directory)
|
12
|
+
git.add(filename)
|
13
|
+
git.commit('whatever')
|
14
|
+
end
|
15
|
+
|
16
|
+
Given('I set the {string} tag') do |tag_name|
|
17
|
+
git = Git.open(Aruba.config.home_directory)
|
18
|
+
git.add_tag(tag_name)
|
19
|
+
end
|
@@ -23,8 +23,10 @@ module DefMastership
|
|
23
23
|
'\((?<explicit_version>[^~]+)?(?<explicit_checksum>~[[:alnum:]]+)?\)' \
|
24
24
|
')?'
|
25
25
|
|
26
|
+
REFERENCE = '(?<reference>[\\w:_-]+)'
|
27
|
+
|
26
28
|
DEFINITION = Regexp.new(
|
27
|
-
"#{DEF_BEFORE_REF}
|
29
|
+
"#{DEF_BEFORE_REF}#{REFERENCE}#{DEF_VERSION_AND_CHECKSUM}#{DEF_AFTER_REF}",
|
28
30
|
Regexp::EXTENDED
|
29
31
|
)
|
30
32
|
|
@@ -33,11 +35,11 @@ module DefMastership
|
|
33
35
|
|
34
36
|
VARIABLE_USE = /{(?<varname>[\w:_-]+)}/x.freeze
|
35
37
|
|
36
|
-
EREF_CONFIG = /^\s*:eref-(?<
|
38
|
+
EREF_CONFIG = /^\s*:eref-(?<reference>[\w:_-]+)-(?<symb>prefix|url):\s*
|
37
39
|
\s*(?<value>\S.*\S)\s*/x.freeze
|
38
40
|
EREF_DEF = /^\s*
|
39
41
|
defs:eref\[
|
40
|
-
\s*(?<
|
42
|
+
\s*(?<reference>[\w:_-]+)\s*,
|
41
43
|
\s*\[\s*(?<extrefs>[^\]]+?)\s*\]\s*\]/x.freeze
|
42
44
|
BLOCK = /^--\s*$/.freeze
|
43
45
|
|
@@ -76,8 +76,8 @@ module DefMastership
|
|
76
76
|
explicit_checksum unless explicit_checksum.eql?(sha256_short)
|
77
77
|
end
|
78
78
|
|
79
|
-
def add_eref(
|
80
|
-
eref[
|
79
|
+
def add_eref(ref, extrefs)
|
80
|
+
eref[ref] = extrefs.strip.split(/\s*,\s*/)
|
81
81
|
end
|
82
82
|
|
83
83
|
def add_iref(ref)
|
@@ -23,22 +23,18 @@ module DefMastership
|
|
23
23
|
definition = Definition.new(matching_line.match)
|
24
24
|
labels.merge(definition.labels)
|
25
25
|
definitions << definition
|
26
|
-
matching_line.line
|
27
26
|
},
|
28
27
|
add_line: lambda { |matching_line|
|
29
28
|
line = matching_line.line
|
30
29
|
definitions.last << line
|
31
|
-
line
|
32
30
|
},
|
33
31
|
new_eref_setup: lambda { |matching_line|
|
34
|
-
|
35
|
-
eref[
|
36
|
-
eref[
|
37
|
-
matching_line.line
|
32
|
+
reference = matching_line[:reference].to_sym
|
33
|
+
eref[reference] ||= {}
|
34
|
+
eref[reference][matching_line[:symb].to_sym] = matching_line[:value]
|
38
35
|
},
|
39
36
|
new_eref_def: lambda { |matching_line|
|
40
|
-
definitions.last.add_eref(matching_line[:
|
41
|
-
matching_line.line
|
37
|
+
definitions.last.add_eref(matching_line[:reference].to_sym, matching_line[:extrefs])
|
42
38
|
},
|
43
39
|
new_iref_def: lambda { |matching_line|
|
44
40
|
self.iref = true
|
@@ -46,19 +42,15 @@ module DefMastership
|
|
46
42
|
line.scan(DMRegexp::IREF_DEF) do |_|
|
47
43
|
definitions.last.add_iref(Regexp.last_match[:intref])
|
48
44
|
end
|
49
|
-
line
|
50
45
|
},
|
51
46
|
new_attribute_conf: lambda { |matching_line|
|
52
47
|
attributes[matching_line[:attr].to_sym] = matching_line[:prefix]
|
53
|
-
matching_line.line
|
54
48
|
},
|
55
49
|
new_attribute_value: lambda { |matching_line|
|
56
50
|
definitions.last.set_attribute(matching_line[:attr].to_sym, matching_line[:value])
|
57
|
-
matching_line.line
|
58
51
|
},
|
59
52
|
new_variable_def: lambda { |matching_line|
|
60
53
|
variables[matching_line[:varname].to_sym] = matching_line[:value]
|
61
|
-
matching_line.line
|
62
54
|
},
|
63
55
|
new_variable_use: lambda { |matching_line|
|
64
56
|
line = matching_line.line
|
@@ -125,8 +117,8 @@ module DefMastership
|
|
125
117
|
PARSER_ACTIONS.key?(method_name)
|
126
118
|
end
|
127
119
|
|
128
|
-
def ref_to_def(
|
129
|
-
definitions.find { |definition| definition.reference ==
|
120
|
+
def ref_to_def(reference)
|
121
|
+
definitions.find { |definition| definition.reference == reference }
|
130
122
|
end
|
131
123
|
|
132
124
|
def iref=(value)
|