From adc2eb3d8c900a011000431b01ff4b89d5f4f689 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 6 Aug 2008 01:58:04 -0400 Subject: [PATCH] Options set in the setup file are now immediatly loaded by ikiwiki -setup. This allows later switches to override them. Previously, setup file options overrode most command line options. --- IkiWiki.pm | 11 +++++++++-- IkiWiki/Setup.pm | 4 ++-- debian/changelog | 3 +++ ikiwiki.in | 14 ++++++-------- po/ikiwiki.pot | 24 ++++++++++++------------ 5 files changed, 32 insertions(+), 24 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index e1c4b6e2f..e4765219e 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -354,6 +354,13 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, + setup => { + type => "internal", + default => undef, + description => "running in setup mode", + safe => 0, + rebuild => 0, + }, refresh => { type => "internal", default => 0, @@ -375,10 +382,10 @@ sub getsetup () { #{{{ safe => 0, rebuild => 0, }, - setup => { + setupfile => { type => "internal", default => undef, - description => "setup file to read", + description => "path to setup file", safe => 0, rebuild => 0, }, diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index e014a2a10..f8bb664c4 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -12,8 +12,8 @@ use File::Spec; sub load ($) { # {{{ my $setup=IkiWiki::possibly_foolish_untaint(shift); - $config{setupfile}=File::Spec->rel2abs($config{setup}); - delete $config{setup}; + $config{setupfile}=File::Spec->rel2abs($setup); + #translators: The first parameter is a filename, and the second #translators: is a (probably not translated) error message. open (IN, $setup) || error(sprintf(gettext("cannot read %s: %s"), $setup, $!)); diff --git a/debian/changelog b/debian/changelog index b4bdfeefe..e901354eb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,6 +25,9 @@ ikiwiki (2.60) UNRELEASED; urgency=low account. Also, avoid making index pages for directories that contain no files. * external: Fix support for hooks called in an array context. + * Options set in the setup file are now immediatly loaded by ikiwiki -setup. + This allows later switches to override them. Previously, setup file + options overrode most command line options. -- Joey Hess Mon, 21 Jul 2008 11:35:46 -0400 diff --git a/ikiwiki.in b/ikiwiki.in index ddbd71056..e0a657cda 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -19,7 +19,11 @@ sub getconfig () { #{{{ eval q{use Getopt::Long}; Getopt::Long::Configure('pass_through'); GetOptions( - "setup|s=s" => \$config{setup}, + "setup|s=s" => sub { + require IkiWiki::Setup; + IkiWiki::Setup::load($_[1]); + $config{setup}=1; + }, "dumpsetup|s=s" => \$config{dumpsetup}, "wikiname=s" => \$config{wikiname}, "verbose|v!" => \$config{verbose}, @@ -115,9 +119,7 @@ sub main () { #{{{ getconfig(); if ($config{setup}) { - require IkiWiki::Setup; - IkiWiki::Setup::load($config{setup}); - + delete $config{setup}; loadplugins(); checkconfig(); @@ -149,10 +151,6 @@ sub main () { #{{{ if (! $config{refresh}) { $config{rebuild}=1; } - - # ignore syslog setting from setup file - # while doing initial setup - $config{syslog}=0 unless $config{dumpsetup}; } if ($config{dumpsetup}) { diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 53f6e0e57..a6328c48d 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-08-05 20:43-0400\n" +"POT-Creation-Date: 2008-08-06 01:51-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -71,7 +71,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:783 ../IkiWiki/CGI.pm:784 ../IkiWiki.pm:1110 +#: ../IkiWiki/CGI.pm:783 ../IkiWiki/CGI.pm:784 ../IkiWiki.pm:1117 msgid "Error" msgstr "" @@ -152,7 +152,7 @@ msgstr "" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:194 +#: ../IkiWiki/Plugin/amazon_s3.pm:38 ../ikiwiki.in:192 msgid "done" msgstr "" @@ -190,7 +190,7 @@ msgstr "" msgid "attachment upload" msgstr "" -#: ../IkiWiki/Plugin/autoindex.pm:74 +#: ../IkiWiki/Plugin/autoindex.pm:77 msgid "automatic index generation" msgstr "" @@ -836,35 +836,35 @@ msgstr "" msgid "usage: ikiwiki [options] source dest" msgstr "" -#: ../ikiwiki.in:79 +#: ../ikiwiki.in:83 msgid "usage: --set var=value" msgstr "" -#: ../ikiwiki.in:127 +#: ../ikiwiki.in:129 msgid "generating wrappers.." msgstr "" -#: ../ikiwiki.in:183 +#: ../ikiwiki.in:181 msgid "rebuilding wiki.." msgstr "" -#: ../ikiwiki.in:186 +#: ../ikiwiki.in:184 msgid "refreshing wiki.." msgstr "" -#: ../IkiWiki.pm:427 +#: ../IkiWiki.pm:434 msgid "Must specify url to wiki with --url when using --cgi" msgstr "" -#: ../IkiWiki.pm:471 +#: ../IkiWiki.pm:478 msgid "cannot use multiple rcs plugins" msgstr "" -#: ../IkiWiki.pm:1093 +#: ../IkiWiki.pm:1100 #, perl-format msgid "preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1581 +#: ../IkiWiki.pm:1588 msgid "yes" msgstr "" -- 2.44.0