hocon 1.1.1 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f08e68888c20ee9e02810af3779cdda1b2609699
4
- data.tar.gz: d9e7a5896f1b30153efe560693fca92666fc39a7
3
+ metadata.gz: 313f7a6dd2e038b4a470e80d8342bc3e7607ed0c
4
+ data.tar.gz: 945e4bbde03daafdb38cb99e412e7ce448ff7c81
5
5
  SHA512:
6
- metadata.gz: 0926c1b330c0957878263c8e481c8a436b871605f3d50e0256867994d6c0f1c2301572b753b33975431288b74bf71774739a020ddb364e6681f73bb74ac809ce
7
- data.tar.gz: db2b55336bf775f3b2595eb098550ffcfdd2ec23e692f3751f04de10cd56301e4bf49ff13966e04a9a1c8e79a3797145461b7fdc66b5e082bc8104af7dbbc39f
6
+ metadata.gz: 151f0721cb1d6a82951eb6811f4d841d64070a51073b4836c6f0e7ef7629444049f2d53a9286a4d29c6ee5f514d02285e7322c972ac1fd7275f7752a59c41bb1
7
+ data.tar.gz: 55c1486bccf6850ef061101d89c57df90757650b222d8f1824b013c589156b1ac644514cc39b280eba943c302402f477c8f429714b3fdd89ab0b540f80951bcc
@@ -1,3 +1,9 @@
1
+ ## 1.1.2
2
+ This is a bugfix release.
3
+
4
+ * Fixed bug where Hocon::ConfigFactory.parse_file was not handling files with BOMs on Windows,
5
+ causing UTF-8 files to not load properly.
6
+
1
7
  ## 1.1.1
2
8
  This is a bugfix release.
3
9
 
@@ -412,11 +412,11 @@ class Hocon::Impl::Parseable
412
412
  def open
413
413
  begin
414
414
  if block_given?
415
- File.open(@input) do |f|
415
+ File.open(@input, :encoding => 'bom|utf-8') do |f|
416
416
  yield f
417
417
  end
418
418
  else
419
- File.open(@input)
419
+ File.open(@input, :encoding => 'bom|utf-8')
420
420
  end
421
421
  rescue Errno::ENOENT
422
422
  if @initial_options.allow_missing?
@@ -0,0 +1,2 @@
1
+ #
2
+ ᚠᛇᚻ = ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢ
@@ -0,0 +1,2 @@
1
+ #
2
+ ᚠᛇᚻ = ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢ
@@ -781,22 +781,32 @@ describe "Config Parser" do
781
781
  # Skipping 'includeURLHeuristically' because we don't support URLs
782
782
  # Skipping 'includeURLBasenameHeuristically' because we don't support URLs
783
783
 
784
- it "acceptBOMStartingFile" do
785
- skip("BOM not parsing properly yet; not fixing this now because it most likely only affects windows") do
786
- # BOM at start of file should be ignored
787
- conf = Hocon::ConfigFactory.parse_file(TestUtils.resource_file("bom.conf"))
788
- expect(conf.get_string("foo")).to eq("bar")
784
+ it "shouldacceptUTF8FileNames" do
785
+ skip('UTF-8 filenames not currently supported') do
786
+ expect { Hocon::ConfigFactory.parse_file(TestUtils.resource_file("ᚠᛇᚻ.conf")) }.to raise_error
789
787
  end
790
788
  end
791
789
 
792
- it "acceptBOMStartOfStringConfig" do
793
- skip("BOM not parsing properly yet; not fixing this now because it most likely only affects windows") do
794
- # BOM at start of file is just whitespace, so ignored
795
- conf = Hocon::ConfigFactory.parse_string("\uFEFFfoo=bar")
796
- expect(conf.get_string("foo")).to eq("bar")
790
+ it "acceptsUTF8FileContents" do
791
+ # utf8.conf is UTF-8 with no BOM
792
+ rune_utf8 = "\u16EB\u16D2\u16E6\u16A6\u16EB\u16A0\u16B1\u16A9\u16A0\u16A2"
793
+ conf = Hocon::ConfigFactory.parse_file(TestUtils.resource_file("utf8.conf"))
794
+ expect(conf.get_string("\u16A0\u16C7\u16BB")).to eq(rune_utf8)
795
+ end
796
+
797
+ it "shouldacceptUTF16FileContents" do
798
+ skip('supporting UTF-16 requires appropriate BOM detection during parsing') do
799
+ # utf16.conf is UTF-16LE with a BOM
800
+ expect { Hocon::ConfigFactory.parse_file(TestUtils.resource_file("utf16.conf")) }.to raise_error
797
801
  end
798
802
  end
799
803
 
804
+ it "acceptBOMStartingFile" do
805
+ # BOM at start of file should be ignored
806
+ conf = Hocon::ConfigFactory.parse_file(TestUtils.resource_file("bom.conf"))
807
+ expect(conf.get_string("foo")).to eq("bar")
808
+ end
809
+
800
810
  it "acceptBOMInStringValue" do
801
811
  # BOM inside quotes should be preserved, just as other whitespace would be
802
812
  conf = Hocon::ConfigFactory.parse_string("foo=\"\uFEFF\uFEFF\"")
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.1
4
+ version: 1.1.2
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-07-06 00:00:00.000000000 Z
16
+ date: 2016-07-15 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: bundler
@@ -162,6 +162,9 @@ files:
162
162
  - spec/fixtures/test_utils/resources/test01.conf
163
163
  - spec/fixtures/test_utils/resources/test01.json
164
164
  - spec/fixtures/test_utils/resources/test03.conf
165
+ - spec/fixtures/test_utils/resources/utf16.conf
166
+ - spec/fixtures/test_utils/resources/utf8.conf
167
+ - spec/fixtures/test_utils/resources/ᚠᛇᚻ.conf
165
168
  - spec/spec_helper.rb
166
169
  - spec/test_utils.rb
167
170
  - spec/unit/hocon/README.md