defmastership 1.0.1 → 1.0.6

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.gitlab-ci.yml +20 -0
  4. data/.rubocop.yml +5 -4
  5. data/Gemfile +1 -0
  6. data/LICENSE +22 -0
  7. data/Rakefile +2 -2
  8. data/bin/defmastership +25 -17
  9. data/cucumber.yml +2 -0
  10. data/defmastership.gemspec +18 -11
  11. data/features/changeref.feature +82 -129
  12. data/features/export.feature +102 -31
  13. data/features/modify.feature +143 -0
  14. data/features/rename_included_files.feature +121 -0
  15. data/features/step_definitions/defmastership_steps.rb +1 -0
  16. data/features/support/env.rb +1 -0
  17. data/lib/defmastership.rb +12 -3
  18. data/lib/defmastership/batch_modifier.rb +33 -0
  19. data/lib/defmastership/{ref_changer.rb → change_ref_line_modifier.rb} +19 -35
  20. data/lib/defmastership/change_ref_modifier.rb +15 -0
  21. data/lib/defmastership/comment_filter.rb +1 -0
  22. data/lib/defmastership/constants.rb +15 -1
  23. data/lib/defmastership/csv_formatter.rb +19 -18
  24. data/lib/defmastership/csv_formatter_body.rb +12 -6
  25. data/lib/defmastership/csv_formatter_header.rb +12 -10
  26. data/lib/defmastership/definition.rb +12 -0
  27. data/lib/defmastership/definition_parser.rb +46 -0
  28. data/lib/defmastership/document.rb +44 -75
  29. data/lib/defmastership/filters.rb +30 -0
  30. data/lib/defmastership/line_modifier_base.rb +29 -0
  31. data/lib/defmastership/modifier_base.rb +29 -0
  32. data/lib/defmastership/rename_included_files_line_modifier.rb +126 -0
  33. data/lib/defmastership/rename_included_files_modifier.rb +30 -0
  34. data/lib/defmastership/version.rb +2 -1
  35. data/spec/spec_helper.rb +2 -0
  36. data/spec/unit/defmastership/batch_modifier_spec.rb +115 -0
  37. data/spec/unit/defmastership/{ref_changer_spec.rb → change_ref_line_modifier_spec.rb} +49 -26
  38. data/spec/unit/defmastership/change_ref_modifier_spec.rb +76 -0
  39. data/spec/unit/defmastership/comment_filter_spec.rb +9 -4
  40. data/spec/unit/defmastership/csv_formatter_body_spec.rb +62 -37
  41. data/spec/unit/defmastership/csv_formatter_header_spec.rb +47 -22
  42. data/spec/unit/defmastership/csv_formatter_spec.rb +67 -105
  43. data/spec/unit/defmastership/definition_parser_spec.rb +63 -0
  44. data/spec/unit/defmastership/definition_spec.rb +31 -4
  45. data/spec/unit/defmastership/document_spec.rb +113 -35
  46. data/spec/unit/defmastership/rename_included_files_line_modifier_spec.rb +203 -0
  47. data/spec/unit/defmastership/rename_included_files_modifier_spec.rb +67 -0
  48. data/spec/unit/defmastership_spec.rb +1 -0
  49. metadata +44 -17
  50. data/Gemfile.lock +0 -140
  51. data/lib/defmastership/batch_changer.rb +0 -40
  52. data/lib/defmastership/project_ref_changer.rb +0 -27
  53. data/spec/unit/defmastership/batch_changer_spec.rb +0 -108
  54. 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: 86de2f3ea5bbabfae9ed3e773349016d3a122919091bb04d2134dc2de25799a2
4
- data.tar.gz: e3d082d8d7f6ee8a22fe178c5eb9691cb6934dae4fff0c6288be0f17e6f94273
3
+ metadata.gz: 2cd7a521f197f1ab374863af89ab7a24c50bc27d5dfef6161bc47e8fff27825f
4
+ data.tar.gz: a92ef2ee968e39a48e20fbf2a7d6f3040393c727a422e4f39c935978a29e187f
5
5
  SHA512:
6
- metadata.gz: 69e865bb1c8e5972d7aa12b5f6ce9203e9d27eadcfef7c3f2becb83b123920769a120e66896957bc26eb89efbe7e9a00389c5262d4d395e2bdb9602b0f3f335c
7
- data.tar.gz: cad9f387a71e9668ba1af813865ba161c95daaa4937defa0c42ad41a72b7b3225ad0e3b7ccb5eeefa0553f33b2bd6e3aa6774567fe2bba6d6ea560952190de96
6
+ metadata.gz: ee7d58f8392a43fe5b45e234f9c4965037e2864a37a669c191d33b58016cf7094a99fe29443c3fc60678bab3e591b19188579771d14aa762fba8d4b34b01bd89
7
+ data.tar.gz: 526ae0002d2f5d66f2ad555d09bc8cf9786b567098e6bc071a8b119b2cbfe6b664e84eaf3fc68e453ca16f41552a4004f23bab6323ed62cba526322f27e88b15
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 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.6
16
+ TargetRubyVersion: 2.5
17
17
  EnabledByDefault: true
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
- Lint/ConstantResolution:
25
+ Lint/ConstantResolution: # Not available ins rubocop 0.81
25
26
  Enabled: false
26
27
 
27
28
  Style/DocumentationMethod:
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,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.action do |_global_options, _options, args|
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 'Change temp references to definitive references'
70
+ desc 'Apply one or more modifications'
69
71
  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')
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
- ref_changer = ProjectRefChanger.new(
77
- YAML.load_file(options['change-file']),
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
- ref_changer.replace_all
88
+ changer.apply(options[:modifications])
82
89
 
83
- ref_changer.adoc_texts.each do |adoc_file, adoc_text|
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
- 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 }
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
@@ -0,0 +1,2 @@
1
+ ---
2
+ default: --publish --format pretty
@@ -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(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
- s.required_ruby_version = '>= 2.6'
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'
18
- s.homepage = 'http://your.website.com'
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', '~> 0')
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
-