hocon 0.0.1 → 0.0.2
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 +7 -0
 - data/README.md +6 -0
 - data/lib/hocon/config_error.rb +4 -1
 - data/lib/hocon/config_factory.rb +5 -1
 - data/lib/hocon/impl/parseable.rb +41 -4
 - metadata +54 -41
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 57938b00093e55e8bc196496cc5d491d16d76a2e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 700b53343336fb33116a0de444a2d04f2881e405
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: bfedb58b6b68d16ee07e307f1f714e49efb1228147476fe8d6cbc788be924963fd4ebade645135c71b04306f49cc63adefd89b0855829aa6747daeb54f44ee5f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 209bf58ccc186f9a849e75be0fc0c33af4f08460b88c6dcfdc5a0c484dcc881523b18fb96e306fd4577aa71b3336b859c5578d1926c4f2d4223b35177a172022
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -12,8 +12,14 @@ The implementation is intended to be as close to a line-for-line port as the two 
     | 
|
| 
       12 
12 
     | 
    
         
             
            Basic Usage
         
     | 
| 
       13 
13 
     | 
    
         
             
            ===========
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
      
 15 
     | 
    
         
            +
            ```sh
         
     | 
| 
      
 16 
     | 
    
         
            +
            gem install hocon
         
     | 
| 
      
 17 
     | 
    
         
            +
            ```
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       15 
20 
     | 
    
         
             
            ```rb
         
     | 
| 
       16 
21 
     | 
    
         
             
            require 'hocon/config_factory'
         
     | 
| 
       17 
22 
     | 
    
         | 
| 
       18 
23 
     | 
    
         
             
            conf = Hocon::ConfigFactory.parse_file("myapp.conf")
         
     | 
| 
       19 
24 
     | 
    
         
             
            conf_map = conf.root.unwrapped
         
     | 
| 
      
 25 
     | 
    
         
            +
            ```
         
     | 
    
        data/lib/hocon/config_error.rb
    CHANGED
    
    
    
        data/lib/hocon/config_factory.rb
    CHANGED
    
    | 
         @@ -6,4 +6,8 @@ class Hocon::ConfigFactory 
     | 
|
| 
       6 
6 
     | 
    
         
             
              def self.parse_file(file_path, options = Hocon::ConfigParseOptions.defaults)
         
     | 
| 
       7 
7 
     | 
    
         
             
                Hocon::Impl::Parseable.new_file(file_path, options).parse.to_config
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
              def self.parse_string(string, options = Hocon::ConfigParseOptions.defaults)
         
     | 
| 
      
 11 
     | 
    
         
            +
                Hocon::Impl::Parseable.new_string(string, options).parse.to_config
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/hocon/impl/parseable.rb
    CHANGED
    
    | 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'stringio'
         
     | 
| 
       1 
2 
     | 
    
         
             
            require 'hocon/impl'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'hocon/config_error'
         
     | 
| 
       2 
4 
     | 
    
         
             
            require 'hocon/config_syntax'
         
     | 
| 
       3 
5 
     | 
    
         
             
            require 'hocon/impl/config_impl'
         
     | 
| 
       4 
6 
     | 
    
         
             
            require 'hocon/impl/simple_include_context'
         
     | 
| 
         @@ -37,10 +39,44 @@ class Hocon::Impl::Parseable 
     | 
|
| 
       37 
39 
     | 
    
         
             
                end
         
     | 
| 
       38 
40 
     | 
    
         
             
              end
         
     | 
| 
       39 
41 
     | 
    
         | 
| 
      
 42 
     | 
    
         
            +
              class ParseableString < Hocon::Impl::Parseable
         
     | 
| 
      
 43 
     | 
    
         
            +
                def initialize(string, options)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  @input = string
         
     | 
| 
      
 45 
     | 
    
         
            +
                  post_construct(options)
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                def create_origin
         
     | 
| 
      
 49 
     | 
    
         
            +
                  Hocon::Impl::SimpleConfigOrigin.new_simple("String")
         
     | 
| 
      
 50 
     | 
    
         
            +
                end
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
                def reader
         
     | 
| 
      
 53 
     | 
    
         
            +
                  self
         
     | 
| 
      
 54 
     | 
    
         
            +
                end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                def open
         
     | 
| 
      
 57 
     | 
    
         
            +
                  if block_given?
         
     | 
| 
      
 58 
     | 
    
         
            +
                    StringIO.open(@input) do |f|
         
     | 
| 
      
 59 
     | 
    
         
            +
                      yield f
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
                  else
         
     | 
| 
      
 62 
     | 
    
         
            +
                    StringIO.open(@input)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  end
         
     | 
| 
      
 64 
     | 
    
         
            +
                end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
       40 
68 
     | 
    
         
             
              def self.new_file(file_path, options)
         
     | 
| 
       41 
69 
     | 
    
         
             
                ParseableFile.new(file_path, options)
         
     | 
| 
       42 
70 
     | 
    
         
             
              end
         
     | 
| 
       43 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
              def self.new_string(string, options)
         
     | 
| 
      
 73 
     | 
    
         
            +
                ParseableString.new(string, options)
         
     | 
| 
      
 74 
     | 
    
         
            +
              end
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
              def guess_syntax
         
     | 
| 
      
 77 
     | 
    
         
            +
                nil
         
     | 
| 
      
 78 
     | 
    
         
            +
              end
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
       44 
80 
     | 
    
         
             
              def options
         
     | 
| 
       45 
81 
     | 
    
         
             
                @initial_options
         
     | 
| 
       46 
82 
     | 
    
         
             
              end
         
     | 
| 
         @@ -53,8 +89,9 @@ class Hocon::Impl::Parseable 
     | 
|
| 
       53 
89 
     | 
    
         
             
                if value.is_a? Hocon::Impl::AbstractConfigObject
         
     | 
| 
       54 
90 
     | 
    
         
             
                  value
         
     | 
| 
       55 
91 
     | 
    
         
             
                else
         
     | 
| 
       56 
     | 
    
         
            -
                  raise ConfigWrongTypeError.new(value.origin, "", 
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
      
 92 
     | 
    
         
            +
                  raise Hocon::ConfigError::ConfigWrongTypeError.new(value.origin, "",
         
     | 
| 
      
 93 
     | 
    
         
            +
                                                                     "object at file root",
         
     | 
| 
      
 94 
     | 
    
         
            +
                                                                     value.value_type.name)
         
     | 
| 
       58 
95 
     | 
    
         
             
                end
         
     | 
| 
       59 
96 
     | 
    
         
             
              end
         
     | 
| 
       60 
97 
     | 
    
         | 
| 
         @@ -111,7 +148,7 @@ class Hocon::Impl::Parseable 
     | 
|
| 
       111 
148 
     | 
    
         
             
                  syntax = guess_syntax
         
     | 
| 
       112 
149 
     | 
    
         
             
                end
         
     | 
| 
       113 
150 
     | 
    
         
             
                if !syntax
         
     | 
| 
       114 
     | 
    
         
            -
                  syntax = Hocon::ConfigSyntax 
     | 
| 
      
 151 
     | 
    
         
            +
                  syntax = Hocon::ConfigSyntax::CONF
         
     | 
| 
       115 
152 
     | 
    
         
             
                end
         
     | 
| 
       116 
153 
     | 
    
         | 
| 
       117 
154 
     | 
    
         
             
                modified = base_options.with_syntax(syntax)
         
     | 
| 
         @@ -148,4 +185,4 @@ class Hocon::Impl::Parseable 
     | 
|
| 
       148 
185 
     | 
    
         
             
                tokens = Hocon::Impl::Tokenizer.tokenize(origin, io, final_options.syntax)
         
     | 
| 
       149 
186 
     | 
    
         
             
                Hocon::Impl::Parser.parse(tokens, origin, final_options, include_context)
         
     | 
| 
       150 
187 
     | 
    
         
             
              end
         
     | 
| 
       151 
     | 
    
         
            -
            end
         
     | 
| 
      
 188 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,84 +1,97 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: hocon
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.2
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Chris Price
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Wayne Warren
         
     | 
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2014- 
     | 
| 
       13 
     | 
    
         
            -
            dependencies: 
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
               
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-07-23 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 15 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 17 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 18 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 19 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 20 
     | 
    
         
            +
                    version: '2.14'
         
     | 
| 
      
 21 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 22 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 23 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 24 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 25 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 27 
     | 
    
         
            +
                    version: '2.14'
         
     | 
| 
      
 28 
     | 
    
         
            +
            description: "== A port of the Java {Typesafe Config}[https://github.com/typesafehub/config]
         
     | 
| 
      
 29 
     | 
    
         
            +
              library to Ruby"
         
     | 
| 
       16 
30 
     | 
    
         
             
            email: chris@puppetlabs.com
         
     | 
| 
       17 
31 
     | 
    
         
             
            executables: []
         
     | 
| 
       18 
32 
     | 
    
         
             
            extensions: []
         
     | 
| 
       19 
33 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       20 
34 
     | 
    
         
             
            files:
         
     | 
| 
      
 35 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 36 
     | 
    
         
            +
            - README.md
         
     | 
| 
       21 
37 
     | 
    
         
             
            - lib/hocon.rb
         
     | 
| 
       22 
     | 
    
         
            -
            - lib/hocon/config_object.rb
         
     | 
| 
       23 
38 
     | 
    
         
             
            - lib/hocon/config_error.rb
         
     | 
| 
       24 
     | 
    
         
            -
            - lib/hocon/ 
     | 
| 
       25 
     | 
    
         
            -
            - lib/hocon/ 
     | 
| 
       26 
     | 
    
         
            -
            - lib/hocon/ 
     | 
| 
      
 39 
     | 
    
         
            +
            - lib/hocon/config_factory.rb
         
     | 
| 
      
 40 
     | 
    
         
            +
            - lib/hocon/config_object.rb
         
     | 
| 
      
 41 
     | 
    
         
            +
            - lib/hocon/config_parse_options.rb
         
     | 
| 
      
 42 
     | 
    
         
            +
            - lib/hocon/config_render_options.rb
         
     | 
| 
      
 43 
     | 
    
         
            +
            - lib/hocon/config_syntax.rb
         
     | 
| 
      
 44 
     | 
    
         
            +
            - lib/hocon/config_value_type.rb
         
     | 
| 
      
 45 
     | 
    
         
            +
            - lib/hocon/impl.rb
         
     | 
| 
      
 46 
     | 
    
         
            +
            - lib/hocon/impl/abstract_config_object.rb
         
     | 
| 
      
 47 
     | 
    
         
            +
            - lib/hocon/impl/abstract_config_value.rb
         
     | 
| 
      
 48 
     | 
    
         
            +
            - lib/hocon/impl/config_concatenation.rb
         
     | 
| 
      
 49 
     | 
    
         
            +
            - lib/hocon/impl/config_float.rb
         
     | 
| 
      
 50 
     | 
    
         
            +
            - lib/hocon/impl/config_impl.rb
         
     | 
| 
      
 51 
     | 
    
         
            +
            - lib/hocon/impl/config_impl_util.rb
         
     | 
| 
       27 
52 
     | 
    
         
             
            - lib/hocon/impl/config_int.rb
         
     | 
| 
       28 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
       29 
     | 
    
         
            -
            - lib/hocon/impl/simple_config_origin.rb
         
     | 
| 
       30 
     | 
    
         
            -
            - lib/hocon/impl/token.rb
         
     | 
| 
      
 53 
     | 
    
         
            +
            - lib/hocon/impl/config_number.rb
         
     | 
| 
       31 
54 
     | 
    
         
             
            - lib/hocon/impl/config_string.rb
         
     | 
| 
       32 
     | 
    
         
            -
            - lib/hocon/impl/config_float.rb
         
     | 
| 
       33 
55 
     | 
    
         
             
            - lib/hocon/impl/full_includer.rb
         
     | 
| 
      
 56 
     | 
    
         
            +
            - lib/hocon/impl/origin_type.rb
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/hocon/impl/parseable.rb
         
     | 
| 
       34 
58 
     | 
    
         
             
            - lib/hocon/impl/parser.rb
         
     | 
| 
       35 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
       36 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
       37 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/hocon/impl/path.rb
         
     | 
| 
      
 60 
     | 
    
         
            +
            - lib/hocon/impl/path_builder.rb
         
     | 
| 
      
 61 
     | 
    
         
            +
            - lib/hocon/impl/resolve_status.rb
         
     | 
| 
      
 62 
     | 
    
         
            +
            - lib/hocon/impl/simple_config.rb
         
     | 
| 
      
 63 
     | 
    
         
            +
            - lib/hocon/impl/simple_config_list.rb
         
     | 
| 
      
 64 
     | 
    
         
            +
            - lib/hocon/impl/simple_config_object.rb
         
     | 
| 
      
 65 
     | 
    
         
            +
            - lib/hocon/impl/simple_config_origin.rb
         
     | 
| 
       38 
66 
     | 
    
         
             
            - lib/hocon/impl/simple_include_context.rb
         
     | 
| 
      
 67 
     | 
    
         
            +
            - lib/hocon/impl/simple_includer.rb
         
     | 
| 
      
 68 
     | 
    
         
            +
            - lib/hocon/impl/token.rb
         
     | 
| 
       39 
69 
     | 
    
         
             
            - lib/hocon/impl/token_type.rb
         
     | 
| 
       40 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
       41 
     | 
    
         
            -
            - lib/hocon/impl/ 
     | 
| 
       42 
     | 
    
         
            -
            - lib/hocon/impl/path.rb
         
     | 
| 
      
 70 
     | 
    
         
            +
            - lib/hocon/impl/tokenizer.rb
         
     | 
| 
      
 71 
     | 
    
         
            +
            - lib/hocon/impl/tokens.rb
         
     | 
| 
       43 
72 
     | 
    
         
             
            - lib/hocon/impl/unmergeable.rb
         
     | 
| 
       44 
     | 
    
         
            -
            - lib/hocon/impl/config_impl_util.rb
         
     | 
| 
       45 
     | 
    
         
            -
            - lib/hocon/impl/simple_config_object.rb
         
     | 
| 
       46 
     | 
    
         
            -
            - lib/hocon/impl/simple_config_list.rb
         
     | 
| 
       47 
     | 
    
         
            -
            - lib/hocon/impl/config_impl.rb
         
     | 
| 
       48 
     | 
    
         
            -
            - lib/hocon/impl/config_concatenation.rb
         
     | 
| 
       49 
     | 
    
         
            -
            - lib/hocon/impl/abstract_config_value.rb
         
     | 
| 
       50 
     | 
    
         
            -
            - lib/hocon/impl/origin_type.rb
         
     | 
| 
       51 
     | 
    
         
            -
            - lib/hocon/config_factory.rb
         
     | 
| 
       52 
     | 
    
         
            -
            - lib/hocon/impl.rb
         
     | 
| 
       53 
     | 
    
         
            -
            - lib/hocon/config_parse_options.rb
         
     | 
| 
       54 
     | 
    
         
            -
            - lib/hocon/config_render_options.rb
         
     | 
| 
       55 
     | 
    
         
            -
            - lib/hocon/config_value_type.rb
         
     | 
| 
       56 
     | 
    
         
            -
            - lib/hocon/config_syntax.rb
         
     | 
| 
       57 
     | 
    
         
            -
            - LICENSE
         
     | 
| 
       58 
     | 
    
         
            -
            - README.md
         
     | 
| 
       59 
73 
     | 
    
         
             
            homepage: https://github.com/cprice404/ruby-hocon
         
     | 
| 
       60 
74 
     | 
    
         
             
            licenses:
         
     | 
| 
       61 
75 
     | 
    
         
             
            - Apache License, v2
         
     | 
| 
      
 76 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       62 
77 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       63 
78 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       64 
79 
     | 
    
         
             
            require_paths:
         
     | 
| 
       65 
80 
     | 
    
         
             
            - lib
         
     | 
| 
       66 
81 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       67 
     | 
    
         
            -
              none: false
         
     | 
| 
       68 
82 
     | 
    
         
             
              requirements:
         
     | 
| 
       69 
     | 
    
         
            -
              - -  
     | 
| 
      
 83 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       70 
84 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       71 
85 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       72 
86 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       73 
     | 
    
         
            -
              none: false
         
     | 
| 
       74 
87 
     | 
    
         
             
              requirements:
         
     | 
| 
       75 
     | 
    
         
            -
              - -  
     | 
| 
      
 88 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       76 
89 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       77 
90 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       78 
91 
     | 
    
         
             
            requirements: []
         
     | 
| 
       79 
92 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       80 
     | 
    
         
            -
            rubygems_version:  
     | 
| 
      
 93 
     | 
    
         
            +
            rubygems_version: 2.2.2
         
     | 
| 
       81 
94 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       82 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 95 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       83 
96 
     | 
    
         
             
            summary: HOCON Config Library
         
     | 
| 
       84 
97 
     | 
    
         
             
            test_files: []
         
     |