class GitHubPages::Configuration

Sets and manages Jekyll configuration defaults and overrides

def debug_print_versions

stream for debugging purposes. See by running Jekyll with '--verbose'
Print the versions for github-pages and jekyll to the debug
def debug_print_versions
  Jekyll.logger.debug "GitHub Pages:", "github-pages v#{GitHubPages::VERSION}"
  Jekyll.logger.debug "GitHub Pages:", "jekyll v#{Jekyll::VERSION}"
end

def defaults_for_env

def defaults_for_env
  defaults = development? ? DEFAULTS : PRODUCTION_DEFAULTS
  Jekyll::Utils.deep_merge_hashes Jekyll::Configuration::DEFAULTS, defaults
end

def development?

def development?
  Jekyll.env == "development"
end

def disable_whitelist?

def disable_whitelist?
  development? && !ENV["DISABLE_WHITELIST"].to_s.empty?
end

def effective_config(user_config)

Note: this is a highly modified version of Jekyll#configuration

Returns the effective Configuration

values which themselves override our defaults.
configuration sandwhich with our overrides overriding the user's specified
Given a user's config, determines the effective configuration by building a user
def effective_config(user_config)
  # Merge user config into defaults
  config = Jekyll::Utils.deep_merge_hashes(defaults_for_env, user_config)
    .fix_common_issues
    .add_default_collections
  # Merge overwrites into user config
  config = Jekyll::Utils.deep_merge_hashes config, OVERRIDES
  restrict_markdown_processor(config)
  # Ensure we have those gems we want.
  config["plugins"] = Array(config["plugins"]) | DEFAULT_PLUGINS
  if disable_whitelist?
    config["whitelist"] = config["whitelist"] | config["plugins"]
  end
  if development?
    config["whitelist"] = config["whitelist"] | DEVELOPMENT_PLUGINS
  end
  config
end

def processed(site)

def processed(site)
  site.instance_variable_set :@_github_pages_processed, true
end

def processed?(site)

def processed?(site)
  site.instance_variable_get(:@_github_pages_processed) == true
end

def restrict_markdown_processor(config)

neither of these.
Ensure we're using Kramdown or GFM. Force to Kramdown if
def restrict_markdown_processor(config)
  config["markdown"] = "kramdown" unless \
    %w(kramdown gfm).include?(config["markdown"].to_s.downcase)
end

def set(site)

guards against double-processing via the value in #processed.
Equivalent #set! function contains the code of interest. This function
Set the site's configuration. Implemented as an `after_reset` hook.
def set(site)
  return if processed? site
  debug_print_versions
  set!(site)
  processed(site)
end

def set!(site)

Should be called by #set to protect against multiple processings.
Set the site's configuration with all the proper defaults and overrides.
def set!(site)
  site.config = effective_config(site.config)
end