]> scripts.mit.edu Git - www/ikiwiki.git/commitdiff
add rebuild after calling setup, better format for setup files
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 13 Mar 2006 19:10:29 +0000 (19:10 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Mon, 13 Mar 2006 19:10:29 +0000 (19:10 +0000)
doc/usage.mdwn
doc/wikilink.mdwn
ikiwiki
ikiwiki.setup

index 8efb9a63d5d01244172a22248430969039bc54d1..0377014fd431d0344999775715569049b49a5173 100644 (file)
@@ -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
 
index dab5d3ac4c0fdc849cefec715dcf628a9c71651f..ac0ec9d564d84ba0e4688f9ff2fd54cdf351b202 100644 (file)
@@ -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 111ef54fce0a5c19d3f1ec68da9f2894269eadaf..ea3833a37d5e98f062db2d5cdc410962a29a9330 100755 (executable)
--- 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=<IN>;
@@ -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;
 } #}}}
 
index 44c4f3106467b6c497e2b6326838cd1033196608..5a902a23cd1c6f0757b3c47d342230c797aebeee 100644 (file)
@@ -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};