sh_vars 1.0.0 → 1.0.1
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 +4 -4
- data/lib/sh_vars/string.rb +16 -4
- data/lib/sh_vars/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: adb65ac8d005256f6f0504cc308cced8929ea3bfef5b624a8bbd264a711fa91d
         | 
| 4 | 
            +
              data.tar.gz: d963c22a20bd91d220eef51dcd76d0222b1911046afa6290163ad0b5b4cb07aa
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a5959d3cbb4ca3e9e9ed7dd6f5629e506981c2c902546a2e3c573e8de005eecf7e5a21c2b20742c32b551649f368b23fce88247a29735896f26f4e9bd1309f05
         | 
| 7 | 
            +
              data.tar.gz: 539b2ebbdbaa25f505837635dc7cb54f569dcf2c0495c40299b2b1618524f6726da392ba77977d54200ac2a2cc0f81034706636bf7213b598fb065c35771f734
         | 
    
        data/lib/sh_vars/string.rb
    CHANGED
    
    | @@ -11,7 +11,7 @@ module ShVars | |
| 11 11 | 
             
                end
         | 
| 12 12 |  | 
| 13 13 | 
             
                KEY   = %r([^\s=]+)
         | 
| 14 | 
            -
                WORD  = %r((\\.|(?!\s|"|'|`|\${|\$\( | 
| 14 | 
            +
                WORD  = %r((\\.|(?!\s|"|'|`|\${|\$\().))
         | 
| 15 15 | 
             
                SPACE = %r(\s+)
         | 
| 16 16 | 
             
                EQUAL = %r(=)
         | 
| 17 17 | 
             
                OPEN  = %r(\$\(|\$\{)
         | 
| @@ -33,7 +33,7 @@ module ShVars | |
| 33 33 | 
             
                end
         | 
| 34 34 |  | 
| 35 35 | 
             
                def pair
         | 
| 36 | 
            -
                  double_quoted_pair || unquoted_pair
         | 
| 36 | 
            +
                  double_quoted_pair || unquoted_pair || empty_pair
         | 
| 37 37 | 
             
                end
         | 
| 38 38 |  | 
| 39 39 | 
             
                def double_quoted_pair
         | 
| @@ -49,6 +49,12 @@ module ShVars | |
| 49 49 | 
             
                  [key, parts.join]
         | 
| 50 50 | 
             
                end
         | 
| 51 51 |  | 
| 52 | 
            +
                def empty_pair
         | 
| 53 | 
            +
                  key = word
         | 
| 54 | 
            +
                  pair = [key, ''] if key
         | 
| 55 | 
            +
                  pair
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
             | 
| 52 58 | 
             
                def values
         | 
| 53 59 | 
             
                  parts, part = [], nil
         | 
| 54 60 | 
             
                  parts << part while part = value || space
         | 
| @@ -80,7 +86,9 @@ module ShVars | |
| 80 86 | 
             
                end
         | 
| 81 87 |  | 
| 82 88 | 
             
                def word
         | 
| 83 | 
            -
                   | 
| 89 | 
            +
                  chars, char = [], nil
         | 
| 90 | 
            +
                  chars << char while !quote? && char = scan(WORD)
         | 
| 91 | 
            +
                  chars.join if chars.any?
         | 
| 84 92 | 
             
                end
         | 
| 85 93 |  | 
| 86 94 | 
             
                def space
         | 
| @@ -104,7 +112,7 @@ module ShVars | |
| 104 112 |  | 
| 105 113 | 
             
                  parts, part = [], nil
         | 
| 106 114 | 
             
                  parts << part while part = scan_quote(quote)
         | 
| 107 | 
            -
                  parts <<  | 
| 115 | 
            +
                  parts << values
         | 
| 108 116 | 
             
                  parts << part while part = scan_quote(quote)
         | 
| 109 117 |  | 
| 110 118 | 
             
                  quotes.pop
         | 
| @@ -141,6 +149,10 @@ module ShVars | |
| 141 149 | 
             
                  ['\\' * (level - 1), quote].join if str
         | 
| 142 150 | 
             
                end
         | 
| 143 151 |  | 
| 152 | 
            +
                def space?
         | 
| 153 | 
            +
                  peek(1) =~ SPACE
         | 
| 154 | 
            +
                end
         | 
| 155 | 
            +
             | 
| 144 156 | 
             
                def paren?
         | 
| 145 157 | 
             
                  open.any? && peek(open.last.size) == open.last
         | 
| 146 158 | 
             
                end
         | 
    
        data/lib/sh_vars/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: sh_vars
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.0. | 
| 4 | 
            +
              version: 1.0.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Sven Fuchs
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2019-04- | 
| 12 | 
            +
            date: 2019-04-29 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies: []
         | 
| 14 14 | 
             
            description: Shell var parser.
         | 
| 15 15 | 
             
            email:
         |