From a9fe56830b466917cfbcdd9bce1c0fdff49aa113 Mon Sep 17 00:00:00 2001 From: Jashank Jeremy Date: Wed, 3 Jan 2018 03:36:58 +1000 Subject: [PATCH] Switch to an actively-maintained TOML parser. (#6652) Merge pull request 6652 --- Gemfile | 2 +- lib/jekyll/configuration.rb | 4 ++-- test/test_configuration.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 055b7295..90ccf0a5 100644 --- a/Gemfile +++ b/Gemfile @@ -77,7 +77,7 @@ group :jekyll_optional_dependencies do gem "kramdown", "~> 1.14" gem "mime-types", "~> 3.0" gem "rdoc", "~> 5.0" - gem "toml", "~> 0.2.0" + gem "tomlrb", "~> 1.2" platform :ruby, :mswin, :mingw, :x64_mingw do gem "classifier-reborn", "~> 2.2.0" diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index bfa61799..601e1f97 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -134,8 +134,8 @@ module Jekyll def safe_load_file(filename) case File.extname(filename) when %r!\.toml!i - Jekyll::External.require_with_graceful_fail("toml") unless defined?(TOML) - TOML.load_file(filename) + Jekyll::External.require_with_graceful_fail("tomlrb") unless defined?(Tomlrb) + Tomlrb.load_file(filename) when %r!\.ya?ml!i SafeYAML.load_file(filename) || {} else diff --git a/test/test_configuration.rb b/test/test_configuration.rb index e0f1b8b5..17c0d219 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -380,11 +380,11 @@ class TestConfiguration < JekyllUnitTest end should "load multiple config files" do - External.require_with_graceful_fail("toml") + External.require_with_graceful_fail("tomlrb") allow(SafeYAML).to receive(:load_file).with(@paths[:default]).and_return({}) allow(SafeYAML).to receive(:load_file).with(@paths[:other]).and_return({}) - allow(TOML).to receive(:load_file).with(@paths[:toml]).and_return({}) + allow(Tomlrb).to receive(:load_file).with(@paths[:toml]).and_return({}) allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:default]}") allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}") allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:toml]}")