defmastership 1.0.10 → 1.0.11
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.
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a3085b336c6d1b3854964192456e63b586bb0841ca62be7a4e33b7a3f7e2b5e9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 190eb91c0e040f064044a9b720eeb737cf3a0064eb88c718f1f2f387d0edf47f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f8c55be957d580ad9ab71f15f58be76a43fc3e2b169d7b8397383a1a6a128c93aac5c33eab85cdf3da584d005eb92699730f2ae3560947ad25f13e478f5bff1d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8d7b95ad1db59a90e96f0caacc8040307366ae7be67baab172fe57f64c9101a065fef8718d8c2f123d03c808b1669aa406c05712872c05424b6de22150db6acf
         
     | 
    
        data/features/changeref.feature
    CHANGED
    
    | 
         @@ -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 = '( 
     | 
| 
      
 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}",
         
     | 
| 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2021-04-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: aruba
         
     |