Method: Plate::CLI#compile

Defined in:
lib/plate/cli.rb

#compile(source) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/plate/cli.rb', line 26

def compile(source)
  output = options[:o]
  skeleton = File.expand_path('../../../skeleton/app', __FILE__)
  vendor = File.expand_path('../../../skeleton/vendor', __FILE__)

  plt, dir = read_plt(source)

  compiler = Compiler.new
  compiler.compile(plt)

  directory(skeleton, output)
  DEPENDENCIES.each do |d|
    directory(File.join(vendor, d), File.join(output, 'vendor', d))
  end

  build_html(output, compiler)
  build_js(output, compiler)
  build_css(output, compiler, vendor)

  if dir
    directory(File.join(Dir.pwd, source), output)
    remove_file(File.join(Dir.pwd, output, 'index.plt'))
  end

end