From f7f45d6a0ad41f3cd077b0310ce83f199b658b4d Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 13 Mar 2006 19:10:29 +0000 Subject: [PATCH] add rebuild after calling setup, better format for setup files --- doc/usage.mdwn | 9 +++++++-- doc/wikilink.mdwn | 3 ++- ikiwiki | 11 ++++++++++- ikiwiki.setup | 22 +++++++++++++--------- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/doc/usage.mdwn b/doc/usage.mdwn index 8efb9a63d..0377014fd 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -89,8 +89,13 @@ flags such as --verbose can be negated with --no-verbose. In setup mode, ikiwiki reads the config file, which is really a perl program that can call ikiwiki internal functions. Uses of this are - various; one is to automatically generate wrappers for a wiki based on - data in a config file. + various; the normal one is to automatically generate wrappers for a + wiki based on data in a config file. + + Note that the wiki will be (re)built as part of the setup process to + ensure that any changes take effect. + + [[ikiwiki.setup]] is an example of such a config file. # AUTHOR diff --git a/doc/wikilink.mdwn b/doc/wikilink.mdwn index dab5d3ac4..ac0ec9d56 100644 --- a/doc/wikilink.mdwn +++ b/doc/wikilink.mdwn @@ -11,4 +11,5 @@ play when linking between [[SubPage]]s. WikiLinks can be entered in any case you like, the page they link to is always lowercased. -Note that if the file linked to by a WikiLink looks like an image, it will be displayed inline on the page. +Note that if the file linked to by a WikiLink looks like an image, it will +be displayed inline on the page. diff --git a/ikiwiki b/ikiwiki index 111ef54fc..ea3833a37 100755 --- a/ikiwiki +++ b/ikiwiki @@ -1152,6 +1152,7 @@ sub cgi () { #{{{ sub setup () { # {{{ my $setup=possibly_foolish_untaint($config{setup}); + delete $config{setup}; open (IN, $setup) || error("read $setup: $!\n"); local $/=undef; my $code=; @@ -1159,7 +1160,15 @@ sub setup () { # {{{ close IN; eval $code; error($@) if $@; - print "ikiwiki setup complete\n"; + print "$config{wikiname} setup complete, now forcing a rebuild.\n"; + $config{cgi}=0; + $config{rebuild}=1; + foreach my $c (keys %config) { + $config{$c}=possibly_foolish_untaint($config{$c}) + if defined $config{$c}; + } + refresh(); + saveindex(); exit; } #}}} diff --git a/ikiwiki.setup b/ikiwiki.setup index 44c4f3106..5a902a23c 100644 --- a/ikiwiki.setup +++ b/ikiwiki.setup @@ -5,7 +5,8 @@ # # Remember to re-run ikiwiki --setup any time you edit this file. -my %common=( +%config=(%config, + wikiname => "MyWiki", # Be sure to customise these.. @@ -14,7 +15,7 @@ my %common=( destdir => "/var/www/wiki", url => "http://myhost/wiki", cgiurl => "http://myhost/ikiwiki.cgi", - historyurl => "$webdir/cgi-bin/viewcvs?[[]]" + #historyurl => "http://svn.myhost/trunk/[[]]", # Whether to integrate with svn. svn => 1, @@ -22,18 +23,21 @@ my %common=( # Can anonymous web users edit pages? #anonok => 1, + ); -gen_wrapper( - %common, +gen_wrapper(%config, + cgi => 1, - wrapper => "$common{destdir}/ikiwiki.cgi", + wrapper => "$config{destdir}/ikiwiki.cgi", wrappermode => 06755, + ); -gen_wrapper( - %common, +gen_wrapper(%config, + # Note that this will overwrite any exsting post-commit hoo # script, which may not be what you want. - wrapper => "$common{svnrepo}/hooks/post-commit", + wrapper => "$config{svnrepo}/hooks/post-commit", wrappermode => 04755, -) if $common{$svn}; + +) if $config{$svn}; -- 2.26.2