From e1f7146041ab7dbbaf045a5da959d9086fbaae50 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 27 Jul 2008 00:54:15 -0400 Subject: [PATCH] avoid clobbering example diffurl --- IkiWiki/Plugin/bzr.pm | 5 +---- IkiWiki/Plugin/git.pm | 5 +---- IkiWiki/Plugin/mercurial.pm | 5 +---- IkiWiki/Plugin/svn.pm | 5 +---- IkiWiki/Plugin/tla.pm | 5 +---- Makefile.PL | 4 ++++ debian/rules | 1 - simple.setup | 27 +++++++++++++++++++++++++++ 8 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 simple.setup diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm index 39227cbae..99025a973 100644 --- a/IkiWiki/Plugin/bzr.pm +++ b/IkiWiki/Plugin/bzr.pm @@ -23,9 +23,6 @@ sub import { #{{{ } #}}} sub checkconfig () { #{{{ - if (! defined $config{diffurl}) { - $config{diffurl}=""; - } if (defined $config{bzr_wrapper} && length $config{bzr_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{bzr_wrapper}, @@ -225,7 +222,7 @@ sub rcs_recentchanges ($) { #{{{ # Skip source name in renames $filename =~ s/^.* => //; - my $diffurl = $config{'diffurl'}; + my $diffurl = defined $config{'diffurl'} ? $config{'diffurl'} : ""; $diffurl =~ s/\[\[file\]\]/$filename/go; $diffurl =~ s/\[\[file-id\]\]/$fileid/go; $diffurl =~ s/\[\[r2\]\]/$info->{revno}/go; diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index b20793d86..5e302729e 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -26,9 +26,6 @@ sub import { #{{{ } #}}} sub checkconfig () { #{{{ - if (! defined $config{diffurl}) { - $config{diffurl}=""; - } if (! defined $config{gitorigin_branch}) { $config{gitorigin_branch}="origin"; } @@ -472,7 +469,7 @@ sub rcs_recentchanges ($) { #{{{ foreach my $detail (@{ $ci->{'details'} }) { my $file = $detail->{'file'}; - my $diffurl = $config{'diffurl'}; + my $diffurl = defined $config{'diffurl'} ? $config{'diffurl'} : ""; $diffurl =~ s/\[\[file\]\]/$file/go; $diffurl =~ s/\[\[sha1_parent\]\]/$ci->{'parent'}/go; $diffurl =~ s/\[\[sha1_from\]\]/$detail->{'sha1_from'}/go; diff --git a/IkiWiki/Plugin/mercurial.pm b/IkiWiki/Plugin/mercurial.pm index 738be8c32..d2c34fa6a 100644 --- a/IkiWiki/Plugin/mercurial.pm +++ b/IkiWiki/Plugin/mercurial.pm @@ -23,9 +23,6 @@ sub import { #{{{ } #}}} sub checkconfig () { #{{{ - if (! defined $config{diffurl}) { - $config{diffurl}=""; - } if (exists $config{mercurial_wrapper} && length $config{mercurial_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{mercurial_wrapper}, @@ -199,7 +196,7 @@ sub rcs_recentchanges ($) { #{{{ } foreach my $file (split / /,$info->{files}) { - my $diffurl = $config{'diffurl'}; + my $diffurl = defined $config{diffurl} ? $config{'diffurl'} : ""; $diffurl =~ s/\[\[file\]\]/$file/go; $diffurl =~ s/\[\[r2\]\]/$info->{changeset}/go; diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index 05312a1ed..51683704c 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -22,9 +22,6 @@ sub import { #{{{ } #}}} sub checkconfig () { #{{{ - if (! defined $config{diffurl}) { - $config{diffurl}=""; - } if (! defined $config{svnpath}) { $config{svnpath}="trunk"; } @@ -318,7 +315,7 @@ sub rcs_recentchanges ($) { #{{{ $file=$1; } - my $diffurl=$config{diffurl}; + my $diffurl=defined $config{diffurl} ? $config{diffurl} : ""; $diffurl=~s/\[\[file\]\]/$file/g; $diffurl=~s/\[\[r1\]\]/$rev - 1/eg; $diffurl=~s/\[\[r2\]\]/$rev/g; diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index b95c1a522..6faaecccc 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -21,9 +21,6 @@ sub import { #{{{ } #}}} sub checkconfig () { #{{{ - if (! defined $config{diffurl}) { - $config{diffurl}=""; - } if (defined $config{tla_wrapper} && length $config{tla_wrapper}) { push @{$config{wrappers}}, { wrapper => $config{tla_wrapper}, @@ -215,7 +212,7 @@ sub rcs_recentchanges ($) { my @pages; foreach my $file (@paths) { - my $diffurl=$config{diffurl}; + my $diffurl=defined $config{diffurl} ? $config{diffurl} : ""; $diffurl=~s/\[\[file\]\]/$file/g; $diffurl=~s/\[\[rev\]\]/$change/g; push @pages, { diff --git a/Makefile.PL b/Makefile.PL index f7c090ff2..04ed70502 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -48,6 +48,10 @@ extra_clean: $(MAKE) -C po clean extra_install: + install -d $(DESTDIR)/etc/ikiwiki + install -m 0644 wikilist $(DESTDIR)/etc/ikiwiki + install -m 0644 simple.setup $(DESTDIR)/etc/ikiwiki + install -d $(DESTDIR)$(PREFIX)/share/ikiwiki for dir in `cd underlays && find . -follow -type d ! -regex '.*\.svn.*'`; do \ install -d $(DESTDIR)$(PREFIX)/share/ikiwiki/$$dir; \ diff --git a/debian/rules b/debian/rules index 2af69a5f7..25b1f57b6 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,6 @@ binary-indep: build dh_testroot dh_clean -k $(MAKE) pure_install DESTDIR=$(shell pwd)/debian/ikiwiki - dh_install wikilist etc/ikiwiki dh_installdocs html dh_installexamples doc/examples/* dh_link usr/share/common-licenses/GPL-2 usr/share/doc/ikiwiki/html/GPL diff --git a/simple.setup b/simple.setup new file mode 100644 index 000000000..c7be9a7f3 --- /dev/null +++ b/simple.setup @@ -0,0 +1,27 @@ +#!/usr/bin/perl +# Simple ikiwiki setup. +# +# This setup file causes ikiwiki to create a wiki, check it into revision +# control, generate a setup file for the new wiki, and set everything up. +# +# Just run: ikiwiki -setup /etc/ikiwiki/simple.setup +# +# By default, it asks two questions, and confines itself to the user's home +# directory. You can edit it to change what it asks questions about, or to +# modify the values to use site-specific settings. + +require IkiWiki::Setup::Automator; + +our $wikiname=IkiWiki::Setup::Automator::ask( + "What will the wiki be named?", "wiki"); +our $rcs=IkiWiki::Setup::Automator::ask( + "What revision control system to use?", "git"); + +IkiWiki::Setup::Automator::import( + wikiname => $wikiname, + rcs => $rcs, + srcdir => "$ENV{HOME}/$wikiname", + destdir => "$ENV{HOME}/public_html/$wikiname", + repository => "$ENV{HOME}/$wikiname.$rcs", + setupfile => "$ENV{HOME}/$wikiname.setup", +); -- 2.26.2