# File lib/webby/builder.rb, line 123
  def run( opts = {} )
    opts[:load_files] = true unless opts.has_key?(:load_files)
    verbose = opts.getopt(:verbose, true)

    unless test(?d, output_dir)
      journal.create output_dir
      FileUtils.mkdir output_dir
    end

    ::Webby.load_files if opts[:load_files]

    Resources.pages.each do |page|
      unless page.dirty? or opts[:rebuild]
        journal.identical(page.destination) if verbose
        next
      end

      # 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
      else Renderer.write(page) end
    end

    # touch the cairn so we know when the website was last generated
    FileUtils.touch ::Webby.cairn

    nil
  end