From c4c0c33644b714b180d7a8ae937ab24e9b6212b5 Mon Sep 17 00:00:00 2001 From: Quentin Smith Date: Fri, 5 Mar 2010 15:31:58 -0500 Subject: [PATCH] Provide a generate-preview script that people can use to locally generate the wiki for testing --- generate-preview.sh | 29 +++++++++ ikiwiki.setup | 148 ++++++++++++++++++++------------------------ 2 files changed, 95 insertions(+), 82 deletions(-) create mode 100644 generate-preview.sh diff --git a/generate-preview.sh b/generate-preview.sh new file mode 100644 index 0000000..690efb2 --- /dev/null +++ b/generate-preview.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e + +export IKIWIKI_PREVIEW_OUTPUT="$1" +if [ -z "$IKIWIKI_PREVIEW_OUTPUT" ]; then + echo "You must call this script as" + echo "./generate-preview.sh OUTPUT_DIR [IKIWIKI_INSTALL_ROOT]" + exit 1 +fi + +srcdir=$(pwd) +if [ -n "$2" ]; then + tmpoutdir="$2" +else + tmpdir=`mktemp -d` + tmpoutdir=`mktemp -d` + echo "Building ikiwiki source in $tmpdir" + echo "Building ikiwiki into $tmpoutdir" + trap 'rm -rf "$tmpdir"' 0 + trap 'rm -rf "$tmpoutdir"' 0 + cd "$tmpdir" + (cd "$srcdir/ikiwiki" && tar c .) | (cd "$tmpdir" && tar x) + ./Makefile.PL INSTALL_BASE="$tmpoutdir" PREFIX= + make install --old-file=docwiki +fi +cd "$srcdir" +export IKIWIKI_SHARE="$tmpoutdir/share/ikiwiki" +"$tmpoutdir"/bin/ikiwiki --setup "$srcdir"/ikiwiki.setup diff --git a/ikiwiki.setup b/ikiwiki.setup index 2b59256..81df5cf 100644 --- a/ikiwiki.setup +++ b/ikiwiki.setup @@ -5,7 +5,12 @@ # wrappers and build the wiki. # # Remember to re-run ikiwiki --setup any time you edit this file. -use IkiWiki::Setup::Standard { + +use vars qw/%setup_args/; + +BEGIN { + +my %common_setup_args = ( # name of the wiki wikiname => 'SIPB', # contact email for wiki @@ -14,20 +19,6 @@ use IkiWiki::Setup::Standard { adminuser => [], # users who are banned from the wiki banned_users => [], - # where the source of the wiki is located - srcdir => '/afs/sipb.mit.edu/project/sipb-www/ikiwiki/src', - # where to build the wiki - destdir => '/afs/sipb.mit.edu/project/sipb-www/Scripts/wiki', - # base url to the wiki - url => 'http://sipb.mit.edu', - # url to the ikiwiki.cgi - cgiurl => 'https://sipb.mit.edu:444/ikiwiki.cgi', - # filename of cgi wrapper to generate - cgi_wrapper => '/afs/sipb.mit.edu/project/sipb-www/Scripts/wiki-cgi/ikiwiki.cgi', - # mode for cgi_wrapper (can safely be made suid) - cgi_wrappermode => '06755', - # rcs backend to use - rcs => 'git', # plugins to add to the default configuration # IMPORTANT! If you add plugins that involve interface changes, you # will need to modify our templates to allow this, as our custom @@ -37,10 +28,6 @@ use IkiWiki::Setup::Standard { # IMPORTANT! If you reenable passwordauth/openid, you need to # do some modifications described in TODO.SIPB in the source-tree disable_plugins => [qw(smiley passwordauth openid)], - # location of template files - templatedir => '/mit/sipb-www/share/ikiwiki/templates', - # base wiki source location - underlaydir => '/mit/sipb-www/share/ikiwiki/basewiki', # display verbose messages when building? verbose => 1, # log to syslog? @@ -100,16 +87,6 @@ use IkiWiki::Setup::Standard { # virus checker program (reads STDIN, returns nonzero if virus found) #virus_checker => 'clamdscan -', - # bzr plugin - # bzr post-commit hook to generate - #bzr_wrapper => '', - # mode for bzr_wrapper (can safely be made suid) - #bzr_wrappermode => '06755', - # url to show file history, using loggerhead ([[file]] substituted) - #historyurl => '', - # url to view a diff, using loggerhead ([[file]] and [[r2]] substituted) - #diffurl => 'http://example.com/revision?start_revid=[[r2]]#[[file]]-s', - # calendar plugin # base of the archives hierarchy #archivebase => 'archives', @@ -131,25 +108,6 @@ use IkiWiki::Setup::Standard { #comments_allowauthor => 0, # commit comments to the VCS #comments_commit => 1, - - # git plugin - # git hook to generate - git_wrapper => '/mit/sipb-www/wiki.git/hooks/post-update-wiki', - # mode for git_wrapper (can safely be made suid) - #git_wrappermode => '06755', - # git pre-receive hook to generate - #git_test_receive_wrapper => '/git/wiki.git/hooks/pre-receive', - # unix users whose commits should be checked by the pre-receive hook - #untrusted_committers => [], - # gitweb url to show file history ([[file]] substituted) - historyurl => '/cgit/cgit.cgi/wiki/log/[[file]]', - # gitweb url to show a diff ([[file]], [[sha1_to]], [[sha1_from]], [[sha1_commit]], and [[sha1_parent]] substituted) - diffurl => '/cgit/cgit.cgi/wiki/diff/?id=[[sha1_commit]]', - # where to pull and push changes (set to empty string to disable) - #gitorigin_branch => 'origin', - # branch that the wiki is stored in - #gitmaster_branch => 'master', - # htmlscrubber plugin # PageSpec specifying pages not to scrub #htmlscrubber_skip => '!*/Discussion', @@ -180,16 +138,6 @@ use IkiWiki::Setup::Standard { # enable multimarkdown features? #multimarkdown => 0, - # mercurial plugin - # mercurial post-commit hook to generate - #mercurial_wrapper => '', - # mode for mercurial_wrapper (can safely be made suid) - #mercurial_wrappermode => '06755', - # url to hg serve'd repository, to show file history ([[file]] substituted) - #historyurl => 'http://example.com:8000/log/tip/[[file]]', - # url to hg serve'd repository, to show diff ([[file]] and [[r2]] substituted) - #diffurl => 'http://localhost:8000/?fd=[[r2]];file=[[file]]', - # mirrorlist plugin # list of mirrors #mirrorlist => {}, @@ -226,20 +174,6 @@ use IkiWiki::Setup::Standard { # path to the omega cgi program #omega_cgi => '/usr/lib/cgi-bin/omega/omega', - # svn plugin - # subversion repository location - #svnrepo => '/svn/wiki', - # path inside repository where the wiki is located - #svnpath => 'trunk', - # svn post-commit hook to generate - #svn_wrapper => '/svn/wikirepo/hooks/post-commit', - # mode for svn_wrapper (can safely be made suid) - #svn_wrappermode => '04755', - # viewvc url to show file history ([[file]] substituted) - #historyurl => 'http://svn.example.org/trunk/[[file]]', - # viewvc url to show a diff ([[file]], [[r1]], and [[r2]] substituted) - #diffurl => 'http://svn.example.org/trunk/[[file]]?root=wiki&r1=[[r1]]&r2=[[r2]]', - # tag plugin # parent page tags are located under #tagbase => 'tag', @@ -258,19 +192,69 @@ use IkiWiki::Setup::Standard { # LaTeX postfix for teximg plugin #teximg_postfix => '\\end{document}', - # tla plugin - # tla post-commit hook to generate - #tla_wrapper => '', - # mode for tla_wrapper (can safely be made suid) - #tla_wrappermode => '06755', - # url to show file history ([[file]] substituted) - #historyurl => '', - # url to show a diff ([[file]] and [[rev]] substituted) - #diffurl => '', - # websetup plugin # list of plugins that cannot be enabled/disabled via the web interface #websetup_force_plugins => [], # show unsafe settings, read-only, in web interface? #websetup_show_unsafe => 1, +); + +if ($ENV{"IKIWIKI_PREVIEW_OUTPUT"}) { + + my $self_path = $IkiWiki::config{'setupfile'}; + use File::Basename; + my $git_root = dirname($self_path); + use File::Spec::Functions; + + %setup_args = ( + %common_setup_args, + srcdir => catdir($self_path, "wiki"), + destdir => $ENV{"IKIWIKI_PREVIEW_OUTPUT"}, + url => 'http://sipb.mit.edu', + templatedir => catdir($ENV{"IKIWIKI_SHARE"}, 'templates'), + underlaydir => catdir($ENV{"IKIWIKI_SHARE"}, 'basewiki'), + ); +} else { +%setup_args = ( + %common_setup_args, + # where the source of the wiki is located + srcdir => '/afs/sipb.mit.edu/project/sipb-www/ikiwiki/src', + # where to build the wiki + destdir => '/afs/sipb.mit.edu/project/sipb-www/Scripts/wiki', + # base url to the wiki + url => 'http://sipb.mit.edu', + # url to the ikiwiki.cgi + cgiurl => 'https://sipb.mit.edu:444/ikiwiki.cgi', + # filename of cgi wrapper to generate + cgi_wrapper => '/afs/sipb.mit.edu/project/sipb-www/Scripts/wiki-cgi/ikiwiki.cgi', + # mode for cgi_wrapper (can safely be made suid) + cgi_wrappermode => '06755', + # rcs backend to use + rcs => 'git', + # location of template files + templatedir => '/mit/sipb-www/share/ikiwiki/templates', + # base wiki source location + underlaydir => '/mit/sipb-www/share/ikiwiki/basewiki', + + # git plugin + # git hook to generate + git_wrapper => '/mit/sipb-www/wiki.git/hooks/post-update-wiki', + # mode for git_wrapper (can safely be made suid) + #git_wrappermode => '06755', + # git pre-receive hook to generate + #git_test_receive_wrapper => '/git/wiki.git/hooks/pre-receive', + # unix users whose commits should be checked by the pre-receive hook + #untrusted_committers => [], + # gitweb url to show file history ([[file]] substituted) + historyurl => '/cgit/cgit.cgi/wiki/log/[[file]]', + # gitweb url to show a diff ([[file]], [[sha1_to]], [[sha1_from]], [[sha1_commit]], and [[sha1_parent]] substituted) + diffurl => '/cgit/cgit.cgi/wiki/diff/?id=[[sha1_commit]]', + # where to pull and push changes (set to empty string to disable) + #gitorigin_branch => 'origin', + # branch that the wiki is stored in + #gitmaster_branch => 'master', +); } +} + +use IkiWiki::Setup::Standard \%setup_args; -- 2.44.0