hocon 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hocon/impl/parseable.rb +2 -1
- data/lib/hocon/impl/simple_config.rb +10 -10
- data/lib/hocon/impl/tokens.rb +2 -1
- data/spec/unit/hocon/hocon_spec.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f08e68888c20ee9e02810af3779cdda1b2609699
|
4
|
+
data.tar.gz: d9e7a5896f1b30153efe560693fca92666fc39a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0926c1b330c0957878263c8e481c8a436b871605f3d50e0256867994d6c0f1c2301572b753b33975431288b74bf71774739a020ddb364e6681f73bb74ac809ce
|
7
|
+
data.tar.gz: db2b55336bf775f3b2595eb098550ffcfdd2ec23e692f3751f04de10cd56301e4bf49ff13966e04a9a1c8e79a3797145461b7fdc66b5e082bc8104af7dbbc39f
|
data/CHANGELOG.md
CHANGED
data/lib/hocon/impl/parseable.rb
CHANGED
@@ -5,6 +5,7 @@ require 'pathname'
|
|
5
5
|
require 'hocon/impl'
|
6
6
|
require 'hocon/config_error'
|
7
7
|
require 'hocon/config_syntax'
|
8
|
+
require 'hocon/config_value_type'
|
8
9
|
require 'hocon/impl/config_impl'
|
9
10
|
require 'hocon/impl/simple_include_context'
|
10
11
|
require 'hocon/impl/simple_config_object'
|
@@ -125,7 +126,7 @@ class Hocon::Impl::Parseable
|
|
125
126
|
raise Hocon::ConfigError::ConfigWrongTypeError.with_expected_actual(value.origin,
|
126
127
|
"",
|
127
128
|
"object at file root",
|
128
|
-
value.value_type
|
129
|
+
Hocon::ConfigValueType.value_type_name(value.value_type))
|
129
130
|
end
|
130
131
|
end
|
131
132
|
|
@@ -118,11 +118,11 @@ class Hocon::Impl::SimpleConfig
|
|
118
118
|
v = Hocon::Impl::DefaultTransformer.transform(v, expected)
|
119
119
|
end
|
120
120
|
|
121
|
-
if (not expected.nil?) && (v.value_type != expected && v.value_type !=
|
121
|
+
if (not expected.nil?) && (v.value_type != expected && v.value_type != ConfigValueType::NULL)
|
122
122
|
raise Hocon::ConfigError::ConfigWrongTypeError.with_expected_actual(v.origin,
|
123
123
|
original_path.render,
|
124
|
-
|
125
|
-
|
124
|
+
ConfigValueType.value_type_name(expected),
|
125
|
+
ConfigValueType.value_type_name(v.value_type))
|
126
126
|
else
|
127
127
|
return v
|
128
128
|
end
|
@@ -138,7 +138,7 @@ class Hocon::Impl::SimpleConfig
|
|
138
138
|
else
|
139
139
|
o = find_key(me,
|
140
140
|
key,
|
141
|
-
|
141
|
+
ConfigValueType::OBJECT,
|
142
142
|
original_path.sub_path(0, original_path.length - remainder.length))
|
143
143
|
|
144
144
|
if o.nil?
|
@@ -155,7 +155,7 @@ class Hocon::Impl::SimpleConfig
|
|
155
155
|
def is_null?(path_expression)
|
156
156
|
path = Path.new_path(path_expression)
|
157
157
|
v = self.class.find_or_null(@object, path, nil, path)
|
158
|
-
v.value_type ==
|
158
|
+
v.value_type == ConfigValueType::NULL
|
159
159
|
end
|
160
160
|
|
161
161
|
def get_value(path)
|
@@ -178,7 +178,7 @@ class Hocon::Impl::SimpleConfig
|
|
178
178
|
get_config_number(path)
|
179
179
|
end
|
180
180
|
|
181
|
-
def get_string(path)
|
181
|
+
def get_string(path)
|
182
182
|
v = find2(path, ConfigValueType::STRING)
|
183
183
|
v.unwrapped
|
184
184
|
end
|
@@ -220,8 +220,8 @@ class Hocon::Impl::SimpleConfig
|
|
220
220
|
end
|
221
221
|
if v.value_type != expected
|
222
222
|
raise ConfigWrongTypeError.with_expected_actual(origin, path,
|
223
|
-
"list of #{
|
224
|
-
"list of #{v.value_type
|
223
|
+
"list of #{ConfigValueType.value_type_name(expected)}",
|
224
|
+
"list of #{ConfigValueType.value_type_name(v.value_type)}")
|
225
225
|
end
|
226
226
|
l << v.unwrapped
|
227
227
|
end
|
@@ -271,8 +271,8 @@ class Hocon::Impl::SimpleConfig
|
|
271
271
|
end
|
272
272
|
if v.value_type != expected
|
273
273
|
raise ConfigWrongTypeError.with_expected_actual(origin, path,
|
274
|
-
"list of #{
|
275
|
-
"list of #{v.value_type
|
274
|
+
"list of #{ConfigValueType.value_type_name(expected)}",
|
275
|
+
"list of #{ConfigValueType.value_type_name(v.value_type)}")
|
276
276
|
end
|
277
277
|
l << v
|
278
278
|
end
|
data/lib/hocon/impl/tokens.rb
CHANGED
@@ -10,6 +10,7 @@ require 'hocon/impl/config_null'
|
|
10
10
|
require 'hocon/impl/config_boolean'
|
11
11
|
require 'hocon/config_error'
|
12
12
|
require 'hocon/impl/resolve_status'
|
13
|
+
require 'hocon/config_value_type'
|
13
14
|
|
14
15
|
# FIXME the way the subclasses of Token are private with static isFoo and accessors is kind of ridiculous.
|
15
16
|
class Hocon::Impl::Tokens
|
@@ -37,7 +38,7 @@ class Hocon::Impl::Tokens
|
|
37
38
|
if value.resolve_status == ResolveStatus::RESOLVED
|
38
39
|
"'#{value.unwrapped}' (#{Hocon::ConfigValueType.value_type_name(value.value_type)})"
|
39
40
|
else
|
40
|
-
"'<unresolved value>' (#{
|
41
|
+
"'<unresolved value>' ((#{Hocon::ConfigValueType.value_type_name(value.value_type)})"
|
41
42
|
end
|
42
43
|
|
43
44
|
end
|
@@ -7,6 +7,7 @@ require 'hocon/config_error'
|
|
7
7
|
require 'hocon/config_syntax'
|
8
8
|
|
9
9
|
ConfigParseError = Hocon::ConfigError::ConfigParseError
|
10
|
+
ConfigWrongTypeError = Hocon::ConfigError::ConfigWrongTypeError
|
10
11
|
|
11
12
|
describe Hocon do
|
12
13
|
let(:render_options) { Hocon::ConfigRenderOptions.defaults }
|
@@ -44,7 +45,17 @@ describe Hocon do
|
|
44
45
|
let(:conf) { Hocon.parse(string) }
|
45
46
|
include_examples "hocon_parsing"
|
46
47
|
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should fail to parse an array" do
|
51
|
+
puts
|
52
|
+
expect{(Hocon.parse('[1,2,3]'))}.
|
53
|
+
to raise_error(ConfigWrongTypeError)
|
54
|
+
end
|
47
55
|
|
56
|
+
it "should fail to parse an array" do
|
57
|
+
expect{(Hocon.parse('["one", "two" "three"]'))}.
|
58
|
+
to raise_error(ConfigWrongTypeError)
|
48
59
|
end
|
49
60
|
|
50
61
|
context "loading a HOCON file with a substitution" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hocon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Price
|
@@ -9,10 +9,11 @@ authors:
|
|
9
9
|
- Preben Ingvaldsen
|
10
10
|
- Joe Pinsonault
|
11
11
|
- Kevin Corcoran
|
12
|
+
- Jane Lu
|
12
13
|
autorequire:
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
|
-
date: 2016-
|
16
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
16
17
|
dependencies:
|
17
18
|
- !ruby/object:Gem::Dependency
|
18
19
|
name: bundler
|
@@ -199,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
200
|
version: '0'
|
200
201
|
requirements: []
|
201
202
|
rubyforge_project:
|
202
|
-
rubygems_version: 2.5.1
|
203
|
+
rubygems_version: 2.4.5.1
|
203
204
|
signing_key:
|
204
205
|
specification_version: 4
|
205
206
|
summary: HOCON Config Library
|