confickle 1.0.0.alpha.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 +15 -0
- data/lib/confickle.rb +44 -0
- metadata +44 -0
    
        checksums.yaml
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
| 1 | 
            +
            ---
         | 
| 2 | 
            +
            !binary "U0hBMQ==":
         | 
| 3 | 
            +
              metadata.gz: !binary |-
         | 
| 4 | 
            +
                ZWVmMTM0MDI2MDEwNjg3NDlhYTBhMDI4ZDA1ODdjMDI4ZTFmNjU2ZA==
         | 
| 5 | 
            +
              data.tar.gz: !binary |-
         | 
| 6 | 
            +
                MzUxMjM2MDExNzI4ZDQ0OGY3YzM4ZTUzYjc1MWMwYzk4MTg5ODBiNQ==
         | 
| 7 | 
            +
            SHA512:
         | 
| 8 | 
            +
              metadata.gz: !binary |-
         | 
| 9 | 
            +
                ZTkzYzY3NWQzOGU3MTUxNDA1ZWQ3ZDJjNmU2NDdiNjEyY2YxYTZkNTAwMWM4
         | 
| 10 | 
            +
                YjRkNDFhNTNhNTBlMDJkMzk4NmY5ZWRhMDg3NzUxNDBmMTRkMTdmMzRhZjk2
         | 
| 11 | 
            +
                M2YwODgyZDhlZWM5YmRlMjcyNzA5MjI3MDkyMmVhNDZkY2MzNWE=
         | 
| 12 | 
            +
              data.tar.gz: !binary |-
         | 
| 13 | 
            +
                YjRlMTQ3ODlmNTI1MWY5MmU4MDBkODBmOGFlYjA4OGNiMGY3MjllMTBiZWI4
         | 
| 14 | 
            +
                ZDE4OWQ4ZDZkZThjYjgyZjZjNWMzNTllNTJjMDRlN2RhNjRhMTdkZDFlZGRm
         | 
| 15 | 
            +
                YzNmODJlZTBiMjFiZDhjMzI5ZjAwYzkzMjU3MDlmNDkwNTZhODI=
         | 
    
        data/lib/confickle.rb
    ADDED
    
    | @@ -0,0 +1,44 @@ | |
| 1 | 
            +
             | 
| 2 | 
            +
            require 'json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class Confickle
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              attr_reader :root, :symbolize_names
         | 
| 7 | 
            +
             | 
| 8 | 
            +
              def initialize(options)
         | 
| 9 | 
            +
                if options.is_a? String
         | 
| 10 | 
            +
                  options = {root: options}
         | 
| 11 | 
            +
                end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                @root            = File.absolute_path(options.fetch(:root))
         | 
| 14 | 
            +
                @symbolize_names = options.fetch(:symbolize_names, true)
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
             | 
| 17 | 
            +
             | 
| 18 | 
            +
              def path(*args)
         | 
| 19 | 
            +
                File.join(self.root, *args)
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              def content(*args)
         | 
| 23 | 
            +
                File.read(self.path(*args))
         | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              def json(*args)
         | 
| 27 | 
            +
                if args.last.is_a? Hash
         | 
| 28 | 
            +
                  args    = args.dup
         | 
| 29 | 
            +
                  options = args.pop
         | 
| 30 | 
            +
                else
         | 
| 31 | 
            +
                  options = {}
         | 
| 32 | 
            +
                end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                sn = options.fetch(:symbolize_names, self.symbolize_names)
         | 
| 35 | 
            +
                JSON.parse(
         | 
| 36 | 
            +
                  self.content(*args),
         | 
| 37 | 
            +
                  symbolize_names: sn
         | 
| 38 | 
            +
                )
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
             | 
| 42 | 
            +
            end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
             | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,44 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: confickle
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 1.0.0.alpha.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Brian Lauber
         | 
| 8 | 
            +
            autorequire: 
         | 
| 9 | 
            +
            bindir: bin
         | 
| 10 | 
            +
            cert_chain: []
         | 
| 11 | 
            +
            date: 2014-12-11 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies: []
         | 
| 13 | 
            +
            description: Simplified access to config files.
         | 
| 14 | 
            +
            email: constructible.truth@gmail.com
         | 
| 15 | 
            +
            executables: []
         | 
| 16 | 
            +
            extensions: []
         | 
| 17 | 
            +
            extra_rdoc_files: []
         | 
| 18 | 
            +
            files:
         | 
| 19 | 
            +
            - lib/confickle.rb
         | 
| 20 | 
            +
            homepage: 
         | 
| 21 | 
            +
            licenses:
         | 
| 22 | 
            +
            - MIT
         | 
| 23 | 
            +
            metadata: {}
         | 
| 24 | 
            +
            post_install_message: 
         | 
| 25 | 
            +
            rdoc_options: []
         | 
| 26 | 
            +
            require_paths:
         | 
| 27 | 
            +
            - lib
         | 
| 28 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 29 | 
            +
              requirements:
         | 
| 30 | 
            +
              - - ! '>='
         | 
| 31 | 
            +
                - !ruby/object:Gem::Version
         | 
| 32 | 
            +
                  version: '0'
         | 
| 33 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 34 | 
            +
              requirements:
         | 
| 35 | 
            +
              - - ! '>'
         | 
| 36 | 
            +
                - !ruby/object:Gem::Version
         | 
| 37 | 
            +
                  version: 1.3.1
         | 
| 38 | 
            +
            requirements: []
         | 
| 39 | 
            +
            rubyforge_project: 
         | 
| 40 | 
            +
            rubygems_version: 2.1.11
         | 
| 41 | 
            +
            signing_key: 
         | 
| 42 | 
            +
            specification_version: 4
         | 
| 43 | 
            +
            summary: Simplified access to config files.
         | 
| 44 | 
            +
            test_files: []
         |