defmastership 1.0.3 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitlab-ci.yml +0 -1
  4. data/.rubocop.yml +3 -2
  5. data/Gemfile +1 -0
  6. data/LICENSE +22 -0
  7. data/Rakefile +2 -2
  8. data/bin/defmastership +37 -24
  9. data/cucumber.yml +2 -0
  10. data/defmastership.gemspec +16 -9
  11. data/features/changeref.feature +82 -129
  12. data/features/definition_checksum.feature +244 -0
  13. data/features/definition_version.feature +24 -0
  14. data/features/export.feature +49 -31
  15. data/features/modify.feature +165 -0
  16. data/features/rename_included_files.feature +121 -0
  17. data/features/step_definitions/defmastership_steps.rb +1 -0
  18. data/features/support/env.rb +1 -0
  19. data/lib/defmastership.rb +15 -3
  20. data/lib/defmastership/batch_modifier.rb +35 -0
  21. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +19 -35
  22. data/lib/defmastership/change_ref_modifier.rb +15 -0
  23. data/lib/defmastership/comment_filter.rb +1 -0
  24. data/lib/defmastership/constants.rb +15 -1
  25. data/lib/defmastership/csv_formatter.rb +26 -19
  26. data/lib/defmastership/csv_formatter_body.rb +20 -11
  27. data/lib/defmastership/csv_formatter_header.rb +16 -10
  28. data/lib/defmastership/definition.rb +15 -3
  29. data/lib/defmastership/definition_parser.rb +46 -0
  30. data/lib/defmastership/document.rb +60 -85
  31. data/lib/defmastership/filters.rb +30 -0
  32. data/lib/defmastership/line_modifier_base.rb +29 -0
  33. data/lib/defmastership/modifier_base.rb +29 -0
  34. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  35. data/lib/defmastership/rename_included_files_modifier.rb +15 -0
  36. data/lib/defmastership/update_def_checksum_line_modifier.rb +39 -0
  37. data/lib/defmastership/update_def_checksum_modifier.rb +21 -0
  38. data/lib/defmastership/version.rb +2 -1
  39. data/spec/spec_helper.rb +2 -0
  40. data/spec/unit/defmastership/batch_modifier_spec.rb +123 -0
  41. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +49 -26
  42. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  43. data/spec/unit/defmastership/comment_filter_spec.rb +9 -4
  44. data/spec/unit/defmastership/csv_formatter_body_spec.rb +89 -82
  45. data/spec/unit/defmastership/csv_formatter_header_spec.rb +69 -22
  46. data/spec/unit/defmastership/csv_formatter_spec.rb +209 -110
  47. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  48. data/spec/unit/defmastership/definition_spec.rb +46 -4
  49. data/spec/unit/defmastership/document_spec.rb +237 -35
  50. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  51. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  52. data/spec/unit/defmastership/update_def_checksum_line_modifier_spec.rb +68 -0
  53. data/spec/unit/defmastership/update_def_checksum_modifier_spec.rb +75 -0
  54. data/spec/unit/defmastership_spec.rb +1 -0
  55. metadata +49 -17
  56. data/Gemfile.lock +0 -140
  57. data/lib/defmastership/batch_changer.rb +0 -40
  58. data/lib/defmastership/project_ref_changer.rb +0 -27
  59. data/spec/unit/defmastership/batch_changer_spec.rb +0 -108
  60. 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: 86894e5b058e9344802e4d9286dc006ecde31268bb23abecd02ebdf1d9bce26c
4
- data.tar.gz: 9ff11bf910435bc4702bba12c85672597001d08cb5fa995b3d0f93e0a098a693
3
+ metadata.gz: c6fbf5098c8ab70e422d9c158c0a28cd876de25cfd159a131b0ddefc5f1eca86
4
+ data.tar.gz: 8717156666df342a45994bb455b0cc58f09fc1da9b31c48cd0d4b36a40c528b6
5
5
  SHA512:
6
- metadata.gz: 5c2b91c3c566808164b74fb5c8f28a4ae44dd0946bd344a872ad9119b3d4b27ee640a4ff2e59b38099f4a5d467b27e9c940bdda446580b42ebce1f9e24540f96
7
- data.tar.gz: '08e981d6f11a50f377d442202133ec518d2fbcbb05328880086338964d690a368ae0e42ec2fc6f1681e7d9b5917ebed670d3563cd705522a3bf654650f95ef63'
6
+ metadata.gz: 6afcfd48186a2f89426e62007dc068711ea36e26a8ecf9b9c56428a351eabb6a89be58872a96de30c9a87ccdc71366e685fd8486469a3465e661ae490c0925be
7
+ data.tar.gz: 275587475f39f39bbd311cdf9a0fb1cc9cdcb30c6cf766b44d9b1ff64ac9a8feb2c9117f4903f8eb806b3e73594b6c2e5e63876038483429cabd7eb66fb93575
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
@@ -18,8 +18,9 @@ AllCops:
18
18
  DisplayCopNames: true
19
19
 
20
20
  Style/Copyright:
21
- Enabled: false
22
- # AutocorrectNotice: 'Copyright 2020 by Jérôme Arbez-Gindre'
21
+ Enabled: true
22
+ Notice: 'Copyright (\(c\) )?202[0-9] Jerome Arbez-Gindre'
23
+ AutocorrectNotice: '# Copyright (c) 2020 Jerome Arbez-Gindre'
23
24
 
24
25
  Lint/ConstantResolution: # Not available ins rubocop 0.81
25
26
  Enabled: false
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # Copyright (c) 2020 Jerome Arbez-Gindre
1
2
  # frozen_string_literal: true
2
3
 
3
4
  source('https://rubygems.org')
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) do |pkg|
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,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
+ # Copyright (c) 2020 Jerome Arbez-Gindre
2
3
  # frozen_string_literal: true
3
4
 
4
- require('asciidoctor')
5
5
  require('csv')
6
6
  require('defmastership')
7
7
  require('gli')
@@ -49,46 +49,59 @@ module DefMastership
49
49
 
50
50
  desc 'Export the definition database in CSV'
51
51
  arg_name 'asciidoctor_files'
52
- command :export do |c|
53
- c.action do |_global_options, _options, args|
54
- doc = Asciidoctor.load_file(args[0], safe: :unsafe, parse: false)
55
- # FIXME: also escape ifdef, ifndef, ifeval and endif directives
56
- # FIXME: do this more carefully by reading line by line; if input
57
- # differs by output by leading backslash, restore original line
58
- 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|
59
57
  my_doc = DefMastership::Document.new
60
- my_doc.parse(lines)
58
+ my_doc.parse_file_with_preprocessor(args[0])
61
59
 
62
60
  output_file = args[0].sub(/\.adoc$/, '.csv')
63
61
 
64
- 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
65
72
  end
66
73
  end
67
74
 
68
- desc 'Change temp references to definitive references'
75
+ desc 'Apply one or more modifications'
69
76
  arg_name 'asciidoctor_files'
70
- command :changeref do |c|
71
- c.flag(%i[change-summary s], default_value: 'changes.csv', desc: 'generates a change summary in a CSV file')
72
-
73
- 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')
74
86
 
75
87
  c.action do |_global_options, options, args|
76
- ref_changer = ProjectRefChanger.new(
77
- YAML.load_file(options['change-file']),
88
+ changer = BatchModifier.new(
89
+ YAML.load_file(options[:'modifications-file']),
78
90
  args.map { |afile| [afile, File.open(afile).read] }.to_h
79
91
  )
80
92
 
81
- ref_changer.replace_all
93
+ changer.apply(options[:modifications])
82
94
 
83
- ref_changer.adoc_texts.each do |adoc_file, adoc_text|
95
+ changer.adoc_texts.each do |adoc_file, adoc_text|
84
96
  File.open(adoc_file, 'w') { |f| f.write(adoc_text) }
85
97
  end
86
- File.open(options['change-file'], 'w') { |f| f.write(ref_changer.yaml_config) }
87
98
 
88
- unless options['change-summary'].nil?
89
- CSV.open(options['change-summary'], 'wb') do |csv|
90
- csv << %w[Was Becomes]
91
- 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 }
92
105
  end
93
106
  end
94
107
  end
data/cucumber.yml ADDED
@@ -0,0 +1,2 @@
1
+ ---
2
+ default: --publish --format pretty
@@ -1,20 +1,26 @@
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(File.join([
6
- File.dirname(__FILE__),
7
- 'lib',
8
- 'defmastership',
9
- 'version.rb'
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
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 = 'Nonstandard'
23
+ s.licenses = ['MIT']
18
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'
@@ -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', '0.91')
32
- 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')
33
40
  s.add_development_dependency('simplecov', '~> 0')
34
41
  s.add_runtime_dependency('aasm', '~> 5')
35
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
-