class Muwu::RenderHtml

Public Class Methods

new(project) click to toggle source
# File lib/muwu/render_html/render_html.rb, line 11
def initialize(project)
  @manifest = project.manifest
  @project = project
  halt_if_project_has_fatal_exceptions
end

Public Instance Methods

render_all() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 22
def render_all
  if @manifest.does_have_documents
    build_and_render(@manifest.documents)
  else
    reply_nothing_to_do
  end
end
render_css_only() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 31
def render_css_only
  if @manifest.does_have_documents_css
    build_and_render(@manifest.documents_css)
  else
    reply_nothing_to_do
  end
end
render_html_by_index(index) click to toggle source
# File lib/muwu/render_html/render_html.rb, line 40
def render_html_by_index(index)
  document_html = @manifest.find_document_html_by_index(index)
  if document_html
    build_and_render(document_html)
  else
    reply_nothing_to_do
  end
end
render_html_only() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 50
def render_html_only
  if @manifest.does_have_documents_html
    build_and_render(@manifest.documents_html)
  else
    reply_nothing_to_do
  end
end
render_js_only() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 59
def render_js_only
  if @manifest.does_have_documents_js
    build_and_render(@manifest.documents_js)
  else
    reply_nothing_to_do
  end
end

Private Instance Methods

build_and_render(document) click to toggle source
# File lib/muwu/render_html/render_html.rb, line 72
def build_and_render(document)
  case document
  when Array
    document.each { |d| build_and_render(d) }

  when ManifestTask::DocumentCss
    RenderCssBuilder.new(document).build_and_render

  when ManifestTask::DocumentHtml
    RenderHtmlBuilder.new(document).build_and_render

  when ManifestTask::DocumentJs
    RenderJsBuilder.new(document).build_and_render
  end
end
halt_if_project_has_fatal_exceptions() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 89
def halt_if_project_has_fatal_exceptions
  begin
    if @project.exceptions_fatal.any?
      raise ProjectExceptionHandler::Fatal.new(@project.exceptions_fatal)
    end
  end
end
reply_nothing_to_do() click to toggle source
# File lib/muwu/render_html/render_html.rb, line 98
def reply_nothing_to_do
  $stderr.puts '- No documents to compile.'
end