defmastership 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.rspec +4 -0
  4. data/.rubocop.yml +63 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +140 -0
  7. data/README.rdoc +6 -0
  8. data/Rakefile +53 -0
  9. data/bin/defmastership +99 -0
  10. data/config/devtools.yml +2 -0
  11. data/config/flay.yml +3 -0
  12. data/config/flog.yml +2 -0
  13. data/config/mutant.yml +6 -0
  14. data/config/reek.yml +106 -0
  15. data/config/rubocop.yml +44 -0
  16. data/config/yardstick.yml +2 -0
  17. data/defmastership.gemspec +37 -0
  18. data/defmastership.rdoc +5 -0
  19. data/features/changeref.feature +296 -0
  20. data/features/defmastership.feature +8 -0
  21. data/features/export.feature +275 -0
  22. data/features/step_definitions/defmastership_steps.rb +8 -0
  23. data/features/support/env.rb +18 -0
  24. data/lib/defmastership.rb +15 -0
  25. data/lib/defmastership/batch_changer.rb +40 -0
  26. data/lib/defmastership/comment_filter.rb +42 -0
  27. data/lib/defmastership/constants.rb +77 -0
  28. data/lib/defmastership/csv_formatter.rb +42 -0
  29. data/lib/defmastership/csv_formatter_body.rb +34 -0
  30. data/lib/defmastership/csv_formatter_header.rb +35 -0
  31. data/lib/defmastership/definition.rb +41 -0
  32. data/lib/defmastership/document.rb +153 -0
  33. data/lib/defmastership/project_ref_changer.rb +27 -0
  34. data/lib/defmastership/ref_changer.rb +102 -0
  35. data/lib/defmastership/version.rb +6 -0
  36. data/spec/spec_helper.rb +35 -0
  37. data/spec/unit/defmastership/batch_changer_spec.rb +108 -0
  38. data/spec/unit/defmastership/comment_filter_spec.rb +121 -0
  39. data/spec/unit/defmastership/csv_formatter_body_spec.rb +167 -0
  40. data/spec/unit/defmastership/csv_formatter_header_spec.rb +100 -0
  41. data/spec/unit/defmastership/csv_formatter_spec.rb +171 -0
  42. data/spec/unit/defmastership/definition_spec.rb +110 -0
  43. data/spec/unit/defmastership/document_spec.rb +398 -0
  44. data/spec/unit/defmastership/project_ref_changer_spec.rb +79 -0
  45. data/spec/unit/defmastership/ref_changer_spec.rb +205 -0
  46. data/spec/unit/defmastership_spec.rb +7 -0
  47. metadata +234 -0
@@ -0,0 +1,44 @@
1
+ inherit_from: ../.rubocop.yml
2
+
3
+ require:
4
+ - rubocop-rspec
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.5.0
8
+
9
+ Metrics/BlockLength:
10
+ Exclude:
11
+ # Ignore RSpec DSL
12
+ - spec/**/*
13
+ # Ignore gemspec DSL
14
+ - '*.gemspec'
15
+
16
+ # Naming/FileName:
17
+ # Exclude:
18
+ # - Rakefile
19
+
20
+ # Avoid more than `Max` levels of nesting.
21
+ BlockNesting:
22
+ Max: 3
23
+
24
+ # Align with the style guide.
25
+ CollectionMethods:
26
+ PreferredMethods:
27
+ collect: 'map'
28
+ inject: 'reduce'
29
+ find: 'detect'
30
+ find_all: 'sélect'
31
+
32
+ # Prefer #kind_of? over #is_a?
33
+ ClassCheck:
34
+ EnforcedStyle: kind_of?
35
+
36
+ Security/Eval:
37
+ Exclude:
38
+ - Rakefile
39
+
40
+ AlignHash:
41
+ EnforcedColonStyle: table
42
+
43
+ MessageSpies:
44
+ EnforcedStyle: receive
@@ -0,0 +1,2 @@
1
+ ---
2
+ threshold: 100
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Ensure we require the local version and not one we might have
4
+ # installed already
5
+ require(File.join([
6
+ File.dirname(__FILE__),
7
+ 'lib',
8
+ 'defmastership',
9
+ 'version.rb'
10
+ ]))
11
+ Gem::Specification.new do |s|
12
+ s.required_ruby_version = '>= 2.6'
13
+ s.name = 'defmastership'
14
+ s.version = DefMastership::VERSION
15
+ s.author = 'Jérôme Arbez-Gindre'
16
+ s.email = 'jeromearbezgindre@gmail.com'
17
+ s.licenses = 'Nonstandard'
18
+ s.homepage = 'http://your.website.com'
19
+ s.platform = Gem::Platform::RUBY
20
+ s.summary = 'Handling of references and definitions with asciidoctor'
21
+ s.files = `git ls-files`.split("\n")
22
+ s.require_paths << 'lib'
23
+ s.extra_rdoc_files = ['README.rdoc', 'defmastership.rdoc']
24
+ s.rdoc_options << '--title defmastership' << '--main README.rdoc' << '-ri'
25
+ s.bindir = 'bin'
26
+ s.executables << 'defmastership'
27
+ s.add_development_dependency('aruba', '~> 1')
28
+ s.add_development_dependency('rake', '~> 13')
29
+ s.add_development_dependency('rdoc', '~> 6')
30
+ s.add_development_dependency('rspec', '~> 3')
31
+ s.add_development_dependency('rubocop', '~> 0')
32
+ s.add_development_dependency('rubocop-rspec', '~> 1')
33
+ s.add_development_dependency('simplecov', '~> 0')
34
+ s.add_runtime_dependency('aasm', '~> 5')
35
+ s.add_runtime_dependency('asciidoctor', '~> 2')
36
+ s.add_runtime_dependency('gli', '~> 2')
37
+ end
@@ -0,0 +1,5 @@
1
+ = defmastership
2
+
3
+ Generate this with
4
+ defmastership _doc
5
+ After you have described your command line interface
@@ -0,0 +1,296 @@
1
+ Feature: The changeref command
2
+ As a Responsible of definitions for a giventdocument
3
+ In order to make references reliable
4
+ I want defmastership to change reference for asciidoctor documents
5
+
6
+ Scenario: Change a definition
7
+ Given a file named "changeref.yaml" with:
8
+ """
9
+ ---
10
+ :toto:
11
+ :from_regexp: TOTO-TEMP-[X\d]{4}
12
+ :to_template: TOTO-%<next_ref>04d
13
+ :next_ref: 123
14
+ """
15
+ And a file named "thedoc.adoc" with:
16
+ """
17
+ [define, requirement, TOTO-TEMP-XXX1]
18
+ """
19
+ When I run `defmastership changeref thedoc.adoc`
20
+ Then the stdout should not contain anything
21
+ And the stderr should not contain anything
22
+ And the file "changeref.yaml" should contain:
23
+ """
24
+ ---
25
+ :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
58
+ """
59
+ And the file "thedoc.adoc" should contain:
60
+ """
61
+ [define, requirement, TOTO-0123]
62
+ """
63
+
64
+ Scenario: Change two definitions
65
+ Given a file named "changeref.yaml" with:
66
+ """
67
+ ---
68
+ :toto:
69
+ :from_regexp: TOTO-TEMP-[X\d]{4}
70
+ :to_template: TOTO-%<next_ref>04d
71
+ :next_ref: 123
72
+ """
73
+ And a file named "thedoc.adoc" with:
74
+ """
75
+ [define, requirement, TOTO-TEMP-XXX1]
76
+ [define, requirement, TOTO-TEMP-XXX2]
77
+ """
78
+ When I run `defmastership changeref thedoc.adoc`
79
+ Then the stdout should not contain anything
80
+ And the stderr should not contain anything
81
+ And the file "changeref.yaml" should contain:
82
+ """
83
+ ---
84
+ :toto:
85
+ :from_regexp: TOTO-TEMP-[X\d]{4}
86
+ :to_template: TOTO-%<next_ref>04d
87
+ :next_ref: 125
88
+ """
89
+ And the file "thedoc.adoc" should contain:
90
+ """
91
+ [define, requirement, TOTO-0123]
92
+ [define, requirement, TOTO-0124]
93
+ """
94
+
95
+ Scenario: Generate a table with changess
96
+ Given a file named "changeref.yaml" with:
97
+ """
98
+ ---
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
+ :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
131
+ """
132
+ And a file named "thedoc.adoc" with:
133
+ """
134
+ [define, requirement, TOTO-TEMP-XXX1]
135
+ [define, requirement, TITI-TEMP-XXX2]
136
+ """
137
+ When I run `defmastership changeref thedoc.adoc`
138
+ Then the stdout should not contain anything
139
+ And the stderr should not contain anything
140
+ And the file "changeref.yaml" should contain:
141
+ """
142
+ ---
143
+ :toto:
144
+ :from_regexp: TOTO-TEMP-[X\d]{4}
145
+ :to_template: TOTO-%<next_ref>04d
146
+ :next_ref: 124
147
+ :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
151
+ """
152
+ And the file "thedoc.adoc" should contain:
153
+ """
154
+ [define, requirement, TOTO-0123]
155
+ [define, requirement, TITI-0000432]
156
+ """
157
+
158
+ Scenario: Change definitions in two files
159
+ Given a file named "changeref.yaml" with:
160
+ """
161
+ ---
162
+ :toto:
163
+ :from_regexp: TOTO-TEMP-[X\d]{4}
164
+ :to_template: TOTO-%<next_ref>04d
165
+ :next_ref: 123
166
+ """
167
+ And a file named "thedoc.adoc" with:
168
+ """
169
+ [define, requirement, TOTO-TEMP-XXX1]
170
+ """
171
+ And a file named "thedoc2.adoc" with:
172
+ """
173
+ [define, requirement, TOTO-TEMP-XXX2]
174
+ """
175
+ When I run `defmastership changeref thedoc.adoc thedoc2.adoc`
176
+ Then the stdout should not contain anything
177
+ And the stderr should not contain anything
178
+ And the file "changeref.yaml" should contain:
179
+ """
180
+ ---
181
+ :toto:
182
+ :from_regexp: TOTO-TEMP-[X\d]{4}
183
+ :to_template: TOTO-%<next_ref>04d
184
+ :next_ref: 125
185
+ """
186
+ And the file "thedoc.adoc" should contain:
187
+ """
188
+ [define, requirement, TOTO-0123]
189
+ """
190
+ And the file "thedoc2.adoc" should contain:
191
+ """
192
+ [define, requirement, TOTO-0124]
193
+ """
194
+
195
+ Scenario: Change a internal refs
196
+ Given a file named "changeref.yaml" with:
197
+ """
198
+ ---
199
+ :toto:
200
+ :from_regexp: TOTO-TEMP-[X\d]{4}
201
+ :to_template: TOTO-%<next_ref>04d
202
+ :next_ref: 123
203
+ """
204
+ And a file named "thedoc.adoc" with:
205
+ """
206
+ [define, requirement, TOTO-TEMP-XXX1]
207
+ is the same as defs:iref[TOTO-TEMP-XXX2] and defs:iref[TOTO-TEMP-XXX1]
208
+ [define, requirement, TOTO-TEMP-XXX2]
209
+ is the same as defs:iref[TOTO-TEMP-XXX1]
210
+ """
211
+ When I run `defmastership changeref thedoc.adoc`
212
+ Then the stdout should not contain anything
213
+ And the stderr should not contain anything
214
+ And the file "thedoc.adoc" should contain:
215
+ """
216
+ [define, requirement, TOTO-0123]
217
+ is the same as defs:iref[TOTO-0124] and defs:iref[TOTO-0123]
218
+ [define, requirement, TOTO-0124]
219
+ is the same as defs:iref[TOTO-0123]
220
+ """
221
+
222
+ Scenario: Change definitions and iref in two files
223
+ Given a file named "changeref.yaml" with:
224
+ """
225
+ ---
226
+ :toto:
227
+ :from_regexp: TOTO-TEMP-[X\d]{4}
228
+ :to_template: TOTO-%<next_ref>04d
229
+ :next_ref: 123
230
+ """
231
+ And a file named "thedoc.adoc" with:
232
+ """
233
+ [define, requirement, TOTO-TEMP-XXX1]
234
+ defs:iref[TOTO-TEMP-XXX2]
235
+ """
236
+ And a file named "thedoc2.adoc" with:
237
+ """
238
+ [define, requirement, TOTO-TEMP-XXX2]
239
+ defs:iref[TOTO-TEMP-XXX1]
240
+ """
241
+ When I run `defmastership changeref thedoc.adoc thedoc2.adoc`
242
+ Then the stdout should not contain anything
243
+ 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
+ And the file "thedoc.adoc" should contain:
253
+ """
254
+ [define, requirement, TOTO-0123]
255
+ defs:iref[TOTO-0124]
256
+ """
257
+ And the file "thedoc2.adoc" should contain:
258
+ """
259
+ [define, requirement, TOTO-0124]
260
+ defs:iref[TOTO-0123]
261
+ """
262
+
263
+ Scenario: Do not change definitions when in literal
264
+ Given a file named "changeref.yaml" with:
265
+ """
266
+ ---
267
+ :toto:
268
+ :from_regexp: TOTO-TEMP-[X\d]{4}
269
+ :to_template: TOTO-%<next_ref>04d
270
+ :next_ref: 123
271
+ """
272
+ And a file named "thedoc.adoc" with:
273
+ """
274
+ ....
275
+ [define, requirement, TOTO-TEMP-XXX1]
276
+ ....
277
+ """
278
+ When I run `defmastership changeref thedoc.adoc`
279
+ Then the stdout should not contain anything
280
+ And the stderr should not contain anything
281
+ And the file "changeref.yaml" should contain:
282
+ """
283
+ ---
284
+ :toto:
285
+ :from_regexp: TOTO-TEMP-[X\d]{4}
286
+ :to_template: TOTO-%<next_ref>04d
287
+ :next_ref: 123
288
+ """
289
+ And the file "thedoc.adoc" should contain:
290
+ """
291
+ ....
292
+ [define, requirement, TOTO-TEMP-XXX1]
293
+ ....
294
+ """
295
+
296
+
@@ -0,0 +1,8 @@
1
+ Feature: My bootstrapped app kinda works
2
+ In order to get going on coding my awesome app
3
+ I want to have aruba and cucumber setup
4
+ So I don't have to do it myself
5
+
6
+ Scenario: App just runs
7
+ When I get help for "defmastership"
8
+ Then the exit status should be 0
@@ -0,0 +1,275 @@
1
+ Feature: The extract command
2
+ As a Responsible of definitions
3
+ In order to make statistics on definitions
4
+ I want defmastership to extract definitions from asciidoctor documents
5
+
6
+ Scenario: Extract one definition to CSV
7
+ Given a file named "toto.adoc" with:
8
+ """
9
+ [define, requirement, TOTO-0001]
10
+ --
11
+ Exemple of multiline requirement.
12
+ Second line.
13
+ --
14
+ """
15
+ When I run `defmastership export toto.adoc`
16
+ Then the file "toto.csv" should contain:
17
+ """
18
+ Type,Reference,Value
19
+ requirement,TOTO-0001,"Exemple of multiline requirement.
20
+ Second line."
21
+ """
22
+ And the stdout should not contain anything
23
+ And the stderr should not contain anything
24
+
25
+ Scenario: Extract one definition with variable to CSV
26
+ Given a file named "toto.adoc" with:
27
+ """
28
+ :my_variable-with-dash: Variable content
29
+ :variable2: Toto
30
+ [define, requirement, TOTO-0001]
31
+ --
32
+ Exemple of multiline requirement with variable: {my_variable-with-dash}.
33
+ {my_variable-with-dash} : {my_variable-with-dash} {variable2}.
34
+ Third line with {not_defined_variable}.
35
+ --
36
+ """
37
+ When I run `defmastership export toto.adoc`
38
+ Then the file "toto.csv" should contain:
39
+ """
40
+ Type,Reference,Value
41
+ requirement,TOTO-0001,"Exemple of multiline requirement with variable: Variable content.
42
+ Variable content : Variable content Toto.
43
+ Third line with {not_defined_variable}."
44
+ """
45
+ And the stdout should not contain anything
46
+ And the stderr should not contain anything
47
+
48
+
49
+ Scenario: Extract some definitions to CSV
50
+ Given a file named "toto.adoc" with:
51
+ """
52
+ [define, requirement, TOTO-0001]
53
+ --
54
+ Exemple of multiline requirement.
55
+ Second line.
56
+ --
57
+ [define, something_else, TOTO-0003]
58
+ only one paragraphe.
59
+ with two sentences.
60
+ --
61
+ ignored multiline.
62
+ Second line.
63
+ --
64
+ """
65
+ When I run `defmastership export toto.adoc`
66
+ Then the file "toto.csv" should contain:
67
+ """
68
+ Type,Reference,Value
69
+ requirement,TOTO-0001,"Exemple of multiline requirement.
70
+ Second line."
71
+ something_else,TOTO-0003,"only one paragraphe.\nwith two sentences."
72
+ """
73
+ And the file "toto.csv" should not contain:
74
+ """
75
+ ignored multiline
76
+ """
77
+ And the stdout should not contain anything
78
+ And the stderr should not contain anything
79
+
80
+ Scenario: Ignore definitions in literal block
81
+ Given a file named "toto.adoc" with:
82
+ """
83
+ [define, requirement, TOTO-0001]
84
+ --
85
+ Exemple of multiline requirement.
86
+ Second line.
87
+ --
88
+ ....
89
+ [define, something_else, TOTO-0003]
90
+ only one line
91
+ ....
92
+ """
93
+ When I run `defmastership export toto.adoc`
94
+ Then the file "toto.csv" should not contain:
95
+ """
96
+ something_else
97
+ """
98
+ And the stdout should not contain anything
99
+ And the stderr should not contain anything
100
+
101
+ Scenario: Ignore definitions in commment block
102
+ Given a file named "toto.adoc" with:
103
+ """
104
+ [define, requirement, TOTO-0001]
105
+ --
106
+ Exemple of multiline requirement.
107
+ Second line.
108
+ --
109
+ ////
110
+ [define, something_else, TOTO-0003]
111
+ only one line
112
+ ////
113
+ """
114
+ When I run `defmastership export toto.adoc`
115
+ Then the file "toto.csv" should not contain:
116
+ """
117
+ something_else
118
+ """
119
+ And the stdout should not contain anything
120
+ And the stderr should not contain anything
121
+
122
+ Scenario: Handle mixes comment and literal blocks
123
+ Given a file named "toto.adoc" with:
124
+ """
125
+ [define, requirement, TOTO-0001]
126
+ --
127
+ Exemple of multiline requirement.
128
+ Second line.
129
+ --
130
+ ////
131
+ [define, whatever, TOTO-0003]
132
+ ----
133
+ only one line
134
+ ////
135
+ [define, something_else, TOTO-0003]
136
+ """
137
+ When I run `defmastership export toto.adoc`
138
+ Then the file "toto.csv" should contain:
139
+ """
140
+ something_else
141
+ """
142
+ And the stdout should not contain anything
143
+ And the stderr should not contain anything
144
+
145
+ Scenario: Extract definition with labels
146
+ Given a file named "toto.adoc" with:
147
+ """
148
+ [define, requirement, TOTO-0001, [label1, label2]]
149
+ --
150
+ Exemple of multiline requirement.
151
+ Second line.
152
+ --
153
+ """
154
+ When I run `defmastership export toto.adoc`
155
+ Then the file "toto.csv" should contain:
156
+ """
157
+ Type,Reference,Value,Labels
158
+ requirement,TOTO-0001,"Exemple of multiline requirement.
159
+ Second line.","label1
160
+ label2"
161
+ """
162
+ And the stdout should not contain anything
163
+ And the stderr should not contain anything
164
+
165
+ Scenario: Extract one definition with external ref to CSV
166
+ Given a file named "toto.adoc" with:
167
+ """
168
+ :eref-implements-prefix: Participate to:
169
+ :eref-implements-url: ./the_other_document.html
170
+ [define, requirement, TOTO-0001]
171
+ --
172
+ Exemple of multiline requirement.
173
+ Second line.
174
+ --
175
+ defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
176
+ """
177
+ When I run `defmastership export toto.adoc`
178
+ Then the file "toto.csv" should contain:
179
+ """
180
+ Type,Reference,Value,Participate to: ./the_other_document.html
181
+ requirement,TOTO-0001,"Exemple of multiline requirement.
182
+ Second line.","SYSTEM-0012
183
+ SYSTEM-0014"
184
+ """
185
+ And the stdout should not contain anything
186
+ And the stderr should not contain anything
187
+
188
+ Scenario: Extract one definition with external ref without url to CSV
189
+ Given a file named "toto.adoc" with:
190
+ """
191
+ :eref-implements-prefix: Participate to:
192
+ :eref-implements-url: none
193
+ [define, requirement, TOTO-0001]
194
+ --
195
+ Exemple of multiline requirement.
196
+ Second line.
197
+ --
198
+ defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
199
+ """
200
+ When I run `defmastership export toto.adoc`
201
+ Then the file "toto.csv" should contain:
202
+ """
203
+ Type,Reference,Value,Participate to:
204
+ requirement,TOTO-0001,"Exemple of multiline requirement.
205
+ Second line.","SYSTEM-0012
206
+ SYSTEM-0014"
207
+ """
208
+ And the stdout should not contain anything
209
+ And the stderr should not contain anything
210
+
211
+ Scenario: Extract one definition with external ref to CSV without URL
212
+ Given a file named "toto.adoc" with:
213
+ """
214
+ :eref-implements-prefix: Participate to:
215
+ [define, requirement, TOTO-0001]
216
+ --
217
+ Exemple of multiline requirement.
218
+ Second line.
219
+ --
220
+ defs:eref[implements, [SYSTEM-0012, SYSTEM-0014]]
221
+ """
222
+ When I run `defmastership export toto.adoc`
223
+ Then the stdout should not contain anything
224
+ And the stderr should not contain anything
225
+ And the file "toto.csv" should contain:
226
+ """
227
+ Type,Reference,Value,Participate to:
228
+ requirement,TOTO-0001,"Exemple of multiline requirement.
229
+ Second line.","SYSTEM-0012
230
+ SYSTEM-0014"
231
+ """
232
+
233
+ Scenario: Extract one definition with internal ref to CSV
234
+ Given a file named "toto.adoc" with:
235
+ """
236
+ [define, requirement, TOTO-0001]
237
+ --
238
+ Exemple of multiline requirement.
239
+ Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123].
240
+ --
241
+ please see defs:iref[TOTO-0002]
242
+ """
243
+ When I run `defmastership export toto.adoc`
244
+ Then the file "toto.csv" should contain:
245
+ """
246
+ Type,Reference,Value,Internal links
247
+ requirement,TOTO-0001,"Exemple of multiline requirement.
248
+ Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123].","TOTO-0001
249
+ TOTO-0123
250
+ TOTO-0002"
251
+ """
252
+ And the stdout should not contain anything
253
+ And the stderr should not contain anything
254
+
255
+ Scenario: Extract one definition with attributes to CSV
256
+ Given a file named "toto.adoc" with:
257
+ """
258
+ :attr-verifiedby-prefix: Verified by:
259
+ :attr-criticity-prefix: Criticity:
260
+ [define, requirement, TOTO-0001]
261
+ One single line.
262
+
263
+ something else.
264
+ defs:attribute[verifiedby, Beautiful Test]
265
+ defs:attribute[criticity, Very cool]
266
+ """
267
+ When I run `defmastership export toto.adoc`
268
+ And the stdout should not contain anything
269
+ Then the file "toto.csv" should contain:
270
+ """
271
+ Type,Reference,Value,Verified by:,Criticity:
272
+ requirement,TOTO-0001,One single line.,Beautiful Test,Very cool
273
+ """
274
+ And the stdout should not contain anything
275
+ And the stderr should not contain anything