From b7cd40c1bb0e0c88155c0948f8475db3479153c8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sun, 18 Jan 2009 16:42:12 +0000 Subject: Add underlay plugin --- IkiWiki/Plugin/underlay.pm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 IkiWiki/Plugin/underlay.pm (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/underlay.pm b/IkiWiki/Plugin/underlay.pm new file mode 100644 index 000000000..380d418fb --- /dev/null +++ b/IkiWiki/Plugin/underlay.pm @@ -0,0 +1,40 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::underlay; +# Copyright © 2008 Simon McVittie +# Licensed under the GNU GPL, version 2, or any later version published by the +# Free Software Foundation + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "underlay", call => \&getsetup); + hook(type => "checkconfig", id => "underlay", call => \&checkconfig); +} + +sub getsetup () { + return + plugin => { + safe => 0, + rebuild => undef, + }, + add_underlays => { + type => "string", + default => [], + description => "extra underlay directories to add", + advanced => 1, + safe => 0, + rebuild => 1, + }, +} + +sub checkconfig () { + return unless exists $config{add_underlays}; + + foreach my $dir (@{$config{add_underlays}}) { + add_underlay($dir); + } +} + +1; -- cgit v1.2.3