Add Site#config= which can be used to set the config

This commit is contained in:
Parker Moore 2016-03-23 13:14:30 -07:00
parent 84b7d9b3ac
commit 9b60df8883
No known key found for this signature in database
GPG Key ID: 193CDEBA72063C58
1 changed files with 23 additions and 0 deletions

View File

@ -17,8 +17,31 @@ module Jekyll
# #
# config - A Hash containing site configuration details. # config - A Hash containing site configuration details.
def initialize(config) 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 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 @config = config.clone
%w(safe lsi highlighter baseurl exclude include future unpublished %w(safe lsi highlighter baseurl exclude include future unpublished