diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 64ae6e05..f0397678 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -54,8 +54,8 @@ module Jekyll # Returns nothing. def build(site, options) t = Time.now - source = options["source"] - destination = options["destination"] + source = File.expand_path(options["source"]) + destination = File.expand_path(options["destination"]) incremental = options["incremental"] Jekyll.logger.info "Source:", source Jekyll.logger.info "Destination:", destination diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 759ddae9..61c00017 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -166,6 +166,7 @@ module Jekyll # # Returns this configuration, overridden by the values in the file def read_config_file(file) + file = File.expand_path(file) next_config = safe_load_file(file) check_config_is_hash!(next_config, file) Jekyll.logger.info "Configuration file:", file diff --git a/test/test_configuration.rb b/test/test_configuration.rb index f09c4a09..4f20cd0f 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -190,7 +190,7 @@ class TestConfiguration < JekyllUnitTest end 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 @config.read_config_file("empty.yml") Jekyll.logger.log_level = :info @@ -203,10 +203,10 @@ class TestConfiguration < JekyllUnitTest end 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) .to receive(:load_file) - .with("not_empty.yml") + .with(File.expand_path("not_empty.yml")) .and_return("foo" => "bar", "include" => "", "exclude" => "") Jekyll.logger.log_level = :warn read_config = @config.read_config_files(["empty.yml", "not_empty.yml"])