config files now based on perl modules

add MakeMaker foo for module
master
joey 2006-03-15 03:24:34 +00:00
parent 2d1989983e
commit 0a52e8fd82
8 changed files with 86 additions and 50 deletions

View File

@ -0,0 +1,33 @@
#!/usr/bin/perl
# Standard ikiwiki setup module.
# Parameters to import should be all the standard ikiwiki config stuff,
# plus hashes for cgiwrapper and svnwrapper, which specify any differing
# config stuff for them and cause the wrappers to be made.
package IkiWiki::Setup::Standard;
use warnings;
use strict;
sub import {
my %setup=%{$_[1]};
::debug("generating wrappers..");
foreach my $wrapper (@{$setup{wrapper}}) {
::gen_wrapper(%::config, %setup, %{$wrapper});
}
::debug("rebuilding wiki..");
foreach my $c (keys %setup) {
$::config{$c}=::possibly_foolish_untaint($setup{$c})
if defined $setup{$c} && ! ref $setup{$c};
}
$::config{rebuild}=1;
::refresh();
::debug("done");
::saveindex();
}
1

View File

@ -1,7 +0,0 @@
all:
./ikiwiki doc templates html --wikiname="ikiwiki" --verbose \
--nosvn --exclude=/discussion
clean:
rm -rf html
rm -rf doc/.ikiwiki

29
Makefile.PL 100755
View File

@ -0,0 +1,29 @@
#!/usr/bin/perl
use warnings;
use strict;
use ExtUtils::MakeMaker;
# Add a few more targets.
sub MY::postamble {
q{
all:: extra_build
clean:: extra_clean
install:: extra_install
pure_install:: extra_install
extra_build:
./ikiwiki doc templates html --wikiname="ikiwiki" --verbose \
--nosvn --exclude=/discussion
extra_clean:
rm -rf html
rm -rf doc/.ikiwiki
extra_install:
}
}
WriteMakefile(
'NAME' => 'IkiWiki',
'EXE_FILES' => ['ikiwiki'],
);

View File

@ -4,8 +4,6 @@
to point to it, but will forget to update the linkbacks in Foo/Baz.
And if Foo/Bar/Baz is then removed, it forgets to update Foo/Bar to link
back to Foo/Baz.
* Foo/Bar/Baz shows up as Bar/Baz in the linkbacks on page Foo/Bar. Should
show as just Baz there.
* If I try to do a web commit, to a svn+ssh repo, it fails with
"Host key verification failed."
I think that the setuid isn't fully taking; it should be running as me,

View File

@ -5,7 +5,7 @@
#
# Remember to re-run ikiwiki --setup any time you edit this file.
%setup=(
use IkiWiki::Setup::Standard {
wikiname => "MyWiki",
# Be sure to customise these..
@ -21,21 +21,25 @@
svn => 1,
svnrepo => "/svn/wiki",
# The svn wrapper.
svnwrapper => {
# Note that this will overwrite any exsting post-commit hoo
# script, which may not be what you want.
wrapper => "$config{svnrepo}/hooks/post-commit",
wrappermode => 04755,
},
wrappers => [
{
# The svn wrapper.
# Note that this will overwrite any exsting
# post-commit hook script, which may not be
# what you want.
wrapper => "$config{svnrepo}/hooks/post-commit",
wrappermode => 04755,
},
{
# The cgi wrapper.
#cgiwrapper => {
# cgi => 1,
# wrapper => "/var/www/wiki/ikiwiki.cgi",
# wrappermode => 06755,
#},
},
],
# The cgi wrapper.
#cgiwrapper => {
# cgi => 1,
# wrapper => "/var/www/wiki/ikiwiki.cgi",
# wrappermode => 06755,
#},
# Can anonymous web users edit pages?
#anonok => 1,
);
}

View File

@ -54,7 +54,7 @@ optional support for commits from the web.
directories, and read through and configure the rest of the file to your
liking.
Note that the default file has a block to configure a svnwraper. This
Note that the default file has a block to configure a svn wrapper. This
sets up a [[post-commit]] hook to update the wiki.
When you're satisfied, run `ikiwiki --setup ikiwiki.setup`, and it
@ -62,7 +62,7 @@ optional support for commits from the web.
8. Set up [[CGI]] to allow editing the wiki from the web.
Just edit ikiwiki.setup, uncomment the block for the cgiwrapper, make
Just edit ikiwiki.setup, uncomment the block for the cgi wrapper, make
sure the filename for the cgi wrapper is ok, run
`ikiwiki --setup ikiwiki.setup`, and you're done!

View File

@ -77,15 +77,6 @@ recentchanges that goes to the diff for any listed change.
Possibly add "next 100" link to it, but OTOH, you can just use svn log if
you need that data..
## setup classes
The setup files should "use WikiWiki::Setup" and the like at the top, and
indeed could just be one big use that passes all params to the module's
importer. The module then handles running ikiwiki functions. This would
allow for different types of setup files for more than just the one
hardcoded thing there is now, and would probably be good for upgrades,
incompatible changes, etc, too.
## base wiki
Need a toned down version of this wiki with a basic frontpage, sandbox and

16
ikiwiki
View File

@ -10,7 +10,8 @@ use Getopt::Long;
my (%links, %oldlinks, %oldpagemtime, %renderedfiles, %pagesources);
my %config=( #{{{
# Holds global config settings, also used by some modules.
our %config=( #{{{
wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$)},
wiki_link_regexp => qr/\[\[([^\s]+)\]\]/,
wiki_file_regexp => qr/(^[-A-Za-z0-9_.:\/+]+$)/,
@ -1165,21 +1166,8 @@ sub setup () { # {{{
($code)=$code=~/(.*)/s;
close IN;
my (%setup);
eval $code;
error($@) if $@;
gen_wrapper(%config, %setup, %{$setup{cgiwrapper}}) if $setup{cgiwrapper};
gen_wrapper(%config, %setup, %{$setup{svnwrapper}}) if $setup{svnwrapper};
print "$setup{wikiname} setup complete, now forcing a rebuild\n";
foreach my $c (keys %setup) {
$config{$c}=possibly_foolish_untaint($setup{$c})
if defined $setup{$c} && ! ref $setup{$c};
}
$config{rebuild}=1;
refresh();
saveindex();
exit;
} #}}}