* Add a libdir config option to let ikiwiki load perl modules, including
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 27 Jul 2007 00:48:06 +0000 (00:48 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 27 Jul 2007 00:48:06 +0000 (00:48 +0000)
  plugins, from a user-configurable directory.

IkiWiki.pm
debian/changelog
doc/ikiwiki.setup
doc/plugins.mdwn
doc/plugins/contrib.mdwn
doc/usage.mdwn
ikiwiki.in

index e5d1c5c44e2d09c0ec1bd748df60f9665a23fd5b..88dcdcb5b89993857cd61ffc64ce8d41f0957459 100644 (file)
@@ -86,6 +86,7 @@ sub defaultconfig () { #{{{
        adminemail => undef,
        plugin => [qw{mdwn inline htmlscrubber passwordauth openid signinedit
                      lockedit conditional}],
+       libdir => undef,
        timeformat => '%c',
        locale => undef,
        sslcookie => 0,
@@ -140,8 +141,12 @@ sub checkconfig () { #{{{
 } #}}}
 
 sub loadplugins () { #{{{
+       if (defined $config{libdir}) {
+               unshift @INC, $config{libdir};
+       }
+
        loadplugin($_) foreach @{$config{plugin}};
-       
+
        run_hooks(getopt => sub { shift->() });
        if (grep /^-/, @ARGV) {
                print STDERR "Unknown option: $_\n"
index 5a1d94a691cbd0ff5132a6ce763a5f8615b8f244..b6ef74000a6a1847cd244466bf49e7bfee0ee2c0 100644 (file)
@@ -17,8 +17,10 @@ ikiwiki (2.5) UNRELEASED; urgency=low
   * Add templatefile hook.
   * Add pagetemplate plugin, which allows changing the template used for
     a page. (Not to be confused with the hook of the same name..)
+  * Add a libdir config option to let ikiwiki load perl modules, including
+    plugins, from a user-configurable directory.
 
- -- Joey Hess <joeyh@debian.org>  Thu, 26 Jul 2007 16:16:55 -0400
+ -- Joey Hess <joeyh@debian.org>  Thu, 26 Jul 2007 20:47:23 -0400
 
 ikiwiki (2.4) unstable; urgency=low
 
index a772ca60b703e8708ca8ca9bcb995de9fbe0bf0a..9d2859a86c325d849a287e911d30d7b4ce410316 100644 (file)
@@ -109,6 +109,8 @@ use IkiWiki::Setup::Standard {
        #                   htmltidy fortune sidebar map rst anonok}],
        # If you want to disable any of the default plugins, list them here.
        #disable_plugins => [qw{inline htmlscrubber passwordauth openid}],
+       # To add a directory to the perl searh path, use this.
+       #libdir => "/home/me/.ikiwiki/",
 
        # For use with the tag plugin, make all tags be located under a
        # base page.
index 255f13f670c0701b97c504f4463a0b49be226b8b..3f154f1f0fa1be6047554c14fd64ec3012aa0f89 100644 (file)
@@ -11,14 +11,6 @@ To enable plugins, use the `--plugin` switch described in
 Enable the [[goodstuff]] plugin to get a nice selection of plugins that
 will fit most uses of ikiwiki.
 
-Without administrator access, you can add some custom plugins by storing 
-yourcustomplugin.pm in /home/user/.ikiwiki/IkiWiki/Plugins (or any other
-place, keeping the "IkiWiki/Plugins" part of the path) and adding this
-line at the begining of your ikiwiki.setup file:
-
-    BEGIN { push @INC, "/home/user/.ikiwiki" } 
-
-
 ## Plugin directory
 
 [[inline pages="plugins/* and !plugins/type/* and !plugins/write and
index ae234f67b0f52458f1916bb1f7875537fcfe491a..dc8b9077139e65f933a2f9f6be40eafd44877071 100644 (file)
@@ -13,3 +13,7 @@ IkiWiki::Plugin namespace, so they go in a IkiWiki/Plugin subdirectory
 inside the perl search path. For example, if your perl looks in
 `/usr/local/lib/site_perl` for modules, you can locally install ikiwiki
 plugins to `/usr/local/lib/site_perl/IkiWiki/Plugin`
+
+You can use the `libdir` configuration option to add a directory to the
+search path. For example, if you set `libdir` to `/home/you/.ikiwiki/`,
+then ikiwiki will look for plugins in `/home/you/.ikiwiki/IkiWiki/Plugins`.
index a8bb92d68cb48d2ba2121368d4ec3f23eba4c4a2..c83f833fcc69011a88a222442d12ec262c23a76e 100644 (file)
@@ -229,6 +229,12 @@ configuration options of their own.
   Disables use of a plugin. For example "--disable-plugin htmlscrubber"
   to do away with HTML sanitization.
 
+* --libdir directory
+
+  Makes ikiwiki look in the specified directory first, before the regular perl
+  library directories. For example, if you set libdir to "/home/you/.ikiwiki/",
+  you can install plugins in "/home/you/.ikiwiki/IkiWiki/Plugins/".
+
 * --discussion, --no-discussion
 
   Enables or disables "Discussion" links from being added to the header of
index 8cec3f5c0bac42c221ecd07c0d01cbc71ed8d9a3..fd864e0d82a78a96c5377fc8b18fc26edc7d722c 100755 (executable)
@@ -50,6 +50,7 @@ sub getconfig () { #{{{
                        "httpauth!" => \$config{httpauth},
                        "userdir=s" => \$config{userdir},
                        "htmlext=s" => \$config{htmlext},
+                       "libdir" => \$config{libdir},
                        "exclude=s@" => sub {
                                push @{$config{wiki_file_prune_regexps}}, $_[1];
                        },