defmastership 1.0.7 → 1.0.8
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.
- checksums.yaml +4 -4
- data/bin/defmastership +1 -1
- data/features/{checksum.feature → definition_checksum.feature} +31 -31
- data/features/definition_version.feature +24 -0
- data/features/export.feature +21 -21
- data/features/modify.feature +23 -1
- data/lib/defmastership/batch_modifier.rb +2 -0
- data/lib/defmastership/constants.rb +2 -2
- data/lib/defmastership/csv_formatter.rb +12 -6
- data/lib/defmastership/csv_formatter_body.rb +8 -5
- data/lib/defmastership/csv_formatter_header.rb +5 -1
- data/lib/defmastership/definition.rb +4 -4
- data/lib/defmastership/document.rb +11 -15
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/defmastership/batch_modifier_spec.rb +8 -0
- data/spec/unit/defmastership/csv_formatter_body_spec.rb +42 -60
- data/spec/unit/defmastership/csv_formatter_header_spec.rb +23 -1
- data/spec/unit/defmastership/csv_formatter_spec.rb +204 -67
- data/spec/unit/defmastership/definition_spec.rb +19 -4
- data/spec/unit/defmastership/document_spec.rb +71 -4
- data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +4 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6fbf5098c8ab70e422d9c158c0a28cd876de25cfd159a131b0ddefc5f1eca86
|
4
|
+
data.tar.gz: 8717156666df342a45994bb455b0cc58f09fc1da9b31c48cd0d4b36a40c528b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6afcfd48186a2f89426e62007dc068711ea36e26a8ecf9b9c56428a351eabb6a89be58872a96de30c9a87ccdc71366e685fd8486469a3465e661ae490c0925be
|
7
|
+
data.tar.gz: 275587475f39f39bbd311cdf9a0fb1cc9cdcb30c6cf766b44d9b1ff64ac9a8feb2c9117f4903f8eb806b3e73594b6c2e5e63876038483429cabd7eb66fb93575
|
data/bin/defmastership
CHANGED
@@ -65,7 +65,7 @@ module DefMastership
|
|
65
65
|
my_doc.definitions.each do |definition|
|
66
66
|
next if definition.wrong_explicit_checksum.nil?
|
67
67
|
|
68
|
-
warn("
|
68
|
+
warn("warning: #{definition.reference} has a wrong explicit checksum (should be #{definition.sha256})")
|
69
69
|
end
|
70
70
|
exit 1 unless options[:"no-fail"]
|
71
71
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature: checksum
|
1
|
+
Feature: definition checksum
|
2
2
|
As a Responsible of definitions for a given document
|
3
3
|
In order to detect modifications of defintiions
|
4
4
|
I want defmastership to export and update checksum in definitions
|
@@ -6,69 +6,69 @@ Feature: checksum
|
|
6
6
|
Scenario: Extract one definition with WRONG explicit checksum to CSV
|
7
7
|
Given a file named "thedoc.adoc" with:
|
8
8
|
"""
|
9
|
-
[define, requirement, TOTO-0001(babe1234)]
|
9
|
+
[define, requirement, TOTO-0001(~babe1234)]
|
10
10
|
def one
|
11
11
|
"""
|
12
12
|
When I run `defmastership export thedoc.adoc`
|
13
13
|
Then it should fail with:
|
14
14
|
"""
|
15
|
-
|
15
|
+
warning: TOTO-0001 has a wrong explicit checksum (should be ~d27cb5c3)
|
16
16
|
"""
|
17
17
|
And the file "thedoc.csv" should contain:
|
18
18
|
"""
|
19
|
-
Type,Reference,Value,
|
20
|
-
requirement,TOTO-0001,def one
|
19
|
+
Type,Reference,Value,Checksum,Wrong explicit checksum
|
20
|
+
requirement,TOTO-0001,def one,~d27cb5c3,~babe1234
|
21
21
|
"""
|
22
22
|
And the stdout should not contain anything
|
23
23
|
|
24
24
|
Scenario: Extract two definitions with one WRONG explicit checksum to CSV
|
25
25
|
Given a file named "thedoc.adoc" with:
|
26
26
|
"""
|
27
|
-
[define, requirement, TOTO-0001(d27cb5c3)]
|
27
|
+
[define, requirement, TOTO-0001(~d27cb5c3)]
|
28
28
|
def one
|
29
29
|
|
30
|
-
[define, requirement, TOTO-0002(babe1234)]
|
30
|
+
[define, requirement, TOTO-0002(~babe1234)]
|
31
31
|
def two
|
32
32
|
"""
|
33
33
|
When I run `defmastership export thedoc.adoc`
|
34
34
|
Then it should fail with:
|
35
35
|
"""
|
36
|
-
|
36
|
+
warning: TOTO-0002 has a wrong explicit checksum (should be ~b80e1be5)
|
37
37
|
"""
|
38
38
|
Then the file "thedoc.csv" should contain:
|
39
39
|
"""
|
40
|
-
Type,Reference,Value,
|
41
|
-
requirement,TOTO-0001,def one
|
42
|
-
requirement,TOTO-0002,def two
|
40
|
+
Type,Reference,Value,Checksum,Wrong explicit checksum
|
41
|
+
requirement,TOTO-0001,def one,~d27cb5c3,\"\"
|
42
|
+
requirement,TOTO-0002,def two,~b80e1be5,~babe1234
|
43
43
|
"""
|
44
44
|
And the stdout should not contain anything
|
45
45
|
|
46
46
|
Scenario: Export not failing even if WRONG explicit checksum
|
47
47
|
Given a file named "thedoc.adoc" with:
|
48
48
|
"""
|
49
|
-
[define, requirement, TOTO-0001(d27cb5c3)]
|
49
|
+
[define, requirement, TOTO-0001(~d27cb5c3)]
|
50
50
|
def one
|
51
51
|
|
52
|
-
[define, requirement, TOTO-0002(babe1234)]
|
52
|
+
[define, requirement, TOTO-0002(~babe1234)]
|
53
53
|
def two
|
54
54
|
"""
|
55
55
|
When I successfully run `defmastership export --no-fail thedoc.adoc`
|
56
56
|
Then the file "thedoc.csv" should contain:
|
57
57
|
"""
|
58
|
-
Type,Reference,Value,
|
59
|
-
requirement,TOTO-0001,def one
|
60
|
-
requirement,TOTO-0002,def two
|
58
|
+
Type,Reference,Value,Checksum,Wrong explicit checksum
|
59
|
+
requirement,TOTO-0001,def one,~d27cb5c3,\"\"
|
60
|
+
requirement,TOTO-0002,def two,~b80e1be5,~babe1234
|
61
61
|
"""
|
62
62
|
And the stdout should not contain anything
|
63
63
|
And the stderr should contain:
|
64
64
|
"""
|
65
|
-
|
65
|
+
warning: TOTO-0002 has a wrong explicit checksum (should be ~b80e1be5)
|
66
66
|
"""
|
67
67
|
|
68
68
|
Scenario: Extract one definition with explicit checksum to CSV
|
69
69
|
Given a file named "thedoc.adoc" with:
|
70
70
|
"""
|
71
|
-
[define, requirement, TOTO-0001(b86dcbde)]
|
71
|
+
[define, requirement, TOTO-0001(~b86dcbde)]
|
72
72
|
--
|
73
73
|
Exemple of multiline requirement.
|
74
74
|
Second line.
|
@@ -77,9 +77,9 @@ Feature: checksum
|
|
77
77
|
When I successfully run `defmastership export thedoc.adoc`
|
78
78
|
Then the file "thedoc.csv" should contain:
|
79
79
|
"""
|
80
|
-
Type,Reference,Value,
|
80
|
+
Type,Reference,Value,Checksum
|
81
81
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
82
|
-
Second line."
|
82
|
+
Second line.",~b86dcbde
|
83
83
|
"""
|
84
84
|
And the stdout should not contain anything
|
85
85
|
And the stderr should not contain anything
|
@@ -105,7 +105,7 @@ Feature: checksum
|
|
105
105
|
And the stderr should not contain anything
|
106
106
|
And the file "thedoc.adoc" should contain:
|
107
107
|
"""
|
108
|
-
[define, requirement, TOTO-TEMP-XXX1(244eed18)]
|
108
|
+
[define, requirement, TOTO-TEMP-XXX1(~244eed18)]
|
109
109
|
--
|
110
110
|
the requirement value.
|
111
111
|
--
|
@@ -122,7 +122,7 @@ Feature: checksum
|
|
122
122
|
"""
|
123
123
|
And a file named "thedoc.adoc" with:
|
124
124
|
"""
|
125
|
-
[define, requirement, TOTO-TEMP-XXX1(abcd1234)]
|
125
|
+
[define, requirement, TOTO-TEMP-XXX1(~abcd1234)]
|
126
126
|
--
|
127
127
|
the requirement value.
|
128
128
|
--
|
@@ -132,7 +132,7 @@ Feature: checksum
|
|
132
132
|
And the stderr should not contain anything
|
133
133
|
And the file "thedoc.adoc" should contain:
|
134
134
|
"""
|
135
|
-
[define, requirement, TOTO-TEMP-XXX1(244eed18)]
|
135
|
+
[define, requirement, TOTO-TEMP-XXX1(~244eed18)]
|
136
136
|
--
|
137
137
|
the requirement value.
|
138
138
|
--
|
@@ -154,14 +154,14 @@ Feature: checksum
|
|
154
154
|
When I successfully run `defmastership export thedoc.adoc`
|
155
155
|
Then the file "thedoc.csv" should contain:
|
156
156
|
"""
|
157
|
-
Type,Reference,Value,
|
157
|
+
Type,Reference,Value,Checksum
|
158
158
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
159
|
-
Second line."
|
159
|
+
Second line.",~b86dcbde
|
160
160
|
"""
|
161
161
|
And the stdout should not contain anything
|
162
162
|
And the stderr should not contain anything
|
163
163
|
|
164
|
-
Scenario: Checksum is calculated on included file in ref
|
164
|
+
Scenario: Checksum is calculated on included file in ref modification
|
165
165
|
Given a file named "modifications.yml" with:
|
166
166
|
"""
|
167
167
|
---
|
@@ -185,7 +185,7 @@ Feature: checksum
|
|
185
185
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
186
186
|
Then the file "thedoc.adoc" should contain:
|
187
187
|
"""
|
188
|
-
[define, requirement, TOTO-0001(b86dcbde)]
|
188
|
+
[define, requirement, TOTO-0001(~b86dcbde)]
|
189
189
|
--
|
190
190
|
include::included.txt[]
|
191
191
|
--
|
@@ -206,14 +206,14 @@ Feature: checksum
|
|
206
206
|
When I successfully run `defmastership export thedoc.adoc`
|
207
207
|
Then the file "thedoc.csv" should contain:
|
208
208
|
"""
|
209
|
-
Type,Reference,Value,
|
209
|
+
Type,Reference,Value,Checksum
|
210
210
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
211
|
-
Second line."
|
211
|
+
Second line.",~b86dcbde
|
212
212
|
"""
|
213
213
|
And the stdout should not contain anything
|
214
214
|
And the stderr should not contain anything
|
215
215
|
|
216
|
-
Scenario: Checksum take into account variables in ref
|
216
|
+
Scenario: Checksum take into account variables in ref modification
|
217
217
|
Given a file named "modifications.yml" with:
|
218
218
|
"""
|
219
219
|
---
|
@@ -234,7 +234,7 @@ Feature: checksum
|
|
234
234
|
When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
|
235
235
|
Then the file "thedoc.adoc" should contain:
|
236
236
|
"""
|
237
|
-
[define, requirement, TOTO-0001(b86dcbde)]
|
237
|
+
[define, requirement, TOTO-0001(~b86dcbde)]
|
238
238
|
--
|
239
239
|
Exemple of {variable} requirement.
|
240
240
|
Second line.
|
@@ -0,0 +1,24 @@
|
|
1
|
+
Feature: definitions version
|
2
|
+
As a Responsible of definitions for a given document
|
3
|
+
In order to detect handle versions definitions
|
4
|
+
I want defmastership to export explicit versions in definitions
|
5
|
+
|
6
|
+
Scenario: Extract one definition with explicit version to CSV
|
7
|
+
Given a file named "thedoc.adoc" with:
|
8
|
+
"""
|
9
|
+
[define, requirement, TOTO-0001(pouet)]
|
10
|
+
--
|
11
|
+
Exemple of multiline requirement.
|
12
|
+
Second line.
|
13
|
+
--
|
14
|
+
"""
|
15
|
+
When I successfully run `defmastership export thedoc.adoc`
|
16
|
+
Then the file "thedoc.csv" should contain:
|
17
|
+
"""
|
18
|
+
Type,Reference,Value,Checksum,Version
|
19
|
+
requirement,TOTO-0001,"Exemple of multiline requirement.
|
20
|
+
Second line.",~b86dcbde,pouet
|
21
|
+
"""
|
22
|
+
And the stdout should not contain anything
|
23
|
+
And the stderr should not contain anything
|
24
|
+
|
data/features/export.feature
CHANGED
@@ -15,9 +15,9 @@ Feature: The extract command
|
|
15
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,Checksum
|
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
|
@@ -34,9 +34,9 @@ Feature: The extract command
|
|
34
34
|
When I successfully run `defmastership export --separator=';' toto.adoc`
|
35
35
|
Then the file "toto.csv" should contain:
|
36
36
|
"""
|
37
|
-
Type;Reference;Value;
|
37
|
+
Type;Reference;Value;Checksum
|
38
38
|
requirement;TOTO-0001;"Exemple of multiline requirement.
|
39
|
-
Second line."
|
39
|
+
Second line.";~b86dcbde
|
40
40
|
"""
|
41
41
|
|
42
42
|
Scenario: Extract one definition with variable to CSV
|
@@ -54,10 +54,10 @@ Feature: The extract command
|
|
54
54
|
When I successfully run `defmastership export toto.adoc`
|
55
55
|
Then the file "toto.csv" should contain:
|
56
56
|
"""
|
57
|
-
Type,Reference,Value,
|
57
|
+
Type,Reference,Value,Checksum
|
58
58
|
requirement,TOTO-0001,"Exemple of multiline requirement with variable: Variable content.
|
59
59
|
Variable content : Variable content Toto.
|
60
|
-
Third line with {not_defined_variable}."
|
60
|
+
Third line with {not_defined_variable}.",~3bf370ed
|
61
61
|
"""
|
62
62
|
And the stdout should not contain anything
|
63
63
|
And the stderr should not contain anything
|
@@ -82,11 +82,11 @@ Feature: The extract command
|
|
82
82
|
When I successfully run `defmastership export toto.adoc`
|
83
83
|
Then the file "toto.csv" should contain:
|
84
84
|
"""
|
85
|
-
Type,Reference,Value,
|
85
|
+
Type,Reference,Value,Checksum
|
86
86
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
87
|
-
Second line."
|
87
|
+
Second line.",~b86dcbde
|
88
88
|
something_else,TOTO-0003,"only one paragraphe.
|
89
|
-
with two sentences."
|
89
|
+
with two sentences.",~4761e172
|
90
90
|
"""
|
91
91
|
And the file "toto.csv" should not contain:
|
92
92
|
"""
|
@@ -172,9 +172,9 @@ Feature: The extract command
|
|
172
172
|
When I successfully run `defmastership export toto.adoc`
|
173
173
|
Then the file "toto.csv" should contain:
|
174
174
|
"""
|
175
|
-
Type,Reference,Value,
|
175
|
+
Type,Reference,Value,Checksum,Labels
|
176
176
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
177
|
-
Second line."
|
177
|
+
Second line.",~b86dcbde,"label1
|
178
178
|
label2"
|
179
179
|
"""
|
180
180
|
And the stdout should not contain anything
|
@@ -195,9 +195,9 @@ Feature: The extract command
|
|
195
195
|
When I successfully run `defmastership export toto.adoc`
|
196
196
|
Then the file "toto.csv" should contain:
|
197
197
|
"""
|
198
|
-
Type,Reference,Value,
|
198
|
+
Type,Reference,Value,Checksum,Participate to:
|
199
199
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
200
|
-
Second line."
|
200
|
+
Second line.",~b86dcbde,"SYSTEM-0012
|
201
201
|
SYSTEM-0014"
|
202
202
|
"""
|
203
203
|
And the stdout should not contain anything
|
@@ -218,9 +218,9 @@ Feature: The extract command
|
|
218
218
|
When I successfully run `defmastership export toto.adoc`
|
219
219
|
Then the file "toto.csv" should contain:
|
220
220
|
"""
|
221
|
-
Type,Reference,Value,
|
221
|
+
Type,Reference,Value,Checksum,Participate to:
|
222
222
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
223
|
-
Second line."
|
223
|
+
Second line.",~b86dcbde,"SYSTEM-0012
|
224
224
|
SYSTEM-0014"
|
225
225
|
"""
|
226
226
|
And the stdout should not contain anything
|
@@ -242,9 +242,9 @@ Feature: The extract command
|
|
242
242
|
And the stderr should not contain anything
|
243
243
|
And the file "toto.csv" should contain:
|
244
244
|
"""
|
245
|
-
Type,Reference,Value,
|
245
|
+
Type,Reference,Value,Checksum,Participate to:
|
246
246
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
247
|
-
Second line."
|
247
|
+
Second line.",~b86dcbde,"SYSTEM-0012
|
248
248
|
SYSTEM-0014"
|
249
249
|
"""
|
250
250
|
|
@@ -261,9 +261,9 @@ Feature: The extract command
|
|
261
261
|
When I successfully run `defmastership export toto.adoc`
|
262
262
|
Then the file "toto.csv" should contain:
|
263
263
|
"""
|
264
|
-
Type,Reference,Value,
|
264
|
+
Type,Reference,Value,Checksum,Internal links
|
265
265
|
requirement,TOTO-0001,"Exemple of multiline requirement.
|
266
|
-
Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123]."
|
266
|
+
Second line: defs:iref[TOTO-0001], defs:iref[TOTO-0123].",~059b7188,"TOTO-0001
|
267
267
|
TOTO-0123
|
268
268
|
TOTO-0002"
|
269
269
|
"""
|
@@ -286,8 +286,8 @@ Feature: The extract command
|
|
286
286
|
And the stdout should not contain anything
|
287
287
|
Then the file "toto.csv" should contain:
|
288
288
|
"""
|
289
|
-
Type,Reference,Value,
|
290
|
-
requirement,TOTO-0001,One single line
|
289
|
+
Type,Reference,Value,Checksum,Verified by:,Criticity:
|
290
|
+
requirement,TOTO-0001,One single line.,~554b0ff5,Beautiful Test,Very cool
|
291
291
|
"""
|
292
292
|
And the stdout should not contain anything
|
293
293
|
And the stderr should not contain anything
|
data/features/modify.feature
CHANGED
@@ -3,7 +3,7 @@ Feature: The modify command
|
|
3
3
|
In order to manage to applu predefined modifications
|
4
4
|
I want defmastership to apply automatic modifications
|
5
5
|
|
6
|
-
Scenario:
|
6
|
+
Scenario: Changes with one modifier
|
7
7
|
Given a file named "modifications.yml" with:
|
8
8
|
"""
|
9
9
|
---
|
@@ -36,6 +36,28 @@ Feature: The modify command
|
|
36
36
|
[define, requirement, TOTO-0123]
|
37
37
|
"""
|
38
38
|
|
39
|
+
|
40
|
+
Scenario: Change with wrong modifier
|
41
|
+
Given a file named "modifications.yml" with:
|
42
|
+
"""
|
43
|
+
---
|
44
|
+
:temp-references:
|
45
|
+
:type: change_ref
|
46
|
+
:config:
|
47
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
48
|
+
:to_template: TOTO-%<next_ref>04d
|
49
|
+
:next_ref: 123
|
50
|
+
"""
|
51
|
+
And a file named "thedoc.adoc" with:
|
52
|
+
"""
|
53
|
+
[define, requirement, TOTO-TEMP-XXX1]
|
54
|
+
"""
|
55
|
+
When I run `defmastership modify --modifications wrong-modification thedoc.adoc`
|
56
|
+
Then it should fail with:
|
57
|
+
"""
|
58
|
+
error: wrong-modification is not a known modification
|
59
|
+
"""
|
60
|
+
|
39
61
|
Scenario: Make modifications with yaml file parameter
|
40
62
|
Given a file named "pouet.yml" with:
|
41
63
|
"""
|
@@ -26,6 +26,8 @@ module DefMastership
|
|
26
26
|
private
|
27
27
|
|
28
28
|
def modifier_from(modif)
|
29
|
+
raise(ArgumentError, "#{modif} is not a known modification") if @config[modif.to_sym].nil?
|
30
|
+
|
29
31
|
class_name = "#{@config[modif.to_sym][:type].split('_').map(&:capitalize).join}Modifier"
|
30
32
|
DefMastership.const_get(class_name).new(@config[modif.to_sym][:config])
|
31
33
|
end
|
@@ -20,10 +20,10 @@ module DefMastership
|
|
20
20
|
(,\s*\[\s*(?<labels>.*?)\s*\])?\s*\]
|
21
21
|
AFT
|
22
22
|
|
23
|
-
|
23
|
+
DEF_VERSION_AND_CHECKSUM = '(\((?<explicit_version>[^~]+)?(?<explicit_checksum>~[[:alnum:]]+)?\))?'
|
24
24
|
|
25
25
|
DEFINITION = Regexp.new(
|
26
|
-
"#{DEF_BEFORE_REF}(?<reference>[\\w:_-]+)#{
|
26
|
+
"#{DEF_BEFORE_REF}(?<reference>[\\w:_-]+)#{DEF_VERSION_AND_CHECKSUM}#{DEF_AFTER_REF}",
|
27
27
|
Regexp::EXTENDED
|
28
28
|
)
|
29
29
|
|
@@ -8,18 +8,13 @@ require('defmastership/csv_formatter_body')
|
|
8
8
|
module DefMastership
|
9
9
|
# to export a CSV file
|
10
10
|
class CSVFormatter
|
11
|
-
COLUMN_LIST1 = %i[fixed wrong_explicit_checksum labels eref iref attributes].freeze
|
12
|
-
COLUMN_LIST2 = %i[fixed labels eref iref attributes].freeze
|
13
|
-
private_constant :COLUMN_LIST1
|
14
|
-
private_constant :COLUMN_LIST2
|
15
|
-
|
16
11
|
def initialize(doc, sep = ',')
|
17
12
|
@doc = doc
|
18
13
|
@sep = sep
|
19
14
|
end
|
20
15
|
|
21
16
|
def export_to(output_file)
|
22
|
-
column_list =
|
17
|
+
column_list = build_column_list
|
23
18
|
CSV.open(output_file, 'w:ISO-8859-1', { col_sep: @sep }) do |csv|
|
24
19
|
csv << header(column_list)
|
25
20
|
@doc.definitions.each { |definition| csv << body(definition, column_list) }
|
@@ -39,5 +34,16 @@ module DefMastership
|
|
39
34
|
body_line = column_list.map { |part| body_formatter.public_send(part, definition) }
|
40
35
|
body_line.reduce(:+)
|
41
36
|
end
|
37
|
+
|
38
|
+
def build_column_list
|
39
|
+
column_list = [:fixed]
|
40
|
+
column_list += [:wrong_explicit_checksum] if @doc.wrong_explicit_checksum?
|
41
|
+
column_list += [:explicit_version] if @doc.explicit_version?
|
42
|
+
column_list += [:labels] unless @doc.labels.empty?
|
43
|
+
column_list += [:eref] unless @doc.eref.empty?
|
44
|
+
column_list += [:iref] if @doc.iref
|
45
|
+
column_list += [:attributes] unless @doc.attributes.empty?
|
46
|
+
column_list
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|