Group related plugins into sections in the setup file, and drop unused rcs plugins from the setup file.

master
Joey Hess 2010-02-11 22:24:15 -05:00
parent c923e0ba33
commit a63929f6cc
30 changed files with 70 additions and 11 deletions

View File

@ -15,6 +15,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
anonok_pagespec => {
type => "pagespec",

View File

@ -18,6 +18,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
blogspam_pagespec => {
type => 'pagespec',

View File

@ -36,6 +36,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
bzr_wrapper => {
type => "string",

View File

@ -16,6 +16,7 @@ sub getsetup {
plugin => {
safe => 1,
rebuild => undef,
section => "core",
},
}

View File

@ -85,6 +85,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
cvsrepo => {
type => "string",

View File

@ -92,6 +92,7 @@ sub getsetup() {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
darcs_wrapper => {
type => "string",

View File

@ -17,6 +17,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 1,
section => "core",
},
}

View File

@ -68,6 +68,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
git_wrapper => {
type => "string",

View File

@ -40,6 +40,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => undef,
section => "core",
},
htmlscrubber_skip => {
type => "pagespec",

View File

@ -20,6 +20,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
cgiauthurl => {
type => "string",

View File

@ -49,6 +49,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => undef,
section => "core",
},
rss => {
type => "boolean",

View File

@ -20,6 +20,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 1,
section => "core",
},
}

View File

@ -15,6 +15,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
locked_pages => {
type => "pagespec",

View File

@ -16,6 +16,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 1, # format plugin
section => "core",
},
multimarkdown => {
type => "boolean",

View File

@ -36,6 +36,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
mercurial_wrapper => {
type => "string",

View File

@ -20,6 +20,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => undef,
section => "core",
},
}

View File

@ -15,6 +15,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
moderate_users => {
type => 'boolean',

View File

@ -68,6 +68,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
mtn_wrapper => {
type => "string",

View File

@ -16,6 +16,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
}

View File

@ -26,6 +26,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
openidsignup => {
type => "string",

View File

@ -16,6 +16,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 1,
section => "core",
},
}

View File

@ -19,6 +19,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
account_creation_password => {
type => "string",

View File

@ -22,6 +22,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 1,
section => "core",
},
recentchangespage => {
type => "string",

View File

@ -16,6 +16,7 @@ sub getsetup () {
plugin => {
safe => 1,
rebuild => 0,
section => "auth",
},
}

View File

@ -44,6 +44,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
svnrepo => {
type => "string",

View File

@ -34,6 +34,7 @@ sub getsetup () {
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
section => "rcs",
},
tla_wrapper => {
type => "string",

View File

@ -77,7 +77,6 @@ sub merge ($) {
sub getsetup () {
# Gets all available setup data from all plugins. Returns an
# ordered list of [plugin, setup] pairs.
my @ret;
# disable logging to syslog while dumping, broken plugins may
# whine when loaded
@ -85,27 +84,48 @@ sub getsetup () {
$config{syslog}=undef;
# Load all plugins, so that all setup options are available.
my @plugins=grep { $_ ne $config{rcs} } sort(IkiWiki::listplugins());
unshift @plugins, $config{rcs} if $config{rcs}; # rcs plugin 1st
my @plugins=IkiWiki::listplugins();
foreach my $plugin (@plugins) {
eval { IkiWiki::loadplugin($plugin) };
if (exists $IkiWiki::hooks{checkconfig}{$plugin}{call}) {
my @s=eval { $IkiWiki::hooks{checkconfig}{$plugin}{call}->() };
}
}
my %sections;
foreach my $plugin (@plugins) {
if (exists $IkiWiki::hooks{getsetup}{$plugin}{call}) {
# use an array rather than a hash, to preserve order
my @s=eval { $IkiWiki::hooks{getsetup}{$plugin}{call}->() };
next unless @s;
push @ret, [ $plugin, \@s ],
# set default section value (note use of shared
# hashref between array and hash)
my %s=@s;
if (! exists $s{plugin} || ! $s{plugin}->{section}) {
$s{plugin}->{section}="misc";
}
# only the selected rcs plugin is included
if ($config{rcs} && $plugin eq $config{rcs}) {
$s{plugin}->{section}="core";
}
elsif ($s{plugin}->{section} eq "rcs") {
next;
}
push @{$sections{$s{plugin}->{section}}}, [ $plugin, \@s ];
}
}
$config{syslog}=$syslog;
return @ret;
return map { sort { $a->[0] cmp $b->[0] } @{$sections{$_}} }
sort { # core first, then alphabetical
($b eq "core") <=> ($a eq "core")
||
$a cmp $b
} keys %sections;
}
sub dump ($) {

View File

@ -90,10 +90,18 @@ sub gendump ($) {
# disable logging to syslog while dumping
$config{syslog}=undef;
my $curr_section;
push @ret, dumpvalues(\%setup, IkiWiki::getsetup());
foreach my $pair (IkiWiki::Setup::getsetup()) {
my $plugin=$pair->[0];
my $setup=$pair->[1];
my %s=@{$setup};
my $section=$s{plugin}->{section};
if (! defined $curr_section || $curr_section ne $section) {
$curr_section=$section;
push @ret, "", "\t#", "\t# $section plugins", "\t#";
}
my @values=dumpvalues(\%setup, @{$setup});
if (@values) {
push @ret, "", "\t# $plugin plugin", @values;

2
debian/changelog vendored
View File

@ -22,6 +22,8 @@ ikiwiki (3.20100123) UNRELEASED; urgency=low
* httpauth: Add httpauth_pagespec setting that can be used to limit
pages to only being edited via users authed with httpauth.
* Allow globs to be used in user() pagespecs.
* Group related plugins into sections in the setup file, and drop
unused rcs plugins from the setup file.
-- Joey Hess <joeyh@debian.org> Tue, 26 Jan 2010 22:25:33 -0500

View File

@ -457,6 +457,12 @@ describing the option. There can also be an item named "plugin", which
describes the plugin as a whole. For example:
return
plugin => {
description => "description of this plugin",
safe => 1,
rebuild => 1,
section => "misc",
},
option_foo => {
type => "boolean",
description => "enable foo?",
@ -471,11 +477,6 @@ describes the plugin as a whole. For example:
safe => 1,
rebuild => 0,
},
plugin => {
description => "description of this plugin",
safe => 1,
rebuild => 1,
},
* `type` can be "boolean", "string", "integer", "pagespec",
or "internal" (used for values that are not user-visible). The type is
@ -496,6 +497,8 @@ describes the plugin as a whole. For example:
the plugin) will require a wiki rebuild, false if no rebuild is needed,
and undef if a rebuild could be needed in some circumstances, but is not
strictly required.
* `section` can optionally specify which section in the config file
the plugin fits in.
### genwrapper