lib/webby/builder.rb
# call-seq:
#    run( :rebuild => false, :load_files => true )
#
# Runs the Webby builder by loading in the layout files from the
# <code>layouts/</code> folder and the content from the
# <code>contents/</code> folder. Content is analyzed, and those that need
# to be copied or compiled (filtered using ERB, Texttile, Markdown, etc.)
# are handled. The results are placed in the <code>output/</code> folder.
#
# If the <code>:rebuild</code> flag is set to +true+, then all content is
# copied and/or compiled to the output folder.
#
# A content file can mark itself as dirty by setting the +dirty+ flag to
# +true+ in the meta-data of the file. This will cause the contenet to
# always be compiled when the builder is run. Conversely, setting the
# dirty flag to +false+ will cause the content to never be compiled or
# copied to the output folder.
#
# A content file needs to be built if the age of the file is less then the
# age of the output product -- i.e. the content file has been modified
# more recently than the output file.
#
call-seq:
run( :rebuild => false, :load_files => true )

Runs the Webby builder by loading in the layout files from the
layouts/ folder and the content from the
contents/ folder. Content is analyzed, and those that need
to be copied or compiled (filtered using ERB, Texttile, Markdown, etc.)
are handled. The results are placed in the output/ folder.

If the :rebuild flag is set to +true+, then all content is
copied and/or compiled to the output folder.

A content file can mark itself as dirty by setting the +dirty+ flag to
+true+ in the meta-data of the file. This will cause the contenet to
always be compiled when the builder is run. Conversely, setting the
dirty flag to +false+ will cause the content to never be compiled or
copied to the output folder.

A content file needs to be built if the age of the file is less then the
age of the output product -- i.e. the content file has been modified
more recently than the output file.
call - seq : run ( : rebuild = > false : load_files = > true ) Runs the Webby builder by loading in the layout files from the layouts / folder and the content from the contents / folder . Content is analyzed and those that need to be copied or compiled ( filtered using ERB Texttile Markdown etc . ) are handled . The results are placed in the output / folder . If the : rebuild flag is set to + true + then all content is copied and / or compiled to the output folder . A content file can mark itself as dirty by setting the + dirty + flag to + true + in the meta - data of the file . This will cause the contenet to always be compiled when the builder is run . Conversely setting the dirty flag to + false + will cause the content to never be compiled or copied to the output folder . A content file needs to be built if the age of the file is less then the 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)
    unless test(?d, output_dir)
      @log.info "creating #{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]
      @log.info "creating #{page.destination}"
      FileUtils.mkdir_p ::File.dirname(page.destination)
      if page.instance_of? Resources::Static
        FileUtils.cp page.path, page.destination
        FileUtils.chmod 0644, page.destination
      else Renderer.write(page) end
    end
    FileUtils.touch ::Webby.cairn
    nil
  end
def run ( opts = { } ) opts [ :load_files ] = true unless opts . has_key? ( :load_files ) unless test ( ?d , output_dir ) @log . info "creating #{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 ] @log . info "creating #{page.destination}" FileUtils . mkdir_p :: File . dirname ( page . destination ) if page . instance_of? Resources :: Static FileUtils . cp page . path , page . destination FileUtils . chmod 0644 , page . destination else Renderer . write ( page ) end end FileUtils . touch :: Webby . cairn nil end
call-seq:
run( :rebuild => false, :load_files => true )
call - seq : run ( : rebuild = > false : load_files = > true )
# make sure the directory exists # copy the resource to the output directory if it is static # otherwise, layout the resource and write the results to # the output directory # touch the cairn so we know when the website was last generated
opts