defmastership 1.0.8 → 1.0.9

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: c6fbf5098c8ab70e422d9c158c0a28cd876de25cfd159a131b0ddefc5f1eca86
4
- data.tar.gz: 8717156666df342a45994bb455b0cc58f09fc1da9b31c48cd0d4b36a40c528b6
3
+ metadata.gz: 9dd61d32bacab380bbfc110df15fd6617b38540aa5bc8eb14bd5b2736e657b7c
4
+ data.tar.gz: 1ec7bc921411173863b71ba0c3f4164829ac2efbe0689c321830f632a3333f64
5
5
  SHA512:
6
- metadata.gz: 6afcfd48186a2f89426e62007dc068711ea36e26a8ecf9b9c56428a351eabb6a89be58872a96de30c9a87ccdc71366e685fd8486469a3465e661ae490c0925be
7
- data.tar.gz: 275587475f39f39bbd311cdf9a0fb1cc9cdcb30c6cf766b44d9b1ff64ac9a8feb2c9117f4903f8eb806b3e73594b6c2e5e63876038483429cabd7eb66fb93575
6
+ metadata.gz: e8dcebcb309fd755a339ab702f7c07c65387e5a961400518661d70e9421911630652855a10ad647ac6155b9686665927fde8315a8efb71e3a2913a8db32fbcd5
7
+ data.tar.gz: 83e28e54b372de48cc554b8f532e659817453e905f3c6634071b3e280f23fba2431119353af9bdd6b23b97a6d6bf8a2b9a261b39e70591f27be45a3b04dce19b
@@ -242,3 +242,57 @@ Feature: definition checksum
242
242
  """
243
243
  And the stdout should not contain anything
244
244
  And the stderr should not contain anything
245
+
246
+ Scenario: Checksum keep explicit version in ref modification
247
+ Given a file named "modifications.yml" with:
248
+ """
249
+ ---
250
+ :update_requirement_checksum:
251
+ :type: update_def_checksum
252
+ :config:
253
+ :def_type: requirement
254
+ """
255
+ And a file named "thedoc.adoc" with:
256
+ """
257
+ [define, requirement, TOTO-TEMP-XXX1(toto~abcd1234)]
258
+ --
259
+ the requirement value.
260
+ --
261
+ """
262
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
263
+ Then the stdout should not contain anything
264
+ And the stderr should not contain anything
265
+ And the file "thedoc.adoc" should contain:
266
+ """
267
+ [define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
268
+ --
269
+ the requirement value.
270
+ --
271
+ """
272
+
273
+ Scenario: Checksum keep explicit version in ref setting
274
+ Given a file named "modifications.yml" with:
275
+ """
276
+ ---
277
+ :update_requirement_checksum:
278
+ :type: update_def_checksum
279
+ :config:
280
+ :def_type: requirement
281
+ """
282
+ And a file named "thedoc.adoc" with:
283
+ """
284
+ [define, requirement, TOTO-TEMP-XXX1(toto)]
285
+ --
286
+ the requirement value.
287
+ --
288
+ """
289
+ When I successfully run `defmastership modify --modifications update_requirement_checksum thedoc.adoc`
290
+ Then the stdout should not contain anything
291
+ And the stderr should not contain anything
292
+ And the file "thedoc.adoc" should contain:
293
+ """
294
+ [define, requirement, TOTO-TEMP-XXX1(toto~244eed18)]
295
+ --
296
+ the requirement value.
297
+ --
298
+ """
@@ -23,9 +23,8 @@ module DefMastership
23
23
  return line unless match
24
24
  return line unless match[:type] == def_type
25
25
 
26
- explicit_checksum_str = match[:explicit_checksum].nil? ? '' : "(#{match[:explicit_checksum]})"
27
- line.gsub("#{match[:reference]}#{explicit_checksum_str}") do
28
- "#{match[:reference]}(#{@document.ref_to_def(match[:reference]).sha256})"
26
+ line.gsub(Regexp.new("#{match[:reference]}#{DMRegexp::DEF_VERSION_AND_CHECKSUM}")) do
27
+ "#{match[:reference]}(#{match[:explicit_version]}#{@document.ref_to_def(match[:reference]).sha256})"
29
28
  end
30
29
  end
31
30
 
@@ -2,6 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DefMastership
5
- VERSION = '1.0.8'
5
+ VERSION = '1.0.9'
6
6
  public_constant :VERSION
7
7
  end
@@ -63,6 +63,16 @@ RSpec.describe(DefMastership::UpdateDefChecksumLineModifier) do
63
63
  expect(linemodifier.replace('[define,requirement,REFERENCE(~bad)]'))
64
64
  .to(eq('[define,requirement,REFERENCE(~abcd1234)]'))
65
65
  end
66
+
67
+ it do
68
+ expect(linemodifier.replace('[define,requirement,REFERENCE(toto~bad)]'))
69
+ .to(eq('[define,requirement,REFERENCE(toto~abcd1234)]'))
70
+ end
71
+
72
+ it do
73
+ expect(linemodifier.replace('[define,requirement,REFERENCE(toto)]'))
74
+ .to(eq('[define,requirement,REFERENCE(toto~abcd1234)]'))
75
+ end
66
76
  end
67
77
  end
68
78
  end
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.8
4
+ version: 1.0.9
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-11 00:00:00.000000000 Z
11
+ date: 2021-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aruba