Add new --clean option; this makes ikiwiki remove all built files in the destdir, as well as wrappers and the .ikiwiki directory.

master
Joey Hess 2010-02-28 00:12:47 -05:00
parent 70972b1687
commit 60d2dd318f
7 changed files with 42 additions and 4 deletions

View File

@ -409,6 +409,13 @@ sub getsetup () {
safe => 0,
rebuild => 0,
},
clean => {
type => "internal",
default => 0,
description => "running in clean mode",
safe => 0,
rebuild => 0,
},
refresh => {
type => "internal",
default => 0,

View File

@ -683,6 +683,17 @@ sub refresh () {
}
}
sub clean_rendered {
lockwiki();
loadindex();
remove_unrendered();
foreach my $page (keys %oldrenderedfiles) {
foreach my $file (@{$oldrenderedfiles{$page}}) {
prune($config{destdir}."/".$file);
}
}
}
sub commandline_render () {
lockwiki();
loadindex();

View File

@ -51,7 +51,7 @@ docwiki: ikiwiki.out
$(PERL) -Iblib/lib $(extramodules) $(tflag) ikiwiki.out -libdir . -setup docwiki.setup -refresh
extra_clean:
rm -rf html doc/.ikiwiki
$(PERL) -I. $(extramodules) $(tflag) ikiwiki.in -libdir . -setup docwiki.setup -clean
rm -f *.man ikiwiki.out ikiwiki.setup plugins/*.pyc
$(MAKE) -C po clean

4
debian/changelog vendored
View File

@ -1,4 +1,4 @@
ikiwiki (3.20100213) UNRELEASED; urgency=low
ikiwiki (3.20100228) UNRELEASED; urgency=low
* comments: Display number of comments in comment action link.
* Rebuild wikis on upgrade to this version to get the comment counts
@ -8,6 +8,8 @@ ikiwiki (3.20100213) UNRELEASED; urgency=low
files/directories.
* Fix admin openid detection in setup automator, and avoid prompting
for a password.
* Add new --clean option; this makes ikiwiki remove all built
files in the destdir, as well as wrappers and the .ikiwiki directory.
-- Joey Hess <joeyh@debian.org> Sun, 14 Feb 2010 17:02:10 -0500

View File

@ -50,6 +50,14 @@ These options control the mode that ikiwiki operates in.
If used with --setup --refresh, this makes it also update any configured
wrappers.
* --clean
This makes ikiwiki clean up by removing any files it denerated in the
`destination` directory, as well as any configured wrappers, and the
`.ikiwiki` state directory. This is mostly useful if you're running
ikiwiki in a Makefile to build documentation and want a corresponding
`clean` target.
* --cgi
Enable [[CGI]] mode. In cgi mode ikiwiki runs as a cgi script, and

View File

@ -37,6 +37,7 @@ sub getconfig () {
"syslog!" => \$config{syslog},
"rebuild!" => \$config{rebuild},
"refresh!" => \$config{refresh},
"clean!" => \$config{clean},
"post-commit" => \$config{post_commit},
"render=s" => \$config{render},
"wrappers!" => \$config{genwrappers},
@ -135,6 +136,7 @@ sub main () {
if (@{$config{wrappers}} &&
! $config{render} && ! $config{dumpsetup} &&
! $config{clean} &&
((! $config{refresh} && ! $config{post_commit})
|| $config{genwrappers})) {
debug(gettext("generating wrappers.."));
@ -159,7 +161,7 @@ sub main () {
# setup implies a wiki rebuild by default
if (! $config{refresh} && ! $config{render} &&
! $config{post_commit}) {
! $config{post_commit} && ! $config{clean}) {
$config{rebuild}=1;
}
}
@ -190,6 +192,14 @@ sub main () {
elsif ($config{post_commit} && ! commit_hook_enabled()) {
# do nothing
}
elsif ($config{clean}) {
require IkiWiki::Render;
foreach my $wrapper (@{$config{wrappers}}) {
prune($wrapper->{wrapper});
}
clean_rendered();
system("rm", "-rf", $config{wikistatedir});
}
else {
if ($config{rebuild}) {
debug(gettext("rebuilding wiki.."));

View File

@ -1,5 +1,5 @@
Name: ikiwiki
Version: 3.20100212
Version: 3.20100228
Release: 1%{?dist}
Summary: A wiki compiler