Class: SiteInspector
- Inherits:
-
Jekyll::Generator
- Object
- Jekyll::Generator
- SiteInspector
- Defined in:
- site_inspector.rb
Overview
Dumps lots of information from site
if in development
mode and site_inspector: true
in _config.yml
.
Instance Method Summary collapse
-
#generate(site) ⇒ void
Displays information about the Jekyll site.
-
#initialize(config) ⇒ SiteInspector
constructor
A new instance of SiteInspector.
Constructor Details
#initialize(config) ⇒ SiteInspector
Returns a new instance of SiteInspector.
10 11 12 13 |
# File 'site_inspector.rb', line 10 def initialize(config) super(config) @log = LoggerFactory.new.create_logger('site_inspector', config, :warn, $stderr) end |
Instance Method Details
#generate(site) ⇒ void
This method returns an undefined value.
Displays information about the Jekyll site
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'site_inspector.rb', line 20 def generate(site) mode = site.config['env']['JEKYLL_ENV'] config = site.config['site_inspector'] return if config.nil? inspector_enabled = config != false return unless inspector_enabled force = config == 'force' return unless force || mode == 'development' @log.info "site is of type #{site.class}" @log.info "site.time = #{site.time}" @log.info "site.config['env']['JEKYLL_ENV'] = #{mode}" site.collections.each do |key, _| puts "site.collections.#{key}" end # key env contains all environment variables, quite verbose so output is suppressed site.config.sort.each { |key, value| @log.info "site.config.#{key} = '#{value}'" unless key == 'env' } site.data.sort.each { |key, value| @log.info "site.data.#{key} = '#{value}'" } # site.documents.each {|key, value| @log.info "site.documents.#{key}" } # Generates too much output! @log.info "site.keep_files: #{site.keep_files.sort}" # site.pages.each {|key, value| @log.info "site.pages.#{key}'" } # Generates too much output! # site.posts.each {|key, value| @log.info "site.posts.#{key}" } # Generates too much output! site..sort.each { |key, value| @log.info "site.tags.#{key} = '#{value}'" } end |