class Frozen::Site::LocalSite

Public Class Methods

new(site_root_path) click to toggle source
Calls superclass method Frozen::Site::Base::new
# File lib/frozen/site/local_site.rb, line 8
def initialize(site_root_path)
  @site_root_path = File.expand_path(site_root_path)
  super()
end

Public Instance Methods

build() click to toggle source
# File lib/frozen/site/local_site.rb, line 13
def build
  build_stylesheets
  build_javascripts
  build_views
end
build_javascript(javascript) click to toggle source
# File lib/frozen/site/local_site.rb, line 77
def build_javascript(javascript)
  if javascript.is_a? Frozen::Template::Javascript
    javascript.render_to_file(
      File.join(site_build_path,javascript.build_file_path)
    )
    puts "#{"[javascript]".green} #{javascript.build_file_path}"
  end
  if javascript.is_a? String
    engine = Frozen::Template::Javascript.new
    engine.template_root_path = javascript_template_path
    engine.file_path = file_path
    engine.render_to_file(
      File.join(site_build_path,engine.build_file_path)
    )
    puts "#{"[javascript]".green} #{engine.build_file_path}"
  end
end
build_javascripts() click to toggle source
# File lib/frozen/site/local_site.rb, line 95
def build_javascripts
  javascripts.each {|i| build_javascript(i)}
end
build_stylesheet(stylesheet) click to toggle source
# File lib/frozen/site/local_site.rb, line 43
def build_stylesheet(stylesheet)
  if stylesheet.is_a? Frozen::Template::Stylesheet
    stylesheet.render_to_file(
      File.join(site_build_path,stylesheet.build_file_path)
    )
    puts "#{"[stylesheet]".green} #{stylesheet.build_file_path}"
  end
  if stylesheet.is_a? String
    engine = Frozen::Template::Stylesheet.new(
      load_path: stylesheet_template_path
    )
    engine.template_root_path = stylesheet_template_path
    engine.file_path = file_path
    engine.render_to_file(
      File.join(site_build_path,stylesheet.build_file_path)
    )
    puts "#{"[view]".green} #{engine.build_file_path}"
  end
end
build_stylesheets() click to toggle source
# File lib/frozen/site/local_site.rb, line 37
def build_stylesheets
  stylesheets.each do |stylesheet|
    build_stylesheet(stylesheet)
  end
end
build_view(view) click to toggle source
# File lib/frozen/site/local_site.rb, line 118
def build_view(view)
    view.render_to_file(
      File.join(site_build_path, view.build_file_path)
    )
    puts "#{"[view]".green} #{view.build_file_path}"
end
build_views() click to toggle source
# File lib/frozen/site/local_site.rb, line 114
def build_views
  views.each { |v| build_view(v) }
end
javascript_file_paths() click to toggle source
# File lib/frozen/site/local_site.rb, line 62
def javascript_file_paths
  @javascript_file_paths ||= files_in_path(
    javascript_template_path,
    ["js", "coffee"])
end
javascripts() click to toggle source
# File lib/frozen/site/local_site.rb, line 68
def javascripts
  @javascripts ||= javascript_file_paths.map{ |file_path|
    engine = Frozen::Template::Javascript.new
    engine.template_root_path = javascript_template_path
    engine.file_path = file_path
    engine
  }
end
site_build_path() click to toggle source
# File lib/frozen/site/local_site.rb, line 125
def site_build_path
  File.join(site_root_path, "build")
end
stylesheet_file_paths() click to toggle source
# File lib/frozen/site/local_site.rb, line 19
def stylesheet_file_paths
  @stylesheet_file_paths ||= files_in_path(
    stylesheet_template_path,
    "scss")
end
stylesheets() click to toggle source
# File lib/frozen/site/local_site.rb, line 25
def stylesheets
  @stylesheets ||= stylesheet_file_paths.map {|file_path|
    engine = Frozen::Template::Stylesheet.new(
      load_path: stylesheet_template_path
    )
    engine.template_root_path = stylesheet_template_path
    engine.file_path = file_path
    engine
  }
end
view_file_paths() click to toggle source
# File lib/frozen/site/local_site.rb, line 100
def view_file_paths
  @view_file_paths ||= files_in_path(view_template_path, "slim")
end
views() click to toggle source
# File lib/frozen/site/local_site.rb, line 104
def views
    @views ||= view_file_paths.map{|file_path|
      engine = Frozen::Template::View.new
      engine.file_path = file_path
      engine.template_root_path = view_template_path
      engine.layout_path = layout_template_path
      engine
    }
end