hocon 1.1.3 → 1.3.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 +5 -5
- data/CHANGELOG.md +35 -1
- data/HISTORY.md +2140 -0
- data/README.md +125 -0
- data/bin/hocon +5 -0
- data/lib/hocon/cli.rb +225 -0
- data/lib/hocon/config_render_options.rb +3 -2
- data/lib/hocon/impl/abstract_config_value.rb +7 -10
- data/lib/hocon/impl/config_delayed_merge.rb +1 -1
- data/lib/hocon/impl/config_impl.rb +18 -0
- data/lib/hocon/impl/config_node_object.rb +1 -2
- data/lib/hocon/impl/config_node_root.rb +1 -1
- data/lib/hocon/impl/parseable.rb +6 -5
- data/lib/hocon/impl/simple_config_document.rb +1 -1
- data/lib/hocon/impl/simple_config_origin.rb +8 -2
- data/lib/hocon/version.rb +5 -0
- metadata +9 -50
- data/spec/fixtures/hocon/by_extension/cat.conf +0 -4
- data/spec/fixtures/hocon/by_extension/cat.test +0 -4
- data/spec/fixtures/hocon/by_extension/cat.test-json +0 -3
- data/spec/fixtures/hocon/with_substitution/subst.conf +0 -2
- data/spec/fixtures/parse_render/example1/input.conf +0 -21
- data/spec/fixtures/parse_render/example1/output.conf +0 -26
- data/spec/fixtures/parse_render/example1/output_nocomments.conf +0 -17
- data/spec/fixtures/parse_render/example2/input.conf +0 -10
- data/spec/fixtures/parse_render/example2/output.conf +0 -17
- data/spec/fixtures/parse_render/example2/output_nocomments.conf +0 -17
- data/spec/fixtures/parse_render/example3/input.conf +0 -2
- data/spec/fixtures/parse_render/example3/output.conf +0 -2
- data/spec/fixtures/parse_render/example4/input.json +0 -6
- data/spec/fixtures/parse_render/example4/output.conf +0 -6
- data/spec/fixtures/test_utils/resources/bom.conf +0 -2
- data/spec/fixtures/test_utils/resources/cycle.conf +0 -1
- data/spec/fixtures/test_utils/resources/file-include.conf +0 -5
- data/spec/fixtures/test_utils/resources/include-from-list.conf +0 -4
- data/spec/fixtures/test_utils/resources/subdir/bar.conf +0 -1
- data/spec/fixtures/test_utils/resources/subdir/baz.conf +0 -1
- data/spec/fixtures/test_utils/resources/subdir/foo.conf +0 -5
- data/spec/fixtures/test_utils/resources/test01.conf +0 -80
- data/spec/fixtures/test_utils/resources/test01.json +0 -4
- data/spec/fixtures/test_utils/resources/test03.conf +0 -36
- data/spec/fixtures/test_utils/resources/utf16.conf +0 -0
- data/spec/fixtures/test_utils/resources/utf8.conf +0 -2
- data/spec/fixtures/test_utils/resources//341/232/240/341/233/207/341/232/273.conf +0 -2
- data/spec/spec_helper.rb +0 -43
- data/spec/test_utils.rb +0 -757
- data/spec/unit/hocon/README.md +0 -7
- data/spec/unit/hocon/hocon_spec.rb +0 -114
- data/spec/unit/typesafe/config/README.md +0 -4
- data/spec/unit/typesafe/config/concatenation_spec.rb +0 -417
- data/spec/unit/typesafe/config/conf_parser_spec.rb +0 -832
- data/spec/unit/typesafe/config/config_document_parser_spec.rb +0 -494
- data/spec/unit/typesafe/config/config_document_spec.rb +0 -576
- data/spec/unit/typesafe/config/config_factory_spec.rb +0 -120
- data/spec/unit/typesafe/config/config_node_spec.rb +0 -552
- data/spec/unit/typesafe/config/config_value_factory_spec.rb +0 -85
- data/spec/unit/typesafe/config/config_value_spec.rb +0 -935
- data/spec/unit/typesafe/config/path_spec.rb +0 -261
- data/spec/unit/typesafe/config/public_api_spec.rb +0 -520
- data/spec/unit/typesafe/config/simple_config_spec.rb +0 -112
- data/spec/unit/typesafe/config/token_spec.rb +0 -188
- data/spec/unit/typesafe/config/tokenizer_spec.rb +0 -801
@@ -206,7 +206,6 @@ class Hocon::Impl::ConfigNodeObject
|
|
206
206
|
new_nodes = []
|
207
207
|
new_nodes += indentation
|
208
208
|
new_nodes.push(desired_path.first)
|
209
|
-
new_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_ignored_whitespace(nil, ' ')))
|
210
209
|
new_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens::COLON))
|
211
210
|
new_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_ignored_whitespace(nil, ' ')))
|
212
211
|
|
@@ -281,4 +280,4 @@ class Hocon::Impl::ConfigNodeObject
|
|
281
280
|
path = Hocon::Impl::PathParser.parse_path_node(desired_path, flavor).value
|
282
281
|
change_value_on_path(path, nil, flavor)
|
283
282
|
end
|
284
|
-
end
|
283
|
+
end
|
data/lib/hocon/impl/parseable.rb
CHANGED
@@ -35,10 +35,11 @@ class Hocon::Impl::Parseable
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
#
|
39
|
-
#
|
40
|
-
|
41
|
-
|
38
|
+
# The upstream library seems to use this as a global way of keeping track of
|
39
|
+
# how many files have been included, to avoid cycles
|
40
|
+
def self.parse_stack
|
41
|
+
Thread.current[:hocon_parse_stack] ||= []
|
42
|
+
end
|
42
43
|
|
43
44
|
MAX_INCLUDE_DEPTH = 50
|
44
45
|
|
@@ -134,7 +135,7 @@ class Hocon::Impl::Parseable
|
|
134
135
|
if (base_options.nil?)
|
135
136
|
base_options = options
|
136
137
|
end
|
137
|
-
stack =
|
138
|
+
stack = self.class.parse_stack
|
138
139
|
if stack.length >= MAX_INCLUDE_DEPTH
|
139
140
|
raise Hocon::ConfigError::ConfigParseError.new(@initial_origin,
|
140
141
|
"include statements nested more than #{MAX_INCLUDE_DEPTH} times, " +
|
@@ -23,6 +23,9 @@ class Hocon::Impl::SimpleConfigOrigin
|
|
23
23
|
@line_number = line_number
|
24
24
|
@end_line_number = end_line_number
|
25
25
|
@origin_type = origin_type
|
26
|
+
|
27
|
+
# TODO: Currently ruby hocon does not support URLs, and so this variable
|
28
|
+
# is not actually a URL/URI, but a string
|
26
29
|
@url_or_nil = url_or_nil
|
27
30
|
@resource_or_nil = resource_or_nil
|
28
31
|
@comments_or_nil = comments_or_nil
|
@@ -39,10 +42,9 @@ class Hocon::Impl::SimpleConfigOrigin
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def self.new_file(file_path)
|
42
|
-
url = URI.join('file:///', file_path)
|
43
45
|
self.new(file_path, -1, -1,
|
44
46
|
OriginType::FILE,
|
45
|
-
|
47
|
+
file_path, nil, nil)
|
46
48
|
end
|
47
49
|
|
48
50
|
# NOTE: not porting `new_url` because we're not going to support URLs for now
|
@@ -153,6 +155,10 @@ class Hocon::Impl::SimpleConfigOrigin
|
|
153
155
|
end
|
154
156
|
|
155
157
|
def filename
|
158
|
+
# TODO because we don't support URLs, this function's URL handling
|
159
|
+
# is completely pointless. It will only return _description (a string that
|
160
|
+
# is the file path) or nil.
|
161
|
+
# It should be cleaned up
|
156
162
|
if origin_type == OriginType::FILE
|
157
163
|
_description
|
158
164
|
elsif ! url_or_nil.nil?
|
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.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Price
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2016-10-
|
16
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|
@@ -46,14 +46,18 @@ dependencies:
|
|
46
46
|
description: "== A port of the Java {Typesafe Config}[https://github.com/typesafehub/config]
|
47
47
|
library to Ruby"
|
48
48
|
email: chris@puppetlabs.com
|
49
|
-
executables:
|
49
|
+
executables:
|
50
|
+
- hocon
|
50
51
|
extensions: []
|
51
52
|
extra_rdoc_files: []
|
52
53
|
files:
|
53
54
|
- CHANGELOG.md
|
55
|
+
- HISTORY.md
|
54
56
|
- LICENSE
|
55
57
|
- README.md
|
58
|
+
- bin/hocon
|
56
59
|
- lib/hocon.rb
|
60
|
+
- lib/hocon/cli.rb
|
57
61
|
- lib/hocon/config.rb
|
58
62
|
- lib/hocon/config_error.rb
|
59
63
|
- lib/hocon/config_factory.rb
|
@@ -139,51 +143,7 @@ files:
|
|
139
143
|
- lib/hocon/parser/config_document.rb
|
140
144
|
- lib/hocon/parser/config_document_factory.rb
|
141
145
|
- lib/hocon/parser/config_node.rb
|
142
|
-
-
|
143
|
-
- spec/fixtures/hocon/by_extension/cat.test
|
144
|
-
- spec/fixtures/hocon/by_extension/cat.test-json
|
145
|
-
- spec/fixtures/hocon/with_substitution/subst.conf
|
146
|
-
- spec/fixtures/parse_render/example1/input.conf
|
147
|
-
- spec/fixtures/parse_render/example1/output.conf
|
148
|
-
- spec/fixtures/parse_render/example1/output_nocomments.conf
|
149
|
-
- spec/fixtures/parse_render/example2/input.conf
|
150
|
-
- spec/fixtures/parse_render/example2/output.conf
|
151
|
-
- spec/fixtures/parse_render/example2/output_nocomments.conf
|
152
|
-
- spec/fixtures/parse_render/example3/input.conf
|
153
|
-
- spec/fixtures/parse_render/example3/output.conf
|
154
|
-
- spec/fixtures/parse_render/example4/input.json
|
155
|
-
- spec/fixtures/parse_render/example4/output.conf
|
156
|
-
- spec/fixtures/test_utils/resources/bom.conf
|
157
|
-
- spec/fixtures/test_utils/resources/cycle.conf
|
158
|
-
- spec/fixtures/test_utils/resources/file-include.conf
|
159
|
-
- spec/fixtures/test_utils/resources/include-from-list.conf
|
160
|
-
- spec/fixtures/test_utils/resources/subdir/bar.conf
|
161
|
-
- spec/fixtures/test_utils/resources/subdir/baz.conf
|
162
|
-
- spec/fixtures/test_utils/resources/subdir/foo.conf
|
163
|
-
- spec/fixtures/test_utils/resources/test01.conf
|
164
|
-
- spec/fixtures/test_utils/resources/test01.json
|
165
|
-
- spec/fixtures/test_utils/resources/test03.conf
|
166
|
-
- spec/fixtures/test_utils/resources/utf16.conf
|
167
|
-
- spec/fixtures/test_utils/resources/utf8.conf
|
168
|
-
- spec/fixtures/test_utils/resources/ᚠᛇᚻ.conf
|
169
|
-
- spec/spec_helper.rb
|
170
|
-
- spec/test_utils.rb
|
171
|
-
- spec/unit/hocon/README.md
|
172
|
-
- spec/unit/hocon/hocon_spec.rb
|
173
|
-
- spec/unit/typesafe/config/README.md
|
174
|
-
- spec/unit/typesafe/config/concatenation_spec.rb
|
175
|
-
- spec/unit/typesafe/config/conf_parser_spec.rb
|
176
|
-
- spec/unit/typesafe/config/config_document_parser_spec.rb
|
177
|
-
- spec/unit/typesafe/config/config_document_spec.rb
|
178
|
-
- spec/unit/typesafe/config/config_factory_spec.rb
|
179
|
-
- spec/unit/typesafe/config/config_node_spec.rb
|
180
|
-
- spec/unit/typesafe/config/config_value_factory_spec.rb
|
181
|
-
- spec/unit/typesafe/config/config_value_spec.rb
|
182
|
-
- spec/unit/typesafe/config/path_spec.rb
|
183
|
-
- spec/unit/typesafe/config/public_api_spec.rb
|
184
|
-
- spec/unit/typesafe/config/simple_config_spec.rb
|
185
|
-
- spec/unit/typesafe/config/token_spec.rb
|
186
|
-
- spec/unit/typesafe/config/tokenizer_spec.rb
|
146
|
+
- lib/hocon/version.rb
|
187
147
|
homepage: https://github.com/puppetlabs/ruby-hocon
|
188
148
|
licenses:
|
189
149
|
- Apache License, v2
|
@@ -203,8 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
163
|
- !ruby/object:Gem::Version
|
204
164
|
version: '0'
|
205
165
|
requirements: []
|
206
|
-
|
207
|
-
rubygems_version: 2.2.5
|
166
|
+
rubygems_version: 3.0.6
|
208
167
|
signing_key:
|
209
168
|
specification_version: 4
|
210
169
|
summary: HOCON Config Library
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# These are some opening comments
|
2
|
-
# These are some additional opening comments
|
3
|
-
foo.bar {
|
4
|
-
// the baz is is blah blah
|
5
|
-
baz = 42
|
6
|
-
boom = [1, 2, {derp : duh }, 4]
|
7
|
-
empty = []
|
8
|
-
|
9
|
-
# abracadabra setting
|
10
|
-
abracadabra = "hi"
|
11
|
-
}
|
12
|
-
|
13
|
-
// as for the yippee
|
14
|
-
# it entails some things
|
15
|
-
foo.bar.yahoo = "yippee"
|
16
|
-
|
17
|
-
# truthy
|
18
|
-
foo.bar.truthy = true
|
19
|
-
|
20
|
-
# falsy
|
21
|
-
foo.bar.falsy = false
|
@@ -1,26 +0,0 @@
|
|
1
|
-
foo {
|
2
|
-
# These are some opening comments
|
3
|
-
# These are some additional opening comments
|
4
|
-
bar {
|
5
|
-
# falsy
|
6
|
-
falsy=false
|
7
|
-
# truthy
|
8
|
-
truthy=true
|
9
|
-
# as for the yippee
|
10
|
-
# it entails some things
|
11
|
-
yahoo=yippee
|
12
|
-
# the baz is is blah blah
|
13
|
-
baz=42
|
14
|
-
boom=[
|
15
|
-
1,
|
16
|
-
2,
|
17
|
-
{
|
18
|
-
derp=duh
|
19
|
-
},
|
20
|
-
4
|
21
|
-
]
|
22
|
-
empty=[]
|
23
|
-
# abracadabra setting
|
24
|
-
abracadabra=hi
|
25
|
-
}
|
26
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
jruby-puppet {
|
2
|
-
jruby-pools=[
|
3
|
-
{
|
4
|
-
environment=production
|
5
|
-
}
|
6
|
-
]
|
7
|
-
load-path=[
|
8
|
-
"/usr/lib/ruby/site_ruby/1.8",
|
9
|
-
"/usr/lib/ruby/site_ruby/1.8"
|
10
|
-
]
|
11
|
-
master-conf-dir="/etc/puppet"
|
12
|
-
master-var-dir="/var/lib/puppet"
|
13
|
-
}
|
14
|
-
|
15
|
-
webserver {
|
16
|
-
host="1.2.3.4"
|
17
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
jruby-puppet {
|
2
|
-
jruby-pools=[
|
3
|
-
{
|
4
|
-
environment=production
|
5
|
-
}
|
6
|
-
]
|
7
|
-
load-path=[
|
8
|
-
"/usr/lib/ruby/site_ruby/1.8",
|
9
|
-
"/usr/lib/ruby/site_ruby/1.8"
|
10
|
-
]
|
11
|
-
master-conf-dir="/etc/puppet"
|
12
|
-
master-var-dir="/var/lib/puppet"
|
13
|
-
}
|
14
|
-
|
15
|
-
webserver {
|
16
|
-
host="1.2.3.4"
|
17
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
include "cycle.conf"
|
@@ -1 +0,0 @@
|
|
1
|
-
bar=43
|
@@ -1 +0,0 @@
|
|
1
|
-
baz=45
|
@@ -1,80 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"ints" : {
|
3
|
-
"fortyTwo" : 42,
|
4
|
-
"fortyTwoAgain" : ${ints.fortyTwo}
|
5
|
-
},
|
6
|
-
|
7
|
-
"floats" : {
|
8
|
-
"fortyTwoPointOne" : 42.1,
|
9
|
-
"fortyTwoPointOneAgain" : ${floats.fortyTwoPointOne}
|
10
|
-
},
|
11
|
-
|
12
|
-
"strings" : {
|
13
|
-
"abcd" : "abcd",
|
14
|
-
"abcdAgain" : ${strings.a}${strings.b}${strings.c}${strings.d},
|
15
|
-
"a" : "a",
|
16
|
-
"b" : "b",
|
17
|
-
"c" : "c",
|
18
|
-
"d" : "d",
|
19
|
-
"concatenated" : null bar 42 baz true 3.14 hi,
|
20
|
-
"double" : "3.14",
|
21
|
-
"number" : "57",
|
22
|
-
"null" : "null",
|
23
|
-
"true" : "true",
|
24
|
-
"yes" : "yes",
|
25
|
-
"false" : "false",
|
26
|
-
"no" : "no"
|
27
|
-
},
|
28
|
-
|
29
|
-
"arrays" : {
|
30
|
-
"empty" : [],
|
31
|
-
"ofInt" : [1, 2, 3],
|
32
|
-
"ofString" : [ ${strings.a}, ${strings.b}, ${strings.c} ],
|
33
|
-
"ofDouble" : [3.14, 4.14, 5.14],
|
34
|
-
"ofNull" : [null, null, null],
|
35
|
-
"ofBoolean" : [true, false],
|
36
|
-
"ofArray" : [${arrays.ofString}, ${arrays.ofString}, ${arrays.ofString}],
|
37
|
-
"ofObject" : [${ints}, ${booleans}, ${strings}],
|
38
|
-
"firstElementNotASubst" : [ "a", ${strings.b} ]
|
39
|
-
},
|
40
|
-
|
41
|
-
"booleans" : {
|
42
|
-
"true" : true,
|
43
|
-
"trueAgain" : ${booleans.true},
|
44
|
-
"false" : false,
|
45
|
-
"falseAgain" : ${booleans.false}
|
46
|
-
},
|
47
|
-
|
48
|
-
"nulls" : {
|
49
|
-
"null" : null,
|
50
|
-
"nullAgain" : ${nulls.null}
|
51
|
-
},
|
52
|
-
|
53
|
-
"durations" : {
|
54
|
-
"second" : 1s,
|
55
|
-
"secondsList" : [1s,2seconds,3 s, 4000],
|
56
|
-
"secondAsNumber" : 1000,
|
57
|
-
"halfSecond" : 0.5s,
|
58
|
-
"millis" : 1 milli,
|
59
|
-
"micros" : 2000 micros
|
60
|
-
},
|
61
|
-
|
62
|
-
"memsizes" : {
|
63
|
-
"meg" : 1M,
|
64
|
-
"megsList" : [1M, 1024K, 1048576],
|
65
|
-
"megAsNumber" : 1048576,
|
66
|
-
"halfMeg" : 0.5M
|
67
|
-
},
|
68
|
-
|
69
|
-
"system" : {
|
70
|
-
"javaversion" : ${?java.version},
|
71
|
-
"userhome" : ${?user.home},
|
72
|
-
"home" : ${?HOME},
|
73
|
-
"pwd" : ${?PWD},
|
74
|
-
"shell" : ${?SHELL},
|
75
|
-
"lang" : ${?LANG},
|
76
|
-
"path" : ${?PATH},
|
77
|
-
"not_here" : ${?NOT_HERE},
|
78
|
-
"concatenated" : Your Java version is ${?system.javaversion} and your user.home is ${?system.userhome}
|
79
|
-
}
|
80
|
-
}
|