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



59
60
61
# File 'lib/prez/build.rb', line 59

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

Instance Method Details

#check_file!Object



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

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

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

#generate_htmlObject



24
25
26
# File 'lib/prez/build.rb', line 24

def generate_html
  create_file html_filename, build_html(filename)
end