hocon 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 336e47bf6c04b6b8c7d9fe769cfb5a7d80227e5d
4
- data.tar.gz: a74955786d95546de69fc8c5bb98634848387a74
3
+ metadata.gz: b83f298bac04a371f8806c9eb4ab4813430fdad4
4
+ data.tar.gz: ee461805b59d80a73c578f07d911fd34fffc7d72
5
5
  SHA512:
6
- metadata.gz: 1ee3d3aaa08eaaf337fd8fd32ecc3b184401b0335a430b544d7ab1d7e691905526c4c727e56be82e0a70bb77556d6cf5effb12359e734e9d9ad796a22b50aaa4
7
- data.tar.gz: b8fd8823f59d498714ba09a9f68fe1e069d2861cd393b08c5970b8c1630dc80b1ba5acd5de99a9dd4e6e09775c60ca1746f61139cfa4a03162f82ed8108b353c
6
+ metadata.gz: 7aeca7ac2e5493aabacadfb1b9d68038b2b47221229cdb310c180e1df9184a1e975eaa7e67d4828913e272d43d09c4fe1b875fd8c87d69d7e030f94e2c80d5e5
7
+ data.tar.gz: f0f17f65d42707a65688911d3d3848a4fcb47c477b89945fc2de970cd12b9a0636fa376b52d9a6ef161d26c336eda1a05566ca049c96be9f52962989f6c56faa
@@ -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
- new_object_nodes.push(Hocon::Impl::ConfigNodeSingleToken.new(Tokens.new_ignored_whitespace(nil, ' ')))
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))
@@ -166,7 +166,7 @@ class Hocon::Impl::Tokens
166
166
  sb << " ("
167
167
  sb << message
168
168
  sb << ")"
169
- sb.to_s
169
+ sb.string
170
170
  end
171
171
 
172
172
  def can_equal(other)
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.0
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-04-10 00:00:00.000000000 Z
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.2.2
161
+ rubygems_version: 2.4.6
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: HOCON Config Library