Class: Prez::Build

Inherits:
Thor::Group
  • Object
show all
Includes:
Builder, Thor::Actions
Defined in:
lib/prez/build.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



45
46
47
# File 'lib/prez/build.rb', line 45

def source_root
  File.absolute_path File.expand_path("../../../templates", __FILE__)
end

Instance Method Details

#check_file!Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/prez/build.rb', line 12

def check_file!
  if File.exists? name
    @filename = name
  elsif File.exists? "#{name}.prez"
    @filename = "#{name}.prez"
  else
    raise Prez::Error.new("Missing prez file '#{name}'")
  end

  if filename =~ /\.html$/
    raise Prez::Error.new("Prez file cannot be an html file: '#{name}'")
  end
end

#generate_htmlObject



26
27
28
# File 'lib/prez/build.rb', line 26

def generate_html
  create_file html_filename, build_html(filename)
end