class Muwu::RenderInspector
Constants
- COLUMN_LEFT
- SEPARATOR
Public Class Methods
new(project)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 12 def initialize(project) @project = project end
Public Instance Methods
render_inspector()
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 21 def render_inspector render_inspector_project render_inspector_options render_inspector_manifest render_inspector_errors end
render_inspector_errors()
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 29 def render_inspector_errors if @project.exceptions.any? @project.exceptions.each do |error| render_inspector_error_report(error) end puts end end
render_inspector_manifest()
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 39 def render_inspector_manifest @project.manifest.documents.each do |document| case document when ManifestTask::DocumentCss render_inspector_document_css(document) when ManifestTask::DocumentHtml render_inspector_document_html(document) when ManifestTask::DocumentJs render_inspector_document_js(document) end end end
render_inspector_options()
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 53 def render_inspector_options puts @project.options @project.options.instance_variables.each do |option| key = option.to_s.gsub(/\A@/,'') value = @project.options.instance_variable_get(option) puts indent("#{key}: #{value}") end puts end
render_inspector_project()
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 64 def render_inspector_project puts @project puts indent("slug: #{@project.slug}") puts indent("working_directory: #{@project.working_directory}") puts indent("js_libraries: #{@project.javascript_libraries_requested}") puts end
Private Instance Methods
column_left(text)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 77 def column_left(text) text.ljust(COLUMN_LEFT) end
indent(text)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 82 def indent(text) column_left(text).prepend(' ') end
puts_line(output=nil)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 87 def puts_line(output=nil) if Array === output puts output.compact.join(SEPARATOR) elsif NilClass === output puts "\n" else puts output end end
render_inspector_document_css(document)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 98 def render_inspector_document_css(document) puts_line [document.to_s] puts_line [document.destination.to_s, document.destination.output_class, document.destination.output_filename] puts_line end
render_inspector_document_html(document)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 105 def render_inspector_document_html(document) puts_line [document.to_s, "index: #{document.index}"] puts_line [document.destination.to_s, document.destination.output_class, document.destination.output_filename] document.tasks.each do |task| render_inspector_manifest_task(task) end puts_line end
render_inspector_document_js(document)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 115 def render_inspector_document_js(document) puts_line [document.to_s] puts_line [ document.destination.to_s, document.destination.output_class, document.destination.output_filename ] puts_line end
render_inspector_error_report(error)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 126 def render_inspector_error_report(error) puts_line [ column_left(error.type.to_s), error.report ] end
render_inspector_manifest_task(task)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 134 def render_inspector_manifest_task(task) case task when ManifestTask::Contents render_inspector_manifest_task_contents(task) when ManifestTask::Metadata render_inspector_manifest_task_metadata(task) when ManifestTask::Navigator render_inspector_manifest_task_navigator(task) when ManifestTask::Subcontents render_inspector_manifest_task_subcontents(task) when ManifestTask::Title render_inspector_manifest_task_title(task) when ManifestTask::Text render_inspector_manifest_task_text(task) when ManifestTask::TextItem render_inspector_manifest_task_text_item(task) end end
render_inspector_manifest_task_contents(contents)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 154 def render_inspector_manifest_task_contents(contents) puts_line [ indent('Contents'), contents.naming.inspect ] end
render_inspector_manifest_task_metadata(metadata)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 162 def render_inspector_manifest_task_metadata(metadata) puts_line [ indent('Metadata'), metadata.metadata.to_s ] end
render_inspector_manifest_task_subcontents(contents)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 180 def render_inspector_manifest_task_subcontents(contents) puts_line [ indent('Subcontents'), contents.naming.inspect ] end
render_inspector_manifest_task_text(text)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 188 def render_inspector_manifest_task_text(text) puts_line [ indent('Text'), text.naming.inspect ] text.sections.each do |section| render_inspector_manifest_task(section) end end
render_inspector_manifest_task_text_item(text_item)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 199 def render_inspector_manifest_task_text_item(text_item) puts_line [ indent('| TextItem'), text_item.numbering.inspect, text_item.heading.inspect, text_item.source_filename, ('!!' if text_item.source_file_does_not_exist) ] if text_item.does_have_child_sections text_item.sections.each do |section| render_inspector_manifest_task(section) end end end
render_inspector_manifest_task_title(title)
click to toggle source
# File lib/muwu/render_inspector/render_inspector.rb, line 215 def render_inspector_manifest_task_title(title) puts_line [ indent('Title'), title.metadata.to_s ] end