defmastership 1.0.4 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitlab-ci.yml +0 -1
  4. data/.rubocop.yml +1 -1
  5. data/Rakefile +1 -2
  6. data/bin/defmastership +36 -24
  7. data/cucumber.yml +2 -0
  8. data/defmastership.gemspec +14 -8
  9. data/features/changeref.feature +82 -129
  10. data/features/definition_checksum.feature +298 -0
  11. data/features/definition_version.feature +24 -0
  12. data/features/export.feature +49 -31
  13. data/features/modify.feature +165 -0
  14. data/features/rename_included_files.feature +121 -0
  15. data/lib/defmastership.rb +14 -3
  16. data/lib/defmastership/batch_modifier.rb +35 -0
  17. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +18 -35
  18. data/lib/defmastership/change_ref_modifier.rb +15 -0
  19. data/lib/defmastership/constants.rb +14 -1
  20. data/lib/defmastership/csv_formatter.rb +25 -19
  21. data/lib/defmastership/csv_formatter_body.rb +19 -11
  22. data/lib/defmastership/csv_formatter_header.rb +15 -10
  23. data/lib/defmastership/definition.rb +14 -3
  24. data/lib/defmastership/definition_parser.rb +46 -0
  25. data/lib/defmastership/document.rb +59 -85
  26. data/lib/defmastership/filters.rb +30 -0
  27. data/lib/defmastership/line_modifier_base.rb +29 -0
  28. data/lib/defmastership/modifier_base.rb +29 -0
  29. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  30. data/lib/defmastership/rename_included_files_modifier.rb +15 -0
  31. data/lib/defmastership/update_def_checksum_line_modifier.rb +38 -0
  32. data/lib/defmastership/update_def_checksum_modifier.rb +21 -0
  33. data/lib/defmastership/version.rb +1 -1
  34. data/spec/spec_helper.rb +1 -0
  35. data/spec/unit/defmastership/batch_modifier_spec.rb +123 -0
  36. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +48 -26
  37. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  38. data/spec/unit/defmastership/comment_filter_spec.rb +8 -4
  39. data/spec/unit/defmastership/csv_formatter_body_spec.rb +88 -82
  40. data/spec/unit/defmastership/csv_formatter_header_spec.rb +68 -22
  41. data/spec/unit/defmastership/csv_formatter_spec.rb +208 -110
  42. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  43. data/spec/unit/defmastership/definition_spec.rb +45 -4
  44. data/spec/unit/defmastership/document_spec.rb +236 -35
  45. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  46. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  47. data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +78 -0
  48. data/spec/unit/defmastership/update_def_checksum_modifier_spec.rb +75 -0
  49. metadata +47 -16
  50. data/Gemfile.lock +0 -140
  51. data/lib/defmastership/batch_changer.rb +0 -41
  52. data/lib/defmastership/project_ref_changer.rb +0 -28
  53. data/spec/unit/defmastership/batch_changer_spec.rb +0 -109
  54. data/spec/unit/defmastership/project_ref_changer_spec.rb +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83b29fc13933c5a5030df105c476b86b0db8217d693c56786a1a8c5eec494a97
4
- data.tar.gz: 686431e77ee50fc891ca72b1d1a569620cfff7591e30c279044ed49c02926281
3
+ metadata.gz: 9dd61d32bacab380bbfc110df15fd6617b38540aa5bc8eb14bd5b2736e657b7c
4
+ data.tar.gz: 1ec7bc921411173863b71ba0c3f4164829ac2efbe0689c321830f632a3333f64
5
5
  SHA512:
6
- metadata.gz: d87ef7737bbc86a2ad638ac473c2663a710a26d225e17fe1a00cfdea9facb27f01eb810863c03088296bd63d6f665c486d81fc06358cb3f01fcc11da6aef03ba
7
- data.tar.gz: 76d543d058079e17bf95c1c495e74d3ccd6f410e07bfbe61f376d058272a08ba52e3c45b4bbc4f73d1838885d657cfe7ecb12ecf7a33eb8caa62e7e4e88afd51
6
+ metadata.gz: e8dcebcb309fd755a339ab702f7c07c65387e5a961400518661d70e9421911630652855a10ad647ac6155b9686665927fde8315a8efb71e3a2913a8db32fbcd5
7
+ data.tar.gz: 83e28e54b372de48cc554b8f532e659817453e905f3c6634071b3e280f23fba2431119353af9bdd6b23b97a6d6bf8a2b9a261b39e70591f27be45a3b04dce19b
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  /tmp
3
3
  /coverage
4
4
  defmastership-0.0.1.gem
5
+ /Gemfile.lock
6
+ /pkg/
data/.gitlab-ci.yml CHANGED
@@ -4,7 +4,6 @@ default:
4
4
  - apt-get update
5
5
  - ruby -v
6
6
  - which ruby
7
- - rm Gemfile.lock
8
7
  - gem install bundler --no-document
9
8
  - bundle install --jobs $(nproc) "${FLAGS[@]}"
10
9
 
data/.rubocop.yml CHANGED
@@ -19,7 +19,7 @@ AllCops:
19
19
 
20
20
  Style/Copyright:
21
21
  Enabled: true
22
- Notice: 'Copyright (\(c\) )?2020 Jerome Arbez-Gindre'
22
+ Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
23
23
  AutocorrectNotice: '# Copyright (c) 2020 Jerome Arbez-Gindre'
24
24
 
25
25
  Lint/ConstantResolution: # Not available ins rubocop 0.81
data/Rakefile CHANGED
@@ -16,8 +16,7 @@ end
16
16
 
17
17
  spec = eval(::File.read('defmastership.gemspec'))
18
18
 
19
- Gem::PackageTask.new(spec) do |pkg|
20
- end
19
+ Gem::PackageTask.new(spec)
21
20
  CUKE_RESULTS = 'features_results.html'
22
21
  CLEAN << CUKE_RESULTS
23
22
 
data/bin/defmastership CHANGED
@@ -2,7 +2,6 @@
2
2
  # Copyright (c) 2020 Jerome Arbez-Gindre
3
3
  # frozen_string_literal: true
4
4
 
5
- require('asciidoctor')
6
5
  require('csv')
7
6
  require('defmastership')
8
7
  require('gli')
@@ -50,46 +49,59 @@ module DefMastership
50
49
 
51
50
  desc 'Export the definition database in CSV'
52
51
  arg_name 'asciidoctor_files'
53
- command :export do |c|
54
- c.action do |_global_options, _options, args|
55
- doc = Asciidoctor.load_file(args[0], safe: :unsafe, parse: false)
56
- # FIXME: also escape ifdef, ifndef, ifeval and endif directives
57
- # FIXME: do this more carefully by reading line by line; if input
58
- # differs by output by leading backslash, restore original line
59
- lines = doc.reader.read_lines
52
+ command :export, :exp, :e do |c|
53
+ c.flag(%i[separator sep s], default_value: ',', desc: 'CSV separator')
54
+ c.switch(%i[no-fail], desc: 'Exit succes even in case of wrong explicit checksum')
55
+
56
+ c.action do |_global_options, options, args|
60
57
  my_doc = DefMastership::Document.new
61
- my_doc.parse(lines)
58
+ my_doc.parse_file_with_preprocessor(args[0])
62
59
 
63
60
  output_file = args[0].sub(/\.adoc$/, '.csv')
64
61
 
65
- DefMastership::CSVFormatter.new(my_doc).export_to(output_file)
62
+ DefMastership::CSVFormatter.new(my_doc, options['separator']).export_to(output_file)
63
+
64
+ if my_doc.wrong_explicit_checksum?
65
+ my_doc.definitions.each do |definition|
66
+ next if definition.wrong_explicit_checksum.nil?
67
+
68
+ warn("warning: #{definition.reference} has a wrong explicit checksum (should be #{definition.sha256})")
69
+ end
70
+ exit 1 unless options[:"no-fail"]
71
+ end
66
72
  end
67
73
  end
68
74
 
69
- desc 'Change temp references to definitive references'
75
+ desc 'Apply one or more modifications'
70
76
  arg_name 'asciidoctor_files'
71
- command :changeref do |c|
72
- c.flag(%i[change-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
73
-
74
- c.flag(%i[change-file f], default_value: 'changeref.yaml', desc: 'set the change specification file')
77
+ command :modify, :mod, :m do |c|
78
+ c.flag(
79
+ %i[modifications mod m],
80
+ must_match: /(?:[\w-]+)(?:,[\w-]+)*/,
81
+ default_value: 'all',
82
+ desc: 'comma separated list of modifications to apply'
83
+ )
84
+ c.flag(%i[modifications-file mf], default_value: 'modifications.yml', desc: 'modifications description file')
85
+ c.flag(%i[changes-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
75
86
 
76
87
  c.action do |_global_options, options, args|
77
- ref_changer = ProjectRefChanger.new(
78
- YAML.load_file(options['change-file']),
88
+ changer = BatchModifier.new(
89
+ YAML.load_file(options[:'modifications-file']),
79
90
  args.map { |afile| [afile, File.open(afile).read] }.to_h
80
91
  )
81
92
 
82
- ref_changer.replace_all
93
+ changer.apply(options[:modifications])
83
94
 
84
- ref_changer.adoc_texts.each do |adoc_file, adoc_text|
95
+ changer.adoc_texts.each do |adoc_file, adoc_text|
85
96
  File.open(adoc_file, 'w') { |f| f.write(adoc_text) }
86
97
  end
87
- File.open(options['change-file'], 'w') { |f| f.write(ref_changer.yaml_config) }
88
98
 
89
- unless options['change-summary'].nil?
90
- CSV.open(options['change-summary'], 'wb') do |csv|
91
- csv << %w[Was Becomes]
92
- ref_changer.changes.each { |row| csv << row }
99
+ File.open(options[:'modifications-file'], 'w') { |f| f.write(changer.config.to_yaml) }
100
+
101
+ unless options['changes-summary'].nil?
102
+ CSV.open(options['changes-summary'], 'wb') do |csv|
103
+ csv << %w[Modifier Was Becomes]
104
+ changer.changes.each { |row| csv << row }
93
105
  end
94
106
  end
95
107
  end
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ default: --publish --format pretty
@@ -3,12 +3,17 @@
3
3
 
4
4
  # Ensure we require the local version and not one we might have
5
5
  # installed already
6
- require(File.join([
7
- File.dirname(__FILE__),
8
- 'lib',
9
- 'defmastership',
10
- 'version.rb'
11
- ]))
6
+ require(
7
+ File.join(
8
+ [
9
+ File.dirname(__FILE__),
10
+ 'lib',
11
+ 'defmastership',
12
+ 'version.rb'
13
+ ]
14
+ )
15
+ )
16
+
12
17
  Gem::Specification.new do |s|
13
18
  s.required_ruby_version = '>= 2.5'
14
19
  s.name = 'defmastership'
@@ -29,8 +34,9 @@ Gem::Specification.new do |s|
29
34
  s.add_development_dependency('rake', '~> 13')
30
35
  s.add_development_dependency('rdoc', '~> 6')
31
36
  s.add_development_dependency('rspec', '~> 3')
32
- s.add_development_dependency('rubocop', '0.91')
33
- s.add_development_dependency('rubocop-rspec', '~> 1')
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')
34
40
  s.add_development_dependency('simplecov', '~> 0')
35
41
  s.add_runtime_dependency('aasm', '~> 5')
36
42
  s.add_runtime_dependency('asciidoctor', '~> 2')
@@ -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 "changeref.yaml" with:
7
+ Given a file named "modifications.yml" with:
8
8
  """
9
9
  ---
10
10
  :toto:
11
- :from_regexp: TOTO-TEMP-[X\d]{4}
12
- :to_template: TOTO-%<next_ref>04d
13
- :next_ref: 123
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 changeref thedoc.adoc`
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 "changeref.yaml" should contain:
24
+ And the file "modifications.yml" should contain:
23
25
  """
24
26
  ---
25
27
  :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
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 "changeref.yaml" with:
40
+ Given a file named "modifications.yml" with:
66
41
  """
67
42
  ---
68
43
  :toto:
69
- :from_regexp: TOTO-TEMP-[X\d]{4}
70
- :to_template: TOTO-%<next_ref>04d
71
- :next_ref: 123
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 changeref thedoc.adoc`
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 "changeref.yaml" should contain:
58
+ And the file "modifications.yml" should contain:
82
59
  """
83
60
  ---
84
61
  :toto:
85
- :from_regexp: TOTO-TEMP-[X\d]{4}
86
- :to_template: TOTO-%<next_ref>04d
87
- :next_ref: 125
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: Generate a table with changess
96
- Given a file named "changeref.yaml" with:
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
- :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
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 changeref thedoc.adoc`
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 "changeref.yaml" should contain:
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
- :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
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 "changeref.yaml" with:
110
+ Given a file named "modifications.yml" with:
160
111
  """
161
112
  ---
162
113
  :toto:
163
- :from_regexp: TOTO-TEMP-[X\d]{4}
164
- :to_template: TOTO-%<next_ref>04d
165
- :next_ref: 123
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 changeref thedoc.adoc thedoc2.adoc`
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 "changeref.yaml" should contain:
131
+ And the file "modifications.yml" should contain:
179
132
  """
180
133
  ---
181
134
  :toto:
182
- :from_regexp: TOTO-TEMP-[X\d]{4}
183
- :to_template: TOTO-%<next_ref>04d
184
- :next_ref: 125
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 "changeref.yaml" with:
151
+ Given a file named "modifications.yml" with:
197
152
  """
198
153
  ---
199
154
  :toto:
200
- :from_regexp: TOTO-TEMP-[X\d]{4}
201
- :to_template: TOTO-%<next_ref>04d
202
- :next_ref: 123
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 changeref thedoc.adoc`
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 "changeref.yaml" with:
180
+ Given a file named "modifications.yml" with:
224
181
  """
225
182
  ---
226
183
  :toto:
227
- :from_regexp: TOTO-TEMP-[X\d]{4}
228
- :to_template: TOTO-%<next_ref>04d
229
- :next_ref: 123
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 changeref thedoc.adoc thedoc2.adoc`
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 "changeref.yaml" with:
215
+ Given a file named "modifications.yml" with:
265
216
  """
266
217
  ---
267
218
  :toto:
268
- :from_regexp: TOTO-TEMP-[X\d]{4}
269
- :to_template: TOTO-%<next_ref>04d
270
- :next_ref: 123
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 changeref thedoc.adoc`
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 "changeref.yaml" should contain:
234
+ And the file "modifications.yml" should contain:
282
235
  """
283
236
  ---
284
237
  :toto:
285
- :from_regexp: TOTO-TEMP-[X\d]{4}
286
- :to_template: TOTO-%<next_ref>04d
287
- :next_ref: 123
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
-