class Webgen::Website
About¶ ↑
Represents a webgen website and provides the main interface for users.
Normally, webgen is used from the command line via the webgen command or from Rakefiles via Webgen::RakeTask. However, you can also easily use webgen as a library and this class provides the interface for this usage!
You may notice that this class doesn't have many methods. This is because webgen is designed from ground up to be extensible. Most of the 'magic' happens in extensions which are registered on the ext OpenStruct object. The simple 'core' classes that are not extensions have separate accessor methods (config for the Configuration object, blackboard for the Blackboard and so on).
Since a webgen website is, basically, just a directory, the only parameter needed for creating a new Website object is the website directory. Once created, the website is fully initialized and one can work with it:
-
If you want to generate the website, you just need to call
execute_taskwith :generate_website as parameter. -
If you want to retrieve data from the website, you can use the various accessors on the
Websiteobject itself or useextto access all available extensions.Note: This is generally only useful if the website has been generated before because otherwise there probably is no data to retrieve.
Constants
- CONFIG_FILENAME
The name of the configuration file webgen uses.
Attributes
The blackboard used for inter-object communication.
A cache to store information that should be available the next time the website gets generated.
The website configuration.
The website directory.
Access to all extension objects. An OpenStruct object.
The Webgen::Logger used for logging.
The internal data structure used to store information about individual nodes.
See Tree for more information
Public Class Methods
Create a new webgen Website object for the website in the directory dir.
If no logger is specified, a dummy logger that logs to a StringIO is created.
You can provide a block for modifying the Website object in any way during the initialization:
-
If the block only takes one parameter, it is called with the
Websiteobject after the initialization is done but before the cache is restored. -
If it takes two parameters, the first one is the
Websiteobject and the second one is a boolean specifying whether the block is currently called any initialization (value istrue) or after it (value is +false).
Public Instance Methods
Execute the given task.
See Webgen::Task and the classes in its namespace for available classes.
Save the cache.
Append the path to the website's temporary directory and return the full path to it.
Note that the temporary directory is only created if the create parameter is set to true.