defmastership 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0498ff0b39ccfc024d4988c4c1137726e827e841a1750b921bc4c8d3be06db62'
4
- data.tar.gz: af1b86530d440a08417bac712f15e30db40aa01b07ea312b1d7d4f125dccef5c
3
+ metadata.gz: a3085b336c6d1b3854964192456e63b586bb0841ca62be7a4e33b7a3f7e2b5e9
4
+ data.tar.gz: 190eb91c0e040f064044a9b720eeb737cf3a0064eb88c718f1f2f387d0edf47f
5
5
  SHA512:
6
- metadata.gz: ec47e5182f9586be6102eed5be90c459db84e54e334cbe867bee2be4bf34645f8a91d7e08aea0b89a4733e3ca6089c90f96e1a6969d8f6b329034cc4486bd8b2
7
- data.tar.gz: 625fb3fb76aaac4189ce12cd2f9af3bfa83491a2ecbbe5192bb35ffe43e121e54a27a318afb60ad938a8e58818bccef38896b919d5b9678ea0af4565c09aab66
6
+ metadata.gz: f8c55be957d580ad9ab71f15f58be76a43fc3e2b169d7b8397383a1a6a128c93aac5c33eab85cdf3da584d005eb92699730f2ae3560947ad25f13e478f5bff1d
7
+ data.tar.gz: 8d7b95ad1db59a90e96f0caacc8040307366ae7be67baab172fe57f64c9101a065fef8718d8c2f123d03c808b1669aa406c05712872c05424b6de22150db6acf
@@ -36,6 +36,39 @@ Feature: The changeref command
36
36
  [define, requirement, TOTO-0123]
37
37
  """
38
38
 
39
+ Scenario: Change a definition with explicit checksum and version
40
+ Given a file named "modifications.yml" with:
41
+ """
42
+ ---
43
+ :toto:
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
49
+ """
50
+ And a file named "thedoc.adoc" with:
51
+ """
52
+ [define, requirement, TOTO-TEMP-XXX1(a~12345678)]
53
+ """
54
+ When I successfully run `defmastership modify --modifications toto thedoc.adoc`
55
+ Then the stdout should not contain anything
56
+ And the stderr should not contain anything
57
+ And the file "modifications.yml" should contain:
58
+ """
59
+ ---
60
+ :toto:
61
+ :type: change_ref
62
+ :config:
63
+ :from_regexp: TOTO-TEMP-[X\d]{4}
64
+ :to_template: TOTO-%<next_ref>04d
65
+ :next_ref: 124
66
+ """
67
+ And the file "thedoc.adoc" should contain:
68
+ """
69
+ [define, requirement, TOTO-0123(a~12345678)]
70
+ """
71
+
39
72
  Scenario: Change two definitions
40
73
  Given a file named "modifications.yml" with:
41
74
  """
@@ -66,12 +66,13 @@ module DefMastership
66
66
  regexp_str =
67
67
  "(?<before>#{REGEXP_FROM[const][:before]})" \
68
68
  "(?<from>#{from})" \
69
+ "#{DMRegexp::DEF_VERSION_AND_CHECKSUM}" \
69
70
  "(?<after>#{REGEXP_FROM[const][:after]})"
70
71
  Regexp.new(regexp_str, Regexp::EXTENDED)
71
72
  end
72
73
 
73
74
  def text_with(match, replacement)
74
- match[:before] + replacement + match[:after]
75
+ match[:before] + replacement + (match[:version_and_checksum] || '') + match[:after]
75
76
  end
76
77
 
77
78
  def hmerge(match)
@@ -20,7 +20,9 @@ module DefMastership
20
20
  (,\s*\[\s*(?<labels>.*?)\s*\])?\s*\]
21
21
  AFT
22
22
 
23
- DEF_VERSION_AND_CHECKSUM = '(\((?<explicit_version>[^~]+)?(?<explicit_checksum>~[[:alnum:]]+)?\))?'
23
+ DEF_VERSION_AND_CHECKSUM = '(?<version_and_checksum>' \
24
+ '\((?<explicit_version>[^~]+)?(?<explicit_checksum>~[[:alnum:]]+)?\)' \
25
+ ')?'
24
26
 
25
27
  DEFINITION = Regexp.new(
26
28
  "#{DEF_BEFORE_REF}(?<reference>[\\w:_-]+)#{DEF_VERSION_AND_CHECKSUM}#{DEF_AFTER_REF}",
@@ -2,6 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DefMastership
5
- VERSION = '1.0.10'
5
+ VERSION = '1.0.11'
6
6
  public_constant :VERSION
7
7
  end
@@ -217,6 +217,21 @@ RSpec.describe(DefMastership::ChangeRefLineModifier) do
217
217
  .to(eq('[define, whatever, TUTU]'))
218
218
  end
219
219
 
220
+ it do
221
+ expect(refchanger.replace(:refdef, '[define, whatever, TEMP(a~12345678)]'))
222
+ .to(eq('[define, whatever, TUTU(a~12345678)]'))
223
+ end
224
+
225
+ it do
226
+ expect(refchanger.replace(:refdef, '[define, whatever, TEMP(~12345678)]'))
227
+ .to(eq('[define, whatever, TUTU(~12345678)]'))
228
+ end
229
+
230
+ it do
231
+ expect(refchanger.replace(:refdef, '[define, whatever, TEMP(a)]'))
232
+ .to(eq('[define, whatever, TUTU(a)]'))
233
+ end
234
+
220
235
  it do
221
236
  refchanger.replace(:refdef, '[define, whatever, TEMP]')
222
237
  expect(refchanger.replace(:irefs, 'defs:iref[TEMP]'))
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.10
4
+ version: 1.0.11
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: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2021-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba