Utilize absolute paths of user-provided file paths (#7450)
Merge pull request 7450
This commit is contained in:
parent
475983537d
commit
aea502745a
|
@ -54,8 +54,8 @@ module Jekyll
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def build(site, options)
|
def build(site, options)
|
||||||
t = Time.now
|
t = Time.now
|
||||||
source = options["source"]
|
source = File.expand_path(options["source"])
|
||||||
destination = options["destination"]
|
destination = File.expand_path(options["destination"])
|
||||||
incremental = options["incremental"]
|
incremental = options["incremental"]
|
||||||
Jekyll.logger.info "Source:", source
|
Jekyll.logger.info "Source:", source
|
||||||
Jekyll.logger.info "Destination:", destination
|
Jekyll.logger.info "Destination:", destination
|
||||||
|
|
|
@ -166,6 +166,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns this configuration, overridden by the values in the file
|
# Returns this configuration, overridden by the values in the file
|
||||||
def read_config_file(file)
|
def read_config_file(file)
|
||||||
|
file = File.expand_path(file)
|
||||||
next_config = safe_load_file(file)
|
next_config = safe_load_file(file)
|
||||||
check_config_is_hash!(next_config, file)
|
check_config_is_hash!(next_config, file)
|
||||||
Jekyll.logger.info "Configuration file:", file
|
Jekyll.logger.info "Configuration file:", file
|
||||||
|
|
|
@ -190,7 +190,7 @@ class TestConfiguration < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not raise an error on empty files" do
|
should "not raise an error on empty files" do
|
||||||
allow(SafeYAML).to receive(:load_file).with("empty.yml").and_return(false)
|
allow(SafeYAML).to receive(:load_file).with(File.expand_path("empty.yml")).and_return(false)
|
||||||
Jekyll.logger.log_level = :warn
|
Jekyll.logger.log_level = :warn
|
||||||
@config.read_config_file("empty.yml")
|
@config.read_config_file("empty.yml")
|
||||||
Jekyll.logger.log_level = :info
|
Jekyll.logger.log_level = :info
|
||||||
|
@ -203,10 +203,10 @@ class TestConfiguration < JekyllUnitTest
|
||||||
end
|
end
|
||||||
|
|
||||||
should "continue to read config files if one is empty" do
|
should "continue to read config files if one is empty" do
|
||||||
allow(SafeYAML).to receive(:load_file).with("empty.yml").and_return(false)
|
allow(SafeYAML).to receive(:load_file).with(File.expand_path("empty.yml")).and_return(false)
|
||||||
allow(SafeYAML)
|
allow(SafeYAML)
|
||||||
.to receive(:load_file)
|
.to receive(:load_file)
|
||||||
.with("not_empty.yml")
|
.with(File.expand_path("not_empty.yml"))
|
||||||
.and_return("foo" => "bar", "include" => "", "exclude" => "")
|
.and_return("foo" => "bar", "include" => "", "exclude" => "")
|
||||||
Jekyll.logger.log_level = :warn
|
Jekyll.logger.log_level = :warn
|
||||||
read_config = @config.read_config_files(["empty.yml", "not_empty.yml"])
|
read_config = @config.read_config_files(["empty.yml", "not_empty.yml"])
|
||||||
|
|
Loading…
Reference in New Issue