Switch to an actively-maintained TOML parser. (#6652)
Merge pull request 6652
This commit is contained in:
parent
f49431ab85
commit
a9fe56830b
2
Gemfile
2
Gemfile
|
@ -77,7 +77,7 @@ group :jekyll_optional_dependencies do
|
||||||
gem "kramdown", "~> 1.14"
|
gem "kramdown", "~> 1.14"
|
||||||
gem "mime-types", "~> 3.0"
|
gem "mime-types", "~> 3.0"
|
||||||
gem "rdoc", "~> 5.0"
|
gem "rdoc", "~> 5.0"
|
||||||
gem "toml", "~> 0.2.0"
|
gem "tomlrb", "~> 1.2"
|
||||||
|
|
||||||
platform :ruby, :mswin, :mingw, :x64_mingw do
|
platform :ruby, :mswin, :mingw, :x64_mingw do
|
||||||
gem "classifier-reborn", "~> 2.2.0"
|
gem "classifier-reborn", "~> 2.2.0"
|
||||||
|
|
|
@ -134,8 +134,8 @@ module Jekyll
|
||||||
def safe_load_file(filename)
|
def safe_load_file(filename)
|
||||||
case File.extname(filename)
|
case File.extname(filename)
|
||||||
when %r!\.toml!i
|
when %r!\.toml!i
|
||||||
Jekyll::External.require_with_graceful_fail("toml") unless defined?(TOML)
|
Jekyll::External.require_with_graceful_fail("tomlrb") unless defined?(Tomlrb)
|
||||||
TOML.load_file(filename)
|
Tomlrb.load_file(filename)
|
||||||
when %r!\.ya?ml!i
|
when %r!\.ya?ml!i
|
||||||
SafeYAML.load_file(filename) || {}
|
SafeYAML.load_file(filename) || {}
|
||||||
else
|
else
|
||||||
|
|
|
@ -380,11 +380,11 @@ class TestConfiguration < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "load multiple config files" do
|
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[:default]).and_return({})
|
||||||
allow(SafeYAML).to receive(:load_file).with(@paths[:other]).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[:default]}")
|
||||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
|
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:other]}")
|
||||||
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:toml]}")
|
allow($stdout).to receive(:puts).with("Configuration file: #{@paths[:toml]}")
|
||||||
|
|
Loading…
Reference in New Issue