module Webgen::Task::CreateWebsite

About

Creates the website.

This task assumes that the website directory does not exist and populates it from a specified template. webgen extensions can provide additional website templates, see below.

For each created file a verbose log message is recorded in the format used when webgen generates a website (because, actually, webgen's website generating facilities are used to create the website structure).

Creating a website template

A website template is just a directory holding all the files necessary for a webgen website and therefore looks very similar to an actual webgen website directory. However, the template is not just copied but processed ('generated') by webgen itself.

What this means is:

  • A Webgen::Website object is created for a temporary directory.

  • The 'destination' configuration option is set to the to-be-created website directory (ie. to Website#directory of the current website).

  • The 'sources' configuration option is set to use the website template directory.

  • All path handlers are deactivated except Webgen::PathHandler::Copy and the latter is used for processing all source paths.

Thus one can use Erb or any other supported content processor to customize the generated files!

Once a website template has been created, it needs to be registered with a template name, like this:

website.ext.task.data(:create_website)[:templates][TEMPLATE_NAME] = ABSOLUTE_DIR_PATH

Public Class Methods

call(website, template = nil)

Create the website from the given template.

This actually uses webgen's file copying/generating facilities to populate the website directory. Kind of bootstrapping really.

Returns true if the website has been created.