dldinternet-mixlib-cli 0.0.7 → 0.1.0
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 +8 -8
- data/dldinternet-mixlib-cli.iml +1 -0
- data/lib/dldinternet/mixlib/cli.rb +46 -36
- data/lib/dldinternet/mixlib/cli/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                M2VlNGVjZmU4ZDdiZjgyNTViZWFlYzcxZjYzZjlmOTUyYzFlMTIzOQ==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                NmY4YjI0MjIwNWE3MzQzNmIxNWQzNGZhMDYwMzYyYTI3YzVhZTg0NA==
         | 
| 7 7 | 
             
            SHA512:
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                Y2YzMDk0NDUyZWZmMWY0YjJlMjhiYjRlOTM2MmEyYmY0NDE2NTEzOGJkOWJk
         | 
| 10 | 
            +
                MGU0YjRhMzg4YjU4NzEzNTM1YTRjYWQ1YTMzNWE2MjM5MjhlN2I0YWI1YWEz
         | 
| 11 | 
            +
                NTIwZjgzMWE0ZDJhY2I3OTNjYTIzMWY1NDk0YTIxMTljODVlNzQ=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                YTI5ZmM0OWMxNGU2YTRhMDllM2Y0MmI4MTFjZjRhZGFiZGEwOTQ3ZGY0NGY5
         | 
| 14 | 
            +
                NjllMDY5NjQ1MGY2Njk2MjFiZjljOTZlYjM3ZTQ2OGI2Y2YyYmJiMTZlYWE5
         | 
| 15 | 
            +
                NzZkODhlNWI2Yjk4YTljZDFjZDUzOTk0M2EyY2IyYzU4NjY1OGM=
         | 
    
        data/dldinternet-mixlib-cli.iml
    CHANGED
    
    | @@ -23,6 +23,7 @@ | |
| 23 23 | 
             
                <orderEntry type="library" scope="PROVIDED" name="bundler (v1.5.3, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 24 24 | 
             
                <orderEntry type="library" scope="PROVIDED" name="cucumber (v1.3.15, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 25 25 | 
             
                <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.2.5, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 26 | 
            +
                <orderEntry type="library" scope="PROVIDED" name="gherkin (v2.12.2, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 26 27 | 
             
                <orderEntry type="library" scope="PROVIDED" name="mixlib-cli (v1.5.0, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 27 28 | 
             
                <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.10.1, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| 28 29 | 
             
                <orderEntry type="library" scope="PROVIDED" name="multi_test (v0.1.1, RVM: ruby-1.9.3-p545 [dldinternet-mixlib-cli]) [gem]" level="application" />
         | 
| @@ -1,51 +1,61 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
            require "mixlib/cli"
         | 
| 1 | 
            +
            unless defined? ::DLDInternet::Mixlib::CLI::ClassMethods
         | 
| 3 2 |  | 
| 4 | 
            -
             | 
| 5 | 
            -
              module  | 
| 6 | 
            -
                module  | 
| 3 | 
            +
              require "dldinternet/mixlib/cli/version"
         | 
| 4 | 
            +
              module DLDInternet
         | 
| 5 | 
            +
                module Mixlib
         | 
| 6 | 
            +
                  module CLI
         | 
| 7 | 
            +
                    module ClassMethods
         | 
| 8 | 
            +
                    end
         | 
| 7 9 |  | 
| 8 | 
            -
             | 
| 10 | 
            +
                    # ----------------------------------------------------------------------------------------------------------------
         | 
| 11 | 
            +
                    # InstanceMethods
         | 
| 12 | 
            +
                    # ----------------------------------------------------------------------------------------------------------------
         | 
| 9 13 |  | 
| 10 | 
            -
             | 
| 11 | 
            -
                     | 
| 14 | 
            +
                    # --------------------------------------------------------------------------------
         | 
| 15 | 
            +
                    def parseString(v)
         | 
| 16 | 
            +
                      v
         | 
| 17 | 
            +
                    end
         | 
| 12 18 |  | 
| 13 | 
            -
                     | 
| 19 | 
            +
                    # --------------------------------------------------------------------------------
         | 
| 20 | 
            +
                    def parsePath(v)
         | 
| 21 | 
            +
                      File.expand_path(parseString(v))
         | 
| 22 | 
            +
                    end
         | 
| 14 23 |  | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
                       | 
| 24 | 
            +
                    # --------------------------------------------------------------------------------
         | 
| 25 | 
            +
                    def parseList(v,s=',',method='parseString')
         | 
| 26 | 
            +
                      parts = []
         | 
| 27 | 
            +
                      a = v.split(%r/#{s}/)
         | 
| 28 | 
            +
                      a.each{ |t|
         | 
| 29 | 
            +
                        parts << send(method,t)
         | 
| 30 | 
            +
                      }
         | 
| 31 | 
            +
                      parts
         | 
| 32 | 
            +
                    end
         | 
| 19 33 |  | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 34 | 
            +
                    # --------------------------------------------------------------------------------
         | 
| 35 | 
            +
                    def parseOptionString(v,s=',',method='parseString')
         | 
| 36 | 
            +
                      bags = []
         | 
| 37 | 
            +
                      if v.match(%r'#{s}')
         | 
| 38 | 
            +
                        bags << parseList(v,s,method)
         | 
| 39 | 
            +
                      else
         | 
| 40 | 
            +
                        bags << send(method,v)
         | 
| 23 41 | 
             
                      end
         | 
| 42 | 
            +
                      bags.flatten
         | 
| 43 | 
            +
                    end
         | 
| 24 44 |  | 
| 25 | 
            -
             | 
| 26 | 
            -
                      def parseList(v,s=',',method='parseString')
         | 
| 27 | 
            -
                        parts = []
         | 
| 28 | 
            -
                        a = v.split(%r/#{s}/)
         | 
| 29 | 
            -
                        a.each{ |t|
         | 
| 30 | 
            -
                          parts << send(method,t)
         | 
| 31 | 
            -
                        }
         | 
| 32 | 
            -
                        parts
         | 
| 33 | 
            -
                      end
         | 
| 45 | 
            +
                    def self.included(receiver)
         | 
| 34 46 |  | 
| 35 | 
            -
                       | 
| 36 | 
            -
             | 
| 37 | 
            -
                         | 
| 38 | 
            -
                        if v.match(%r'#{s}')
         | 
| 39 | 
            -
                          bags << parseList(v,s,method)
         | 
| 40 | 
            -
                        else
         | 
| 41 | 
            -
                          bags << send(method,v)
         | 
| 42 | 
            -
                        end
         | 
| 43 | 
            -
                        bags.flatten
         | 
| 47 | 
            +
                      receiver.class_eval do
         | 
| 48 | 
            +
                        require "mixlib/cli"
         | 
| 49 | 
            +
                        include ::Mixlib::CLI
         | 
| 44 50 | 
             
                      end
         | 
| 45 51 |  | 
| 52 | 
            +
                      receiver.extend(::Mixlib::CLI::ClassMethods)
         | 
| 53 | 
            +
                      receiver.extend(ClassMethods)
         | 
| 54 | 
            +
             | 
| 46 55 | 
             
                    end
         | 
| 47 | 
            -
                  end
         | 
| 48 56 |  | 
| 57 | 
            +
                  end
         | 
| 49 58 | 
             
                end
         | 
| 50 59 | 
             
              end
         | 
| 51 | 
            -
             | 
| 60 | 
            +
             | 
| 61 | 
            +
            end
         |