From f8c038566cd34f37373324401980159cf5735864 Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Thu, 26 May 2016 22:24:04 +0200 Subject: [PATCH] `Serve.process` should receive same config as `Build.process` fixes #4850 --- lib/jekyll/commands/serve.rb | 2 ++ test/test_commands_serve.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 134991b4..6f1c4a40 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -33,7 +33,9 @@ module Jekyll cmd.action do |_, opts| opts["serving"] = true opts["watch" ] = true unless opts.key?("watch") + config = opts["config"] Build.process(opts) + opts["config"] = config Serve.process(opts) end end diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 7ffd0a57..50fe9f83 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -74,6 +74,20 @@ class TestCommandsServe < JekyllUnitTest assert custom_opts(opts)[:DirectoryIndex].empty? end + should "keep config between build and serve" do + custom_options = { + "config" => %w(_config.yml _development.yml), + "serving" => true, + "watch" => false # for not having guard output when running the tests + } + allow(SafeYAML).to receive(:load_file).and_return({}) + allow(Jekyll::Commands::Build).to receive(:build).and_return("") + + expect(Jekyll::Commands::Serve).to receive(:process).with(custom_options) + @merc.execute(:serve, { "config" => %w(_config.yml _development.yml), + "watch" => false }) + end + context "verbose" do should "debug when verbose" do assert_equal custom_opts({ "verbose" => true })[:Logger].level, 5