hocon 0.9.0 → 0.9.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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/hocon/impl/config_node_object.rb +13 -5
- data/lib/hocon/impl/tokens.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b83f298bac04a371f8806c9eb4ab4813430fdad4
|
4
|
+
data.tar.gz: ee461805b59d80a73c578f07d911fd34fffc7d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aeca7ac2e5493aabacadfb1b9d68038b2b47221229cdb310c180e1df9184a1e975eaa7e67d4828913e272d43d09c4fe1b875fd8c87d69d7e030f94e2c80d5e5
|
7
|
+
data.tar.gz: f0f17f65d42707a65688911d3d3848a4fcb47c477b89945fc2de970cd12b9a0636fa376b52d9a6ef161d26c336eda1a05566ca049c96be9f52962989f6c56faa
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 0.9.1
|
2
|
+
|
3
|
+
This is a bugfix release.
|
4
|
+
* Fixed a bug wherein ugly configurations were being generated due to the addition of new objects when a setting
|
5
|
+
is set at a path that does not currently exist in the configuration. Previously, these new objects were being
|
6
|
+
added as single-line objects. They will now be added as multi-line objects if the parent object is a multi-line
|
7
|
+
object or is an empty root object.
|
8
|
+
|
1
9
|
## 0.9.0
|
2
10
|
|
3
11
|
This is a promotion of the 0.1.0 release with one small bug fix:
|
@@ -126,6 +126,10 @@ class Hocon::Impl::ConfigNodeObject
|
|
126
126
|
seen_new_line = false
|
127
127
|
indentation = []
|
128
128
|
|
129
|
+
if @children.empty?
|
130
|
+
return indentation
|
131
|
+
end
|
132
|
+
|
129
133
|
@children.each_index do |i|
|
130
134
|
unless seen_new_line
|
131
135
|
if @children[i].is_a?(Hocon::Impl::ConfigNodeSingleToken) && Tokens.newline?(@children[i].token)
|
@@ -151,13 +155,14 @@ class Hocon::Impl::ConfigNodeObject
|
|
151
155
|
last = @children[-1]
|
152
156
|
if last.is_a?(Hocon::Impl::ConfigNodeSingleToken) && last.token.equal?(Tokens::CLOSE_CURLY)
|
153
157
|
beforeLast = @children[-2]
|
158
|
+
indent = ""
|
154
159
|
if beforeLast.is_a?(Hocon::Impl::ConfigNodeSingleToken) &&
|
155
160
|
Tokens.ignored_whitespace?(beforeLast.token)
|
156
161
|
indent = beforeLast.token.token_text
|
157
|
-
indent += " "
|
158
|
-
indentation.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_ignored_whitespace(nil, indent)))
|
159
|
-
return indentation
|
160
162
|
end
|
163
|
+
indent += " "
|
164
|
+
indentation.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_ignored_whitespace(nil, indent)))
|
165
|
+
return indentation
|
161
166
|
end
|
162
167
|
end
|
163
168
|
|
@@ -176,7 +181,7 @@ class Hocon::Impl::ConfigNodeObject
|
|
176
181
|
else
|
177
182
|
indented_value = value
|
178
183
|
end
|
179
|
-
same_line = !(indentation[0].is_a?(Hocon::Impl::ConfigNodeSingleToken) &&
|
184
|
+
same_line = !(indentation.length > 0 && indentation[0].is_a?(Hocon::Impl::ConfigNodeSingleToken) &&
|
180
185
|
Tokens.newline?(indentation[0].token))
|
181
186
|
|
182
187
|
# If the path is of length greater than one, see if the value needs to be added further down
|
@@ -211,7 +216,10 @@ class Hocon::Impl::ConfigNodeObject
|
|
211
216
|
# If the path is of length greater than one add the required new objects along the path
|
212
217
|
new_object_nodes = []
|
213
218
|
new_object_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens::OPEN_CURLY))
|
214
|
-
|
219
|
+
if indentation.empty?
|
220
|
+
new_object_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_line(nil)))
|
221
|
+
end
|
222
|
+
new_object_nodes += indentation
|
215
223
|
new_object_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens::CLOSE_CURLY))
|
216
224
|
new_object = self.class.new(new_object_nodes)
|
217
225
|
new_nodes.push(new_object.add_value_on_path(desired_path.sub_path(1), indented_value, flavor))
|
data/lib/hocon/impl/tokens.rb
CHANGED
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: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Price
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2015-
|
15
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: bundler
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
160
|
rubyforge_project:
|
161
|
-
rubygems_version: 2.
|
161
|
+
rubygems_version: 2.4.6
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: HOCON Config Library
|