From 9b60df88831073f6a8a760684bf65bf1d87d0fb4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 23 Mar 2016 13:14:30 -0700 Subject: [PATCH] Add Site#config= which can be used to set the config --- lib/jekyll/site.rb | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7f76e981..c4fe9f0c 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -17,8 +17,31 @@ module Jekyll # # config - A Hash containing site configuration details. def initialize(config) + # Source and destination may not be changed after the site has been created. + @source = File.expand_path(config['source']).freeze + @dest = File.expand_path(config['destination']).freeze + + self.config = config + + @reader = Reader.new(self) + @regenerator = Regenerator.new(self) + @liquid_renderer = LiquidRenderer.new(self) + + Jekyll.sites << self Jekyll::Hooks.trigger :site, :after_init, self + + reset + setup + end + + # Public: Set the site's configuration. This handles side-effects caused by + # changing values in the configuration. + # + # config - a Jekyll::Configuration, containing the new configuration. + # + # Returns the new configuration. + def config=(config) @config = config.clone %w(safe lsi highlighter baseurl exclude include future unpublished