Major code reoganisation, splitting up the single big file. The two goals
[ikiwiki.git] / IkiWiki / Setup / Standard.pm
1 #!/usr/bin/perl
2 # Standard ikiwiki setup module.
3 # Parameters to import should be all the standard ikiwiki config stuff,
4 # plus hashes for cgiwrapper and svnwrapper, which specify any differing
5 # config stuff for them and cause the wrappers to be made.
6
7 use warnings;
8 use strict;
9 use IkiWiki::Wrapper;
10
11 package IkiWiki::Setup::Standard;
12
13 sub import {
14         IkiWiki::setup_standard(@_);
15 }
16         
17 package IkiWiki;
18
19 sub setup_standard {
20         my %setup=%{$_[1]};
21
22         debug("generating wrappers..");
23         my %startconfig=(%config);
24         foreach my $wrapper (@{$setup{wrappers}}) {
25                 %config=(%startconfig, verbose => 0, %setup, %{$wrapper});
26                 checkoptions();
27                 gen_wrapper();
28         }
29         %config=(%startconfig);
30         
31         debug("rebuilding wiki..");
32         foreach my $c (keys %setup) {
33                 $config{$c}=possibly_foolish_untaint($setup{$c})
34                         if defined $setup{$c} && ! ref $setup{$c};
35         }
36         $config{rebuild}=1;
37         checkoptions();
38         refresh();
39
40         debug("done");
41         saveindex();
42 }
43
44 1