Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen
Source

Index


NAME ^

Newcomen - A static content generator - main class.

SYNOPSIS ^

use Newcomen;

my $newcomen = Newcomen -> new ();

$newcomen -> add_config ('perl');
$newcomen -> run ();

DESCRIPTION ^

Note: Please see Newcomen::Manual for both end user documentation and general information for developers.

This is the main class of Newcomen. It provides the interface for an actual executable script to process an Newcomen project. See the SYNOPSIS for a basic example, or the script bin/newcomen included in the distribution.

CLASS METHODS ^

new

my $newcomen = Newcomen -> new ('config' => $config);

Constructor. The config parameter is optional. If it is provided, it has to be an existing instance of Newcomen::Config. If it is not specified, Newcomen will create a new instance. This Newcomen::Config instance will be used globally for all the configuration of the different Newcomen components, plugins etc.

INSTANCE METHODS ^

Configuration

add_config

$newcomen -> add_config ($backend_name, $backend_options);

Same as Newcomen::Config's add_config() method, see there for details. Included in this class for convenience. It operates on the same Newcomen::Config instance that is returned by the config() method, see below.

config

my $config = $newcomen -> config ();

Returns the Newcomen::Config instance. This is either the instance provided to the constructor (see new()), or the automatically created one if none was provided.

Processing A Project

run

Toggle source:   run

sub run {
   my $self = shift;
   for my $hook (@$hooks) {
      if ($hook =~ /^_/) {
         $self -> $hook ();
         next;
      }
      $self -> _plugins () -> run_hooks ($hook);
   }
}
$newcomen -> run ();

Starts the build process of the current Newcomen project, according to the configuration.

MISCELLANEOUS ^

The names and order of the hooks that may be implemented by plugins is defined (almost) entirely in this class. See Newcomen::Manual::Hooks for more details.

SEE ALSO ^

Newcomen::Config, Newcomen::Manual, Newcomen::Manual::Hooks

VERSION ^

This is version 2017040102.

AUTHOR ^

Stefan Goebel - newcomen {at} subtype {dot} de

COPYRIGHT AND LICENSE ^

Copyright 2013-2017 Stefan Goebel.

This file is part of Newcomen.

Newcomen is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.

Newcomen is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Newcomen. If not, see <http://www.gnu.org/licenses/>.