Class: GitHubPages::Configuration
- Inherits:
-
Object
- Object
- GitHubPages::Configuration
- Defined in:
- lib/github-pages/configuration.rb
Overview
Sets and manages Jekyll configuration defaults Most configuration is now set in _default_config.yml
Constant Summary collapse
- DEFAULT_PLUGINS =
Backward compatability of constants
GitHubPages::Plugins::DEFAULT_PLUGINS
- PLUGIN_WHITELIST =
GitHubPages::Plugins::PLUGIN_WHITELIST
- DEVELOPMENT_PLUGINS =
GitHubPages::Plugins::DEVELOPMENT_PLUGINS
- THEMES =
GitHubPages::Plugins::THEMES
- PRODUCTION_DEFAULTS =
User-overwritable defaults used only in production for practical reasons
{ "sass" => { "style" => "compressed", }, }.freeze
Class Method Summary collapse
- .development? ⇒ Boolean
- .disable_whitelist? ⇒ Boolean
-
.effective_config(user_config) ⇒ Object
Returns the effective Configuration.
- .processed(site) ⇒ Object
- .processed?(site) ⇒ Boolean
-
.set(site) ⇒ Object
Set the site’s configuration.
-
.set!(site) ⇒ Object
Set the site’s configuration with all the proper defaults.
Class Method Details
.development? ⇒ Boolean
35 36 37 |
# File 'lib/github-pages/configuration.rb', line 35 def development? Jekyll.env == "development" end |
.disable_whitelist? ⇒ Boolean
31 32 33 |
# File 'lib/github-pages/configuration.rb', line 31 def disable_whitelist? !ENV["DISABLE_WHITELIST"].to_s.empty? end |
.effective_config(user_config) ⇒ Object
Returns the effective Configuration
Note: this is a highly modified version of Jekyll#configuration
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/github-pages/configuration.rb', line 42 def effective_config(user_config) config = user_config if !development? config = Jekyll::Utils.deep_merge_hashes PRODUCTION_DEFAULTS, config end # Allow theme to be explicitly disabled via "theme: null" config["theme"] = user_config["theme"] if user_config.key?("theme") migrate_theme_to_remote_theme(config) restrict_and_config_markdown_processor(config) configure_plugins(config) config end |
.processed(site) ⇒ Object
27 28 29 |
# File 'lib/github-pages/configuration.rb', line 27 def processed(site) site.instance_variable_set :@_github_pages_processed, true end |
.processed?(site) ⇒ Boolean
23 24 25 |
# File 'lib/github-pages/configuration.rb', line 23 def processed?(site) site.instance_variable_get(:@_github_pages_processed) == true end |
.set(site) ⇒ Object
Set the site’s configuration. Implemented as an ‘after_reset` hook. Equivalent #set! function contains the code of interest. This function guards against double-processing via the value in #processed.
63 64 65 66 67 68 69 |
# File 'lib/github-pages/configuration.rb', line 63 def set(site) return if processed? site debug_print_versions set!(site) processed(site) end |
.set!(site) ⇒ Object
Set the site’s configuration with all the proper defaults. Should be called by #set to protect against multiple processings.
73 74 75 |
# File 'lib/github-pages/configuration.rb', line 73 def set!(site) site.config = effective_config(site.config) end |