mirror of
https://github.com/jekyll/jekyll.git
synced 2026-04-28 03:01:03 -04:00
Switch to an actively-maintained TOML parser. (#6652)
Merge pull request 6652
This commit is contained in:
committed by
jekyllbot
parent
f49431ab85
commit
a9fe56830b
2
Gemfile
2
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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]}")
|
||||
|
||||
Reference in New Issue
Block a user