defmastership 1.0.1 → 1.0.6
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 +20 -0
- data/.rubocop.yml +5 -4
- data/Gemfile +1 -0
- data/LICENSE +22 -0
- data/Rakefile +2 -2
- data/bin/defmastership +25 -17
- data/cucumber.yml +2 -0
- data/defmastership.gemspec +18 -11
- data/features/changeref.feature +82 -129
- data/features/export.feature +102 -31
- data/features/modify.feature +143 -0
- data/features/rename_included_files.feature +121 -0
- data/features/step_definitions/defmastership_steps.rb +1 -0
- data/features/support/env.rb +1 -0
- data/lib/defmastership.rb +12 -3
- data/lib/defmastership/batch_modifier.rb +33 -0
- data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +19 -35
- data/lib/defmastership/change_ref_modifier.rb +15 -0
- data/lib/defmastership/comment_filter.rb +1 -0
- data/lib/defmastership/constants.rb +15 -1
- data/lib/defmastership/csv_formatter.rb +19 -18
- data/lib/defmastership/csv_formatter_body.rb +12 -6
- data/lib/defmastership/csv_formatter_header.rb +12 -10
- data/lib/defmastership/definition.rb +12 -0
- data/lib/defmastership/definition_parser.rb +46 -0
- data/lib/defmastership/document.rb +44 -75
- data/lib/defmastership/filters.rb +30 -0
- data/lib/defmastership/line_modifier_base.rb +29 -0
- data/lib/defmastership/modifier_base.rb +29 -0
- data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
- data/lib/defmastership/rename_included_files_modifier.rb +30 -0
- data/lib/defmastership/version.rb +2 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/defmastership/batch_modifier_spec.rb +115 -0
- data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +49 -26
- data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
- data/spec/unit/defmastership/comment_filter_spec.rb +9 -4
- data/spec/unit/defmastership/csv_formatter_body_spec.rb +62 -37
- data/spec/unit/defmastership/csv_formatter_header_spec.rb +47 -22
- data/spec/unit/defmastership/csv_formatter_spec.rb +67 -105
- data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
- data/spec/unit/defmastership/definition_spec.rb +31 -4
- data/spec/unit/defmastership/document_spec.rb +113 -35
- data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
- data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
- data/spec/unit/defmastership_spec.rb +1 -0
- metadata +44 -17
- data/Gemfile.lock +0 -140
- data/lib/defmastership/batch_changer.rb +0 -40
- data/lib/defmastership/project_ref_changer.rb +0 -27
- data/spec/unit/defmastership/batch_changer_spec.rb +0 -108
- data/spec/unit/defmastership/project_ref_changer_spec.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cd7a521f197f1ab374863af89ab7a24c50bc27d5dfef6161bc47e8fff27825f
|
4
|
+
data.tar.gz: a92ef2ee968e39a48e20fbf2a7d6f3040393c727a422e4f39c935978a29e187f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee7d58f8392a43fe5b45e234f9c4965037e2864a37a669c191d33b58016cf7094a99fe29443c3fc60678bab3e591b19188579771d14aa762fba8d4b34b01bd89
|
7
|
+
data.tar.gz: 526ae0002d2f5d66f2ad555d09bc8cf9786b567098e6bc071a8b119b2cbfe6b664e84eaf3fc68e453ca16f41552a4004f23bab6323ed62cba526322f27e88b15
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
default:
|
2
|
+
image: ruby:2.5
|
3
|
+
before_script:
|
4
|
+
- apt-get update
|
5
|
+
- ruby -v
|
6
|
+
- which ruby
|
7
|
+
- gem install bundler --no-document
|
8
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
9
|
+
|
10
|
+
cucumber:
|
11
|
+
script:
|
12
|
+
- bundle exec rake features
|
13
|
+
|
14
|
+
rspec:
|
15
|
+
script:
|
16
|
+
- bundle exec rake spec
|
17
|
+
|
18
|
+
rubocop:
|
19
|
+
script:
|
20
|
+
- bundle exec rake rubocop
|
data/.rubocop.yml
CHANGED
@@ -13,15 +13,16 @@ require:
|
|
13
13
|
- rubocop-rspec
|
14
14
|
|
15
15
|
AllCops:
|
16
|
-
TargetRubyVersion: 2.
|
16
|
+
TargetRubyVersion: 2.5
|
17
17
|
EnabledByDefault: true
|
18
18
|
DisplayCopNames: true
|
19
19
|
|
20
20
|
Style/Copyright:
|
21
|
-
Enabled:
|
22
|
-
|
21
|
+
Enabled: true
|
22
|
+
Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
|
23
|
+
AutocorrectNotice: '# Copyright (c) 2020 Jerome Arbez-Gindre'
|
23
24
|
|
24
|
-
Lint/ConstantResolution:
|
25
|
+
Lint/ConstantResolution: # Not available ins rubocop 0.81
|
25
26
|
Enabled: false
|
26
27
|
|
27
28
|
Style/DocumentationMethod:
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 Jérôme Arbez-Gindre, and the individual contributors
|
4
|
+
to DefMastership.
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
8
|
+
in the Software without restriction, including without limitation the rights
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
11
|
+
furnished to do so, subject to the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
14
|
+
all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
|
+
THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# Copyright (c) 2020 Jerome Arbez-Gindre
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require('rake/clean')
|
@@ -15,8 +16,7 @@ end
|
|
15
16
|
|
16
17
|
spec = eval(::File.read('defmastership.gemspec'))
|
17
18
|
|
18
|
-
Gem::PackageTask.new(spec)
|
19
|
-
end
|
19
|
+
Gem::PackageTask.new(spec)
|
20
20
|
CUKE_RESULTS = 'features_results.html'
|
21
21
|
CLEAN << CUKE_RESULTS
|
22
22
|
|
data/bin/defmastership
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# Copyright (c) 2020 Jerome Arbez-Gindre
|
2
3
|
# frozen_string_literal: true
|
3
4
|
|
4
5
|
require('asciidoctor')
|
@@ -49,8 +50,9 @@ module DefMastership
|
|
49
50
|
|
50
51
|
desc 'Export the definition database in CSV'
|
51
52
|
arg_name 'asciidoctor_files'
|
52
|
-
command :export do |c|
|
53
|
-
c.
|
53
|
+
command :export, :exp, :e do |c|
|
54
|
+
c.flag(%i[separator sep s], default_value: ',', desc: 'CSV separator')
|
55
|
+
c.action do |_global_options, options, args|
|
54
56
|
doc = Asciidoctor.load_file(args[0], safe: :unsafe, parse: false)
|
55
57
|
# FIXME: also escape ifdef, ifndef, ifeval and endif directives
|
56
58
|
# FIXME: do this more carefully by reading line by line; if input
|
@@ -61,34 +63,40 @@ module DefMastership
|
|
61
63
|
|
62
64
|
output_file = args[0].sub(/\.adoc$/, '.csv')
|
63
65
|
|
64
|
-
DefMastership::CSVFormatter.new(my_doc).export_to(output_file)
|
66
|
+
DefMastership::CSVFormatter.new(my_doc, options['separator']).export_to(output_file)
|
65
67
|
end
|
66
68
|
end
|
67
69
|
|
68
|
-
desc '
|
70
|
+
desc 'Apply one or more modifications'
|
69
71
|
arg_name 'asciidoctor_files'
|
70
|
-
command :
|
71
|
-
c.flag(
|
72
|
-
|
73
|
-
|
72
|
+
command :modify, :mod, :m do |c|
|
73
|
+
c.flag(
|
74
|
+
%i[modifications mod m],
|
75
|
+
must_match: /(?:[\w-]+)(?:,[\w-]+)*/,
|
76
|
+
default_value: 'all',
|
77
|
+
desc: 'comma separated list of modifications to apply'
|
78
|
+
)
|
79
|
+
c.flag(%i[modifications-file mf], default_value: 'modifications.yml', desc: 'modifications description file')
|
80
|
+
c.flag(%i[changes-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
|
74
81
|
|
75
82
|
c.action do |_global_options, options, args|
|
76
|
-
|
77
|
-
YAML.load_file(options['
|
83
|
+
changer = BatchModifier.new(
|
84
|
+
YAML.load_file(options[:'modifications-file']),
|
78
85
|
args.map { |afile| [afile, File.open(afile).read] }.to_h
|
79
86
|
)
|
80
87
|
|
81
|
-
|
88
|
+
changer.apply(options[:modifications])
|
82
89
|
|
83
|
-
|
90
|
+
changer.adoc_texts.each do |adoc_file, adoc_text|
|
84
91
|
File.open(adoc_file, 'w') { |f| f.write(adoc_text) }
|
85
92
|
end
|
86
|
-
File.open(options['change-file'], 'w') { |f| f.write(ref_changer.yaml_config) }
|
87
93
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
94
|
+
File.open(options[:'modifications-file'], 'w') { |f| f.write(changer.config.to_yaml) }
|
95
|
+
|
96
|
+
unless options['changes-summary'].nil?
|
97
|
+
CSV.open(options['changes-summary'], 'wb') do |csv|
|
98
|
+
csv << %w[Modifier Was Becomes]
|
99
|
+
changer.changes.each { |row| csv << row }
|
92
100
|
end
|
93
101
|
end
|
94
102
|
end
|
data/cucumber.yml
ADDED
data/defmastership.gemspec
CHANGED
@@ -1,21 +1,27 @@
|
|
1
|
+
# Copyright (c) 2020 Jerome Arbez-Gindre
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Ensure we require the local version and not one we might have
|
4
5
|
# installed already
|
5
|
-
require(
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
require(
|
7
|
+
File.join(
|
8
|
+
[
|
9
|
+
File.dirname(__FILE__),
|
10
|
+
'lib',
|
11
|
+
'defmastership',
|
12
|
+
'version.rb'
|
13
|
+
]
|
14
|
+
)
|
15
|
+
)
|
16
|
+
|
11
17
|
Gem::Specification.new do |s|
|
12
|
-
s.required_ruby_version = '>= 2.
|
18
|
+
s.required_ruby_version = '>= 2.5'
|
13
19
|
s.name = 'defmastership'
|
14
20
|
s.version = DefMastership::VERSION
|
15
21
|
s.author = 'Jérôme Arbez-Gindre'
|
16
22
|
s.email = 'jeromearbezgindre@gmail.com'
|
17
|
-
s.licenses = '
|
18
|
-
s.homepage = '
|
23
|
+
s.licenses = ['MIT']
|
24
|
+
s.homepage = 'https://gitlab.com/jjag/defmastership/'
|
19
25
|
s.platform = Gem::Platform::RUBY
|
20
26
|
s.summary = 'Handling of references and definitions with asciidoctor'
|
21
27
|
s.files = `git ls-files`.split("\n")
|
@@ -28,8 +34,9 @@ Gem::Specification.new do |s|
|
|
28
34
|
s.add_development_dependency('rake', '~> 13')
|
29
35
|
s.add_development_dependency('rdoc', '~> 6')
|
30
36
|
s.add_development_dependency('rspec', '~> 3')
|
31
|
-
s.add_development_dependency('rubocop', '~>
|
32
|
-
s.add_development_dependency('rubocop-
|
37
|
+
s.add_development_dependency('rubocop', '~> 1.3')
|
38
|
+
s.add_development_dependency('rubocop-rake', '~> 0.5')
|
39
|
+
s.add_development_dependency('rubocop-rspec', '~> 2.0')
|
33
40
|
s.add_development_dependency('simplecov', '~> 0')
|
34
41
|
s.add_runtime_dependency('aasm', '~> 5')
|
35
42
|
s.add_runtime_dependency('asciidoctor', '~> 2')
|
data/features/changeref.feature
CHANGED
@@ -4,57 +4,32 @@ Feature: The changeref command
|
|
4
4
|
I want defmastership to change reference for asciidoctor documents
|
5
5
|
|
6
6
|
Scenario: Change a definition
|
7
|
-
Given a file named "
|
7
|
+
Given a file named "modifications.yml" with:
|
8
8
|
"""
|
9
9
|
---
|
10
10
|
:toto:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
|
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
|
14
16
|
"""
|
15
17
|
And a file named "thedoc.adoc" with:
|
16
18
|
"""
|
17
19
|
[define, requirement, TOTO-TEMP-XXX1]
|
18
20
|
"""
|
19
|
-
When I run `defmastership
|
21
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc`
|
20
22
|
Then the stdout should not contain anything
|
21
23
|
And the stderr should not contain anything
|
22
|
-
And the file "
|
24
|
+
And the file "modifications.yml" should contain:
|
23
25
|
"""
|
24
26
|
---
|
25
27
|
:toto:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
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
|
58
33
|
"""
|
59
34
|
And the file "thedoc.adoc" should contain:
|
60
35
|
"""
|
@@ -62,29 +37,33 @@ Feature: The changeref command
|
|
62
37
|
"""
|
63
38
|
|
64
39
|
Scenario: Change two definitions
|
65
|
-
Given a file named "
|
40
|
+
Given a file named "modifications.yml" with:
|
66
41
|
"""
|
67
42
|
---
|
68
43
|
:toto:
|
69
|
-
:
|
70
|
-
:
|
71
|
-
|
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
|
72
49
|
"""
|
73
50
|
And a file named "thedoc.adoc" with:
|
74
51
|
"""
|
75
52
|
[define, requirement, TOTO-TEMP-XXX1]
|
76
53
|
[define, requirement, TOTO-TEMP-XXX2]
|
77
54
|
"""
|
78
|
-
When I run `defmastership
|
55
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc`
|
79
56
|
Then the stdout should not contain anything
|
80
57
|
And the stderr should not contain anything
|
81
|
-
And the file "
|
58
|
+
And the file "modifications.yml" should contain:
|
82
59
|
"""
|
83
60
|
---
|
84
61
|
:toto:
|
85
|
-
:
|
86
|
-
:
|
87
|
-
|
62
|
+
:type: change_ref
|
63
|
+
:config:
|
64
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
65
|
+
:to_template: TOTO-%<next_ref>04d
|
66
|
+
:next_ref: 125
|
88
67
|
"""
|
89
68
|
And the file "thedoc.adoc" should contain:
|
90
69
|
"""
|
@@ -92,77 +71,51 @@ Feature: The changeref command
|
|
92
71
|
[define, requirement, TOTO-0124]
|
93
72
|
"""
|
94
73
|
|
95
|
-
Scenario:
|
96
|
-
Given a file named "
|
74
|
+
Scenario: Change definitions with variable from regexp
|
75
|
+
Given a file named "modifications.yml" with:
|
97
76
|
"""
|
98
77
|
---
|
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
78
|
:tata_or_titi:
|
128
|
-
:
|
129
|
-
:
|
130
|
-
|
79
|
+
:type: change_ref
|
80
|
+
:config:
|
81
|
+
:from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
|
82
|
+
:to_template: "%<tata_or_titi>s-%<next_ref>07d"
|
83
|
+
:next_ref: 432
|
131
84
|
"""
|
132
85
|
And a file named "thedoc.adoc" with:
|
133
86
|
"""
|
134
|
-
[define, requirement, TOTO-TEMP-XXX1]
|
135
87
|
[define, requirement, TITI-TEMP-XXX2]
|
88
|
+
[define, requirement, TATA-TEMP-X2X3]
|
136
89
|
"""
|
137
|
-
When I run `defmastership
|
90
|
+
When I successfully run `defmastership modify --modifications tata_or_titi thedoc.adoc`
|
138
91
|
Then the stdout should not contain anything
|
139
92
|
And the stderr should not contain anything
|
140
|
-
And the file "
|
93
|
+
And the file "modifications.yml" should contain:
|
141
94
|
"""
|
142
95
|
---
|
143
|
-
:toto:
|
144
|
-
:from_regexp: TOTO-TEMP-[X\d]{4}
|
145
|
-
:to_template: TOTO-%<next_ref>04d
|
146
|
-
:next_ref: 124
|
147
96
|
:tata_or_titi:
|
148
|
-
:
|
149
|
-
:
|
150
|
-
|
97
|
+
:type: change_ref
|
98
|
+
:config:
|
99
|
+
:from_regexp: "(?<tata_or_titi>TATA|TITI)-TEMP-[X\\d]{4}"
|
100
|
+
:to_template: "%<tata_or_titi>s-%<next_ref>07d"
|
101
|
+
:next_ref: 434
|
151
102
|
"""
|
152
103
|
And the file "thedoc.adoc" should contain:
|
153
104
|
"""
|
154
|
-
[define, requirement, TOTO-0123]
|
155
105
|
[define, requirement, TITI-0000432]
|
106
|
+
[define, requirement, TATA-0000433]
|
156
107
|
"""
|
157
108
|
|
158
109
|
Scenario: Change definitions in two files
|
159
|
-
Given a file named "
|
110
|
+
Given a file named "modifications.yml" with:
|
160
111
|
"""
|
161
112
|
---
|
162
113
|
:toto:
|
163
|
-
:
|
164
|
-
:
|
165
|
-
|
114
|
+
:type: change_ref
|
115
|
+
:config:
|
116
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
117
|
+
:to_template: TOTO-%<next_ref>04d
|
118
|
+
:next_ref: 123
|
166
119
|
"""
|
167
120
|
And a file named "thedoc.adoc" with:
|
168
121
|
"""
|
@@ -172,16 +125,18 @@ Feature: The changeref command
|
|
172
125
|
"""
|
173
126
|
[define, requirement, TOTO-TEMP-XXX2]
|
174
127
|
"""
|
175
|
-
When I run `defmastership
|
128
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
|
176
129
|
Then the stdout should not contain anything
|
177
130
|
And the stderr should not contain anything
|
178
|
-
And the file "
|
131
|
+
And the file "modifications.yml" should contain:
|
179
132
|
"""
|
180
133
|
---
|
181
134
|
:toto:
|
182
|
-
:
|
183
|
-
:
|
184
|
-
|
135
|
+
:type: change_ref
|
136
|
+
:config:
|
137
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
138
|
+
:to_template: TOTO-%<next_ref>04d
|
139
|
+
:next_ref: 125
|
185
140
|
"""
|
186
141
|
And the file "thedoc.adoc" should contain:
|
187
142
|
"""
|
@@ -193,13 +148,15 @@ Feature: The changeref command
|
|
193
148
|
"""
|
194
149
|
|
195
150
|
Scenario: Change a internal refs
|
196
|
-
Given a file named "
|
151
|
+
Given a file named "modifications.yml" with:
|
197
152
|
"""
|
198
153
|
---
|
199
154
|
:toto:
|
200
|
-
:
|
201
|
-
:
|
202
|
-
|
155
|
+
:type: change_ref
|
156
|
+
:config:
|
157
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
158
|
+
:to_template: TOTO-%<next_ref>04d
|
159
|
+
:next_ref: 123
|
203
160
|
"""
|
204
161
|
And a file named "thedoc.adoc" with:
|
205
162
|
"""
|
@@ -208,7 +165,7 @@ Feature: The changeref command
|
|
208
165
|
[define, requirement, TOTO-TEMP-XXX2]
|
209
166
|
is the same as defs:iref[TOTO-TEMP-XXX1]
|
210
167
|
"""
|
211
|
-
When I run `defmastership
|
168
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc`
|
212
169
|
Then the stdout should not contain anything
|
213
170
|
And the stderr should not contain anything
|
214
171
|
And the file "thedoc.adoc" should contain:
|
@@ -220,13 +177,15 @@ Feature: The changeref command
|
|
220
177
|
"""
|
221
178
|
|
222
179
|
Scenario: Change definitions and iref in two files
|
223
|
-
Given a file named "
|
180
|
+
Given a file named "modifications.yml" with:
|
224
181
|
"""
|
225
182
|
---
|
226
183
|
:toto:
|
227
|
-
:
|
228
|
-
:
|
229
|
-
|
184
|
+
:type: change_ref
|
185
|
+
:config:
|
186
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
187
|
+
:to_template: TOTO-%<next_ref>04d
|
188
|
+
:next_ref: 123
|
230
189
|
"""
|
231
190
|
And a file named "thedoc.adoc" with:
|
232
191
|
"""
|
@@ -238,17 +197,9 @@ Feature: The changeref command
|
|
238
197
|
[define, requirement, TOTO-TEMP-XXX2]
|
239
198
|
defs:iref[TOTO-TEMP-XXX1]
|
240
199
|
"""
|
241
|
-
When I run `defmastership
|
200
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc thedoc2.adoc`
|
242
201
|
Then the stdout should not contain anything
|
243
202
|
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
203
|
And the file "thedoc.adoc" should contain:
|
253
204
|
"""
|
254
205
|
[define, requirement, TOTO-0123]
|
@@ -261,13 +212,15 @@ Feature: The changeref command
|
|
261
212
|
"""
|
262
213
|
|
263
214
|
Scenario: Do not change definitions when in literal
|
264
|
-
Given a file named "
|
215
|
+
Given a file named "modifications.yml" with:
|
265
216
|
"""
|
266
217
|
---
|
267
218
|
:toto:
|
268
|
-
:
|
269
|
-
:
|
270
|
-
|
219
|
+
:type: change_ref
|
220
|
+
:config:
|
221
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
222
|
+
:to_template: TOTO-%<next_ref>04d
|
223
|
+
:next_ref: 123
|
271
224
|
"""
|
272
225
|
And a file named "thedoc.adoc" with:
|
273
226
|
"""
|
@@ -275,16 +228,18 @@ Feature: The changeref command
|
|
275
228
|
[define, requirement, TOTO-TEMP-XXX1]
|
276
229
|
....
|
277
230
|
"""
|
278
|
-
When I run `defmastership
|
231
|
+
When I successfully run `defmastership modify --modifications toto thedoc.adoc`
|
279
232
|
Then the stdout should not contain anything
|
280
233
|
And the stderr should not contain anything
|
281
|
-
And the file "
|
234
|
+
And the file "modifications.yml" should contain:
|
282
235
|
"""
|
283
236
|
---
|
284
237
|
:toto:
|
285
|
-
:
|
286
|
-
:
|
287
|
-
|
238
|
+
:type: change_ref
|
239
|
+
:config:
|
240
|
+
:from_regexp: TOTO-TEMP-[X\d]{4}
|
241
|
+
:to_template: TOTO-%<next_ref>04d
|
242
|
+
:next_ref: 123
|
288
243
|
"""
|
289
244
|
And the file "thedoc.adoc" should contain:
|
290
245
|
"""
|
@@ -292,5 +247,3 @@ Feature: The changeref command
|
|
292
247
|
[define, requirement, TOTO-TEMP-XXX1]
|
293
248
|
....
|
294
249
|
"""
|
295
|
-
|
296
|
-
|