lib/prez/build.rb in prez-0.0.1 vs lib/prez/build.rb in prez-0.0.2

- old
+ new

@@ -1,31 +1,32 @@ -require "prez/assets" +require "prez/builder" +require "prez/error" require "thor/actions" -require "thor/error" require "thor/group" module Prez class Build < Thor::Group include Thor::Actions + include Prez::Builder argument :name, type: :string def check_file! if File.exists? name @filename = name elsif File.exists? "#{name}.prez" @filename = "#{name}.prez" else - raise Thor::Error.new(set_color("Missing prez file '#{name}'", :red, :bold)) + raise Prez::Error.new("Missing prez file '#{name}'") end if filename =~ /\.html$/ - raise Thor::Error.new(set_color("Prez file cannot be html file: '#{name}'", :red, :bold)) + raise Prez::Error.new("Prez file cannot be an html file: '#{name}'") end end def generate_html - template filename, html_filename + create_file html_filename, build_html(filename) end private def base_name @@ -38,24 +39,12 @@ def html_filename "#{base_name}.html" end - def javascript(name) - Prez::Assets.javascript name - rescue Prez::Files::MissingError - raise Thor::Error.new(set_color("Could not find file: '#{name}.js'", :red, :bold)) - end - - def stylesheet(name) - Prez::Assets.stylesheet name - rescue Prez::Files::MissingError - raise Thor::Error.new(set_color("Could not find file: '#{name}.css'", :red, :bold)) - end - class << self def source_root - File.expand_path "." + File.absolute_path File.expand_path("../../../templates", __FILE__) end end end end