Newcomen

Description A static content generator.
Newcomen > Perl Modules > Newcomen::Plugin::CleanDirectories
Source

Index


NAME ^

Newcomen::Plugin::CleanDirectories - Empty directories before building the project.

DESCRIPTION ^

This plugin may be used to empty directories before the actual build process begins. The plugin should die if some error occurs, subject to File::Path's error handling (File::Path's remove_tree() function is used internally). No directories will be emptied by default.

OPTIONS ^

{
   'cleandirectories' => {
      'dirs'          => undef,
      'verbose'       => undef,
   },
}

These are the defaults set by this plugin, they may be overridden by user configuration.

If directories should be be emptied before the build process begins, cleandirectories/dirs must be set to either an arrayref containing zero or more strings specifying these directories, or a single string if only one directory should be emptied. Directories must be specified as paths relative to the project's root directory. Setting cleandirectories/dirs to undef (the default) has the same effect as setting it to an empty arrayref (i.e. nothing will be deleted in that case).

If the cleandirectories/verbose option is set to a true value, a list of all files/directories deleted will be printed once a directory has been emptied. The output will be one file/directory per line (the output of File::Path's remove_tree() function, prefixed by the string 'CLN ').

Note: For security reasons all paths will be transformed to resolved absolute paths. If a configured directory is not a (direct or indirect) child of the project's root directory (as set by the ROOT_DIR option), its contents will not be deleted.

HOOKS ^

This plugin implements the hook_pre_init() hook (default priority).

SEE ALSO ^

File::Path

VERSION ^

This is version 2014052501.

AUTHOR ^

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

COPYRIGHT AND LICENSE ^

Copyright 2013-2014 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/>.