defmastership 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.gitlab-ci.yml +0 -1
- data/Rakefile +1 -2
- data/bin/defmastership +3 -2
- data/cucumber.yml +2 -0
- data/defmastership.gemspec +2 -2
- data/features/export.feature +17 -0
- data/lib/defmastership/csv_formatter.rb +3 -2
- data/lib/defmastership/version.rb +1 -1
- data/spec/unit/defmastership/csv_formatter_spec.rb +4 -4
- metadata +10 -10
- data/Gemfile.lock +0 -140
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a306f9f76179edc5687278ed6a5c1c1c2b3943ad01cd3925cdcb7d7e1466ac2
|
4
|
+
data.tar.gz: dc3afb4b34d6e64e41ff0207242518317e3fe7615474ec17ca87f378436014df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6434c67db6ccf69c1f837b0ac664512d06563ded9d22faf9a890585ae3e2c3b072d10740fbaba91a23075244a21101801e1366e41ef2fe348c070dfb3467f92f
|
7
|
+
data.tar.gz: 6c511e6138122b454a69a0a2ba27c51abb28b55d09ce0b0a39652a91927f4cd29f2ea015407ff7f4d9f9c9e9eee297e5f43955528fccd1a07fc7caaee48c2a0e
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
CHANGED
data/Rakefile
CHANGED
data/bin/defmastership
CHANGED
@@ -51,7 +51,8 @@ module DefMastership
|
|
51
51
|
desc 'Export the definition database in CSV'
|
52
52
|
arg_name 'asciidoctor_files'
|
53
53
|
command :export do |c|
|
54
|
-
c.
|
54
|
+
c.flag(%i[separator sep s], default_value: ',', desc: 'CSV separator')
|
55
|
+
c.action do |_global_options, options, args|
|
55
56
|
doc = Asciidoctor.load_file(args[0], safe: :unsafe, parse: false)
|
56
57
|
# FIXME: also escape ifdef, ifndef, ifeval and endif directives
|
57
58
|
# FIXME: do this more carefully by reading line by line; if input
|
@@ -62,7 +63,7 @@ module DefMastership
|
|
62
63
|
|
63
64
|
output_file = args[0].sub(/\.adoc$/, '.csv')
|
64
65
|
|
65
|
-
DefMastership::CSVFormatter.new(my_doc).export_to(output_file)
|
66
|
+
DefMastership::CSVFormatter.new(my_doc, options['separator']).export_to(output_file)
|
66
67
|
end
|
67
68
|
end
|
68
69
|
|
data/cucumber.yml
ADDED
data/defmastership.gemspec
CHANGED
@@ -29,8 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.add_development_dependency('rake', '~> 13')
|
30
30
|
s.add_development_dependency('rdoc', '~> 6')
|
31
31
|
s.add_development_dependency('rspec', '~> 3')
|
32
|
-
s.add_development_dependency('rubocop', '
|
33
|
-
s.add_development_dependency('rubocop-rspec', '~>
|
32
|
+
s.add_development_dependency('rubocop', '~> 1.3')
|
33
|
+
s.add_development_dependency('rubocop-rspec', '~> 2.0')
|
34
34
|
s.add_development_dependency('simplecov', '~> 0')
|
35
35
|
s.add_runtime_dependency('aasm', '~> 5')
|
36
36
|
s.add_runtime_dependency('asciidoctor', '~> 2')
|
data/features/export.feature
CHANGED
@@ -22,6 +22,23 @@ Feature: The extract command
|
|
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 run `defmastership export --separator=';' toto.adoc`
|
35
|
+
Then the file "toto.csv" should contain:
|
36
|
+
"""
|
37
|
+
Type;Reference;Value
|
38
|
+
requirement;TOTO-0001;"Exemple of multiline requirement.
|
39
|
+
Second line."
|
40
|
+
"""
|
41
|
+
|
25
42
|
Scenario: Extract one definition with variable to CSV
|
26
43
|
Given a file named "toto.adoc" with:
|
27
44
|
"""
|
@@ -11,14 +11,15 @@ module DefMastership
|
|
11
11
|
COLUMN_LIST = %w[fixed labels eref iref attributes].freeze
|
12
12
|
private_constant :COLUMN_LIST
|
13
13
|
|
14
|
-
def initialize(doc)
|
14
|
+
def initialize(doc, sep = ',')
|
15
15
|
@doc = doc
|
16
|
+
@sep = sep
|
16
17
|
@header_formatter = CSVFormatterHeader.new(@doc)
|
17
18
|
@body_formatter = CSVFormatterBody.new(@doc)
|
18
19
|
end
|
19
20
|
|
20
21
|
def export_to(output_file)
|
21
|
-
CSV.open(output_file, 'w:ISO-8859-1') do |csv|
|
22
|
+
CSV.open(output_file, 'w:ISO-8859-1', { col_sep: @sep }) do |csv|
|
22
23
|
csv << header
|
23
24
|
@doc.definitions.each { |definition| csv << body(definition) }
|
24
25
|
end
|
@@ -5,7 +5,7 @@ require('defmastership')
|
|
5
5
|
require('ostruct')
|
6
6
|
|
7
7
|
RSpec.describe(DefMastership::CSVFormatter) do
|
8
|
-
subject(:formatter) { described_class.new(document) }
|
8
|
+
subject(:formatter) { described_class.new(document, ';') }
|
9
9
|
|
10
10
|
let(:document) { instance_double(DefMastership::Document, 'document') }
|
11
11
|
|
@@ -162,9 +162,9 @@ RSpec.describe(DefMastership::CSVFormatter) do
|
|
162
162
|
|
163
163
|
it do
|
164
164
|
expect(target_file).to(have_file_content(<<~CSV_FILE))
|
165
|
-
Type
|
166
|
-
a
|
167
|
-
d
|
165
|
+
Type;Reference;Value
|
166
|
+
a;b;c
|
167
|
+
d;e;f
|
168
168
|
CSV_FILE
|
169
169
|
end
|
170
170
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: defmastership
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérôme Arbez-Gindre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -70,30 +70,30 @@ dependencies:
|
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rubocop-rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '2.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '2.0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,7 +164,6 @@ files:
|
|
164
164
|
- ".rspec"
|
165
165
|
- ".rubocop.yml"
|
166
166
|
- Gemfile
|
167
|
-
- Gemfile.lock
|
168
167
|
- LICENSE
|
169
168
|
- README.rdoc
|
170
169
|
- Rakefile
|
@@ -176,6 +175,7 @@ files:
|
|
176
175
|
- config/reek.yml
|
177
176
|
- config/rubocop.yml
|
178
177
|
- config/yardstick.yml
|
178
|
+
- cucumber.yml
|
179
179
|
- defmastership.gemspec
|
180
180
|
- defmastership.rdoc
|
181
181
|
- features/changeref.feature
|
@@ -229,7 +229,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
229
229
|
- !ruby/object:Gem::Version
|
230
230
|
version: '0'
|
231
231
|
requirements: []
|
232
|
-
rubygems_version: 3.1
|
232
|
+
rubygems_version: 3.2.0.rc.1
|
233
233
|
signing_key:
|
234
234
|
specification_version: 4
|
235
235
|
summary: Handling of references and definitions with asciidoctor
|
data/Gemfile.lock
DELETED
@@ -1,140 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
defmastership (1.0.4)
|
5
|
-
aasm (~> 5)
|
6
|
-
asciidoctor (~> 2)
|
7
|
-
gli (~> 2)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
aasm (5.1.1)
|
13
|
-
concurrent-ruby (~> 1.0)
|
14
|
-
activesupport (6.0.3.3)
|
15
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>= 0.7, < 2)
|
17
|
-
minitest (~> 5.1)
|
18
|
-
tzinfo (~> 1.1)
|
19
|
-
zeitwerk (~> 2.2, >= 2.2.2)
|
20
|
-
aruba (1.0.3)
|
21
|
-
childprocess (>= 2.0, < 5.0)
|
22
|
-
contracts (~> 0.16.0)
|
23
|
-
cucumber (>= 2.4, < 6.0)
|
24
|
-
ffi (~> 1.9)
|
25
|
-
rspec-expectations (~> 3.4)
|
26
|
-
thor (~> 1.0)
|
27
|
-
asciidoctor (2.0.10)
|
28
|
-
ast (2.4.1)
|
29
|
-
builder (3.2.4)
|
30
|
-
childprocess (4.0.0)
|
31
|
-
concurrent-ruby (1.1.7)
|
32
|
-
contracts (0.16.0)
|
33
|
-
cucumber (5.1.1)
|
34
|
-
builder (~> 3.2, >= 3.2.4)
|
35
|
-
cucumber-core (~> 8.0, >= 8.0.1)
|
36
|
-
cucumber-create-meta (~> 2.0, >= 2.0.2)
|
37
|
-
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
38
|
-
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
39
|
-
cucumber-html-formatter (~> 9.0, >= 9.0.0)
|
40
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
41
|
-
cucumber-wire (~> 4.0, >= 4.0.1)
|
42
|
-
diff-lcs (~> 1.4, >= 1.4.4)
|
43
|
-
multi_test (~> 0.1, >= 0.1.2)
|
44
|
-
sys-uname (~> 1.2, >= 1.2.1)
|
45
|
-
cucumber-core (8.0.1)
|
46
|
-
cucumber-gherkin (~> 15.0, >= 15.0.2)
|
47
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
48
|
-
cucumber-tag-expressions (~> 2.0, >= 2.0.4)
|
49
|
-
cucumber-create-meta (2.0.2)
|
50
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
51
|
-
sys-uname (~> 1.2, >= 1.2.1)
|
52
|
-
cucumber-cucumber-expressions (10.3.0)
|
53
|
-
cucumber-gherkin (15.0.2)
|
54
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
55
|
-
cucumber-html-formatter (9.0.0)
|
56
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
57
|
-
cucumber-messages (13.1.0)
|
58
|
-
protobuf-cucumber (~> 3.10, >= 3.10.8)
|
59
|
-
cucumber-tag-expressions (2.0.4)
|
60
|
-
cucumber-wire (4.0.1)
|
61
|
-
cucumber-core (~> 8.0, >= 8.0.1)
|
62
|
-
cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
|
63
|
-
cucumber-messages (~> 13.0, >= 13.0.1)
|
64
|
-
diff-lcs (1.4.4)
|
65
|
-
docile (1.3.2)
|
66
|
-
ffi (1.13.1)
|
67
|
-
gli (2.19.2)
|
68
|
-
i18n (1.8.5)
|
69
|
-
concurrent-ruby (~> 1.0)
|
70
|
-
middleware (0.1.0)
|
71
|
-
minitest (5.14.2)
|
72
|
-
multi_test (0.1.2)
|
73
|
-
parallel (1.19.2)
|
74
|
-
parser (2.7.1.4)
|
75
|
-
ast (~> 2.4.1)
|
76
|
-
protobuf-cucumber (3.10.8)
|
77
|
-
activesupport (>= 3.2)
|
78
|
-
middleware
|
79
|
-
thor
|
80
|
-
thread_safe
|
81
|
-
rainbow (3.0.0)
|
82
|
-
rake (13.0.1)
|
83
|
-
rdoc (6.2.1)
|
84
|
-
regexp_parser (1.7.1)
|
85
|
-
rexml (3.2.4)
|
86
|
-
rspec (3.9.0)
|
87
|
-
rspec-core (~> 3.9.0)
|
88
|
-
rspec-expectations (~> 3.9.0)
|
89
|
-
rspec-mocks (~> 3.9.0)
|
90
|
-
rspec-core (3.9.2)
|
91
|
-
rspec-support (~> 3.9.3)
|
92
|
-
rspec-expectations (3.9.2)
|
93
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
94
|
-
rspec-support (~> 3.9.0)
|
95
|
-
rspec-mocks (3.9.1)
|
96
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
97
|
-
rspec-support (~> 3.9.0)
|
98
|
-
rspec-support (3.9.3)
|
99
|
-
rubocop (0.91.0)
|
100
|
-
parallel (~> 1.10)
|
101
|
-
parser (>= 2.7.1.1)
|
102
|
-
rainbow (>= 2.2.2, < 4.0)
|
103
|
-
regexp_parser (>= 1.7)
|
104
|
-
rexml
|
105
|
-
rubocop-ast (>= 0.4.0, < 1.0)
|
106
|
-
ruby-progressbar (~> 1.7)
|
107
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
108
|
-
rubocop-ast (0.4.1)
|
109
|
-
parser (>= 2.7.1.4)
|
110
|
-
rubocop-rspec (1.43.2)
|
111
|
-
rubocop (~> 0.87)
|
112
|
-
ruby-progressbar (1.10.1)
|
113
|
-
simplecov (0.19.0)
|
114
|
-
docile (~> 1.1)
|
115
|
-
simplecov-html (~> 0.11)
|
116
|
-
simplecov-html (0.12.2)
|
117
|
-
sys-uname (1.2.1)
|
118
|
-
ffi (>= 1.0.0)
|
119
|
-
thor (1.0.1)
|
120
|
-
thread_safe (0.3.6)
|
121
|
-
tzinfo (1.2.7)
|
122
|
-
thread_safe (~> 0.1)
|
123
|
-
unicode-display_width (1.7.0)
|
124
|
-
zeitwerk (2.4.0)
|
125
|
-
|
126
|
-
PLATFORMS
|
127
|
-
ruby
|
128
|
-
|
129
|
-
DEPENDENCIES
|
130
|
-
aruba (~> 1)
|
131
|
-
defmastership!
|
132
|
-
rake (~> 13)
|
133
|
-
rdoc (~> 6)
|
134
|
-
rspec (~> 3)
|
135
|
-
rubocop (= 0.91)
|
136
|
-
rubocop-rspec (~> 1)
|
137
|
-
simplecov (~> 0)
|
138
|
-
|
139
|
-
BUNDLED WITH
|
140
|
-
2.1.4
|