Roots a document tree and builds all the Components that live inside it. Looks up and creates Components by path. Centralizes finalization and filesystem output.

constructor

ComponentCache ( ) {

Arguments

| bunyan:Logger logger

Any interesting events produced by any Component generated on this cache will be logged on this Logger.

Member Properties

| Object root

Stores the roots of the global property and module maps. { property:{ }, module:{ } }.

Methods

finalize ( ) {

Prepare every Component in the cache for rendering and execute a callback.

Arguments

callback ( ) {

Called when ready to output files. No arguments.

, | doczar:Component getComponent ( ) {

Find or create a Component for a given path. This is the only official way to create a Component.

Arguments

| doczar:Parser:Path tpath

The path to retrieve or create.

Returns

| doczar:Component

The retrieved or newly created component.

, | String getRelativeURLForType ( ) {

Attempt to produce a relative url to link from one Component's root output page to another. If this cannot be done for any reason, "javascript:return false;" is returned to produce a dead link.

Arguments

| doczar:Parser:Path start

The Component whose root page is requesting this href.

| doczar:Parser:Path type

The Component to which the root page must link.

Returns

| String

Either a relative url to the requested Component's root page, or "javascript:return false;".

, | doczar:Component resolve ( ) {

Return an existing Component for a path or throw an Error if it is not found.

Arguments

| doczar:Parser:Path tpath

The path to retrieve.

Returns

| doczar:Component

The retrieved Component.

submit ( ) {

Retrieve an existing or new Component from this cache by the specified path and call submit on it with the provided info Object.

Arguments

| doczar:Parser:Path tpath

A path to the Component that should contain the submitted information.

| doczar:Parser:Submission info

An Object containing fresly-parsed data that will be overwritten into the requested Component.

writeFiles ( ) {

Create the requested base directory if it does not already exist. Configure and render the base index.html file for the root. Copy in global content from ./indexFiles. Recursively work through the root and call writeFiles on all immediate child Components. Hit the callback when all Components have recursively written their output files, or if an Error interrupts the process.

Arguments

| String basedir

The full path of the root directory where Components should output their files.