lib/webby/builder.rb in TwP-webby-0.9.2 vs lib/webby/builder.rb in TwP-webby-0.9.3

- old
+ new

@@ -80,11 +80,10 @@ end [args.page, args.title, args.dir] end - private # Returns the binding in the scope of the Builder class object. # def scope() binding end @@ -96,11 +95,11 @@ # # Creates a new Builder object for creating pages from the content and # layout directories. # def initialize - @log = Logging::Logger[self] + @logger = Logging::Logger[self] end # call-seq: # run( :rebuild => false, :load_files => true ) # @@ -123,27 +122,28 @@ # age of the output product -- i.e. the content file has been modified # more recently than the output file. # def run( opts = {} ) opts[:load_files] = true unless opts.has_key?(:load_files) + verbose = opts.getopt(:verbose, true) unless test(?d, output_dir) - @log.info "creating #{output_dir}" + journal.create output_dir FileUtils.mkdir output_dir end load_files if opts[:load_files] Resources.pages.each do |page| - next unless page.dirty? or opts[:rebuild] + unless page.dirty? or opts[:rebuild] + journal.identical(page.destination) if verbose + next + end - @log.info "creating #{page.destination}" - - # make sure the directory exists - FileUtils.mkdir_p ::File.dirname(page.destination) - # copy the resource to the output directory if it is static if page.instance_of? Resources::Static + FileUtils.mkdir_p ::File.dirname(page.destination) + journal.create_or_update(page) FileUtils.cp page.path, page.destination FileUtils.chmod 0644, page.destination # otherwise, layout the resource and write the results to # the output directory