From 3d6bc6e1b7145d85cd9495fd0a0d0a6823869368 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Sun, 23 Aug 2009 15:18:41 -0400 Subject: Add rsync plugin, though the only rsync-specific thing about it is the assumption that uploading an entire site is efficient. --- IkiWiki/Plugin/rsync.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 IkiWiki/Plugin/rsync.pm (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm new file mode 100644 index 000000000..630469528 --- /dev/null +++ b/IkiWiki/Plugin/rsync.pm @@ -0,0 +1,47 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::rsync; + +use warnings; +no warnings 'redefine'; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "rsync", call => \&getsetup); + hook(type => "checkconfig", id => "rsync", call => \&checkconfig); + hook(type => "postrefresh", id => "rsync", call => \&postrefresh); +} + +sub getsetup () { + return + plugin => { + safe => 0, + rebuild => 0, + }, + rsync_command => { + type => "string", + example => "rsync -qa --delete /path/to/destdir/ user\@host:/path/to/docroot/", + description => "command to upload regenerated pages to another host", + safe => 0, + rebuild => 0, + }, +} + +sub checkconfig { + if (! exists $config{rsync_command} || + ! defined $config{rsync_command}) { + error("Must specify rsync_command"); + } +} + +sub postrefresh () { + debug "in postrefresh hook, gonna run rsync"; + system $config{rsync_command}; + if ($? == -1) { + error("failed to execute rsync_command: $!"); + } elsif ($? != 0) { + error(sprintf("rsync_command exited %d", $? >> 8)); + } +} + +1 -- cgit v1.2.3 From 844169c9b06830df33ccde8abead015128baa496 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Sun, 23 Aug 2009 15:21:39 -0400 Subject: I'm not redefining any subs after all, don't prevent those warnings. --- IkiWiki/Plugin/rsync.pm | 1 - 1 file changed, 1 deletion(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 630469528..62ecc4e38 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -2,7 +2,6 @@ package IkiWiki::Plugin::rsync; use warnings; -no warnings 'redefine'; use strict; use IkiWiki 3.00; -- cgit v1.2.3 From 607534cecc7ab1bfefd1df1bfe19e4d7c338029b Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Sun, 23 Aug 2009 15:43:18 -0400 Subject: Explain that command must run unattended, and lose the debug statement. --- IkiWiki/Plugin/rsync.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 62ecc4e38..3f049457b 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -20,7 +20,7 @@ sub getsetup () { rsync_command => { type => "string", example => "rsync -qa --delete /path/to/destdir/ user\@host:/path/to/docroot/", - description => "command to upload regenerated pages to another host", + description => "unattended command to upload regenerated pages", safe => 0, rebuild => 0, }, @@ -34,7 +34,6 @@ sub checkconfig { } sub postrefresh () { - debug "in postrefresh hook, gonna run rsync"; system $config{rsync_command}; if ($? == -1) { error("failed to execute rsync_command: $!"); -- cgit v1.2.3 From 9f5cc7c9a2d41c1326a5e81657671c2f259d5922 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 2 Sep 2009 15:36:56 -0400 Subject: remove two plugins that are unrelated to cvs --- IkiWiki/Plugin/rsync.pm | 45 ----------- IkiWiki/Plugin/unixauth.pm | 195 --------------------------------------------- 2 files changed, 240 deletions(-) delete mode 100644 IkiWiki/Plugin/rsync.pm delete mode 100644 IkiWiki/Plugin/unixauth.pm (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm deleted file mode 100644 index 3f049457b..000000000 --- a/IkiWiki/Plugin/rsync.pm +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -package IkiWiki::Plugin::rsync; - -use warnings; -use strict; -use IkiWiki 3.00; - -sub import { - hook(type => "getsetup", id => "rsync", call => \&getsetup); - hook(type => "checkconfig", id => "rsync", call => \&checkconfig); - hook(type => "postrefresh", id => "rsync", call => \&postrefresh); -} - -sub getsetup () { - return - plugin => { - safe => 0, - rebuild => 0, - }, - rsync_command => { - type => "string", - example => "rsync -qa --delete /path/to/destdir/ user\@host:/path/to/docroot/", - description => "unattended command to upload regenerated pages", - safe => 0, - rebuild => 0, - }, -} - -sub checkconfig { - if (! exists $config{rsync_command} || - ! defined $config{rsync_command}) { - error("Must specify rsync_command"); - } -} - -sub postrefresh () { - system $config{rsync_command}; - if ($? == -1) { - error("failed to execute rsync_command: $!"); - } elsif ($? != 0) { - error(sprintf("rsync_command exited %d", $? >> 8)); - } -} - -1 diff --git a/IkiWiki/Plugin/unixauth.pm b/IkiWiki/Plugin/unixauth.pm deleted file mode 100644 index 4f0cb4dd2..000000000 --- a/IkiWiki/Plugin/unixauth.pm +++ /dev/null @@ -1,195 +0,0 @@ -#!/usr/bin/perl -# Ikiwiki unixauth authentication. -package IkiWiki::Plugin::unixauth; - -use warnings; -use strict; -use IkiWiki 2.00; - -sub import { - hook(type => "getsetup", id => "unixauth", call => \&getsetup); - hook(type => "formbuilder_setup", id => "unixauth", - call => \&formbuilder_setup); - hook(type => "formbuilder", id => "unixauth", - call => \&formbuilder); - hook(type => "sessioncgi", id => "unixauth", call => \&sessioncgi); -} - -sub getsetup () { - return - unixauth_type => { - type => "string", - example => "checkpassword", - description => "type of authenticator; can be 'checkpassword' or 'pwauth'", - safe => 0, - rebuild => 1, - }, - unixauth_command => { - type => "string", - example => "/path/to/checkpassword", - description => "full path and any arguments", - safe => 0, - rebuild => 1, - }, - unixauth_requiressl => { - type => "boolean", - example => "1", - description => "require SSL? strongly recommended", - safe => 0, - rebuild => 1, - }, - plugin => { - description => "Unix user authentication", - safe => 0, - rebuild => 1, - }, -} - -# Checks if a string matches a user's password, and returns true or false. -sub checkpassword ($$;$) { - my $user=shift; - my $password=shift; - my $field=shift || "password"; - - # It's very important that the user not be allowed to log in with - # an empty password! - if (! length $password) { - return 0; - } - - my $ret=0; - if (! exists $config{unixauth_type}) { - # admin needs to carefully think over his configuration - return 0; - } - elsif ($config{unixauth_type} eq "checkpassword") { - open UNIXAUTH, "|$config{unixauth_command} true 3<&0" or die("Could not run $config{unixauth_type}"); - print UNIXAUTH "$user\0$password\0Y123456\0"; - close UNIXAUTH; - $ret=!($?>>8); - } - elsif ($config{unixauth_type} eq "pwauth") { - open UNIXAUTH, "|$config{unixauth_command}" or die("Could not run $config{unixauth_type}"); - print UNIXAUTH "$user\n$password\n"; - close UNIXAUTH; - $ret=!($?>>8); - } - else { - # no such authentication type - return 0; - } - - if ($ret) { - my $userinfo=IkiWiki::userinfo_retrieve(); - if (! length $user || ! defined $userinfo || - ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) { - IkiWiki::userinfo_setall($user, { - 'email' => '', - 'regdate' => time, - }); - } - } - - return $ret; -} - -sub formbuilder_setup (@) { - my %params=@_; - - my $form=$params{form}; - my $session=$params{session}; - my $cgi=$params{cgi}; - - # if not under SSL, die before even showing a login form, - # unless the admin explicitly says it's fine - if (! exists $config{unixauth_requiressl}) { - $config{unixauth_requiressl} = 1; - } - if ($config{unixauth_requiressl}) { - if ((! $config{sslcookie}) || (! exists $ENV{'HTTPS'})) { - die("SSL required to login. Contact your administrator.
"); - } - } - - if ($form->title eq "signin") { - $form->field(name => "name", required => 0); - $form->field(name => "password", type => "password", required => 0); - - if ($form->submitted) { - my $submittype=$form->submitted; - # Set required fields based on how form was submitted. - my %required=( - "Login" => [qw(name password)], - ); - foreach my $opt (@{$required{$submittype}}) { - $form->field(name => $opt, required => 1); - } - - # Validate password against name for Login. - if ($submittype eq "Login") { - $form->field( - name => "password", - validate => sub { - checkpassword($form->field("name"), shift); - }, - ); - } - - # XXX is this reachable? looks like no - elsif ($submittype eq "Login") { - $form->field( - name => "name", - validate => sub { - my $name=shift; - length $name && - IkiWiki::userinfo_get($name, "regdate"); - }, - ); - } - } - else { - # First time settings. - $form->field(name => "name"); - if ($session->param("name")) { - $form->field(name => "name", value => $session->param("name")); - } - } - } - elsif ($form->title eq "preferences") { - $form->field(name => "name", disabled => 1, - value => $session->param("name"), force => 1, - fieldset => "login"); - $form->field(name => "password", disabled => 1, type => "password", - fieldset => "login"), - } -} - -sub formbuilder (@) { - my %params=@_; - - my $form=$params{form}; - my $session=$params{session}; - my $cgi=$params{cgi}; - my $buttons=$params{buttons}; - - if ($form->title eq "signin") { - if ($form->submitted && $form->validate) { - if ($form->submitted eq 'Login') { - $session->param("name", $form->field("name")); - IkiWiki::cgi_postsignin($cgi, $session); - } - } - } - elsif ($form->title eq "preferences") { - if ($form->submitted eq "Save Preferences" && $form->validate) { - my $user_name=$form->field('name'); - } - } -} - -sub sessioncgi ($$) { - my $q=shift; - my $session=shift; -} - -1 -- cgit v1.2.3 From b2bd2e93f01979df1a25e6f349022103bc20339a Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Thu, 10 Sep 2009 17:34:52 -0400 Subject: Revivify unixauth and rsync plugins (and hook needed by rsync) lost in the last merge. I should really put each feature on its own git branch. --- IkiWiki/Plugin/rsync.pm | 45 +++++++++++ IkiWiki/Plugin/unixauth.pm | 195 +++++++++++++++++++++++++++++++++++++++++++++ IkiWiki/Render.pm | 1 + 3 files changed, 241 insertions(+) create mode 100644 IkiWiki/Plugin/rsync.pm create mode 100644 IkiWiki/Plugin/unixauth.pm (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm new file mode 100644 index 000000000..3f049457b --- /dev/null +++ b/IkiWiki/Plugin/rsync.pm @@ -0,0 +1,45 @@ +#!/usr/bin/perl +package IkiWiki::Plugin::rsync; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "rsync", call => \&getsetup); + hook(type => "checkconfig", id => "rsync", call => \&checkconfig); + hook(type => "postrefresh", id => "rsync", call => \&postrefresh); +} + +sub getsetup () { + return + plugin => { + safe => 0, + rebuild => 0, + }, + rsync_command => { + type => "string", + example => "rsync -qa --delete /path/to/destdir/ user\@host:/path/to/docroot/", + description => "unattended command to upload regenerated pages", + safe => 0, + rebuild => 0, + }, +} + +sub checkconfig { + if (! exists $config{rsync_command} || + ! defined $config{rsync_command}) { + error("Must specify rsync_command"); + } +} + +sub postrefresh () { + system $config{rsync_command}; + if ($? == -1) { + error("failed to execute rsync_command: $!"); + } elsif ($? != 0) { + error(sprintf("rsync_command exited %d", $? >> 8)); + } +} + +1 diff --git a/IkiWiki/Plugin/unixauth.pm b/IkiWiki/Plugin/unixauth.pm new file mode 100644 index 000000000..4f0cb4dd2 --- /dev/null +++ b/IkiWiki/Plugin/unixauth.pm @@ -0,0 +1,195 @@ +#!/usr/bin/perl +# Ikiwiki unixauth authentication. +package IkiWiki::Plugin::unixauth; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { + hook(type => "getsetup", id => "unixauth", call => \&getsetup); + hook(type => "formbuilder_setup", id => "unixauth", + call => \&formbuilder_setup); + hook(type => "formbuilder", id => "unixauth", + call => \&formbuilder); + hook(type => "sessioncgi", id => "unixauth", call => \&sessioncgi); +} + +sub getsetup () { + return + unixauth_type => { + type => "string", + example => "checkpassword", + description => "type of authenticator; can be 'checkpassword' or 'pwauth'", + safe => 0, + rebuild => 1, + }, + unixauth_command => { + type => "string", + example => "/path/to/checkpassword", + description => "full path and any arguments", + safe => 0, + rebuild => 1, + }, + unixauth_requiressl => { + type => "boolean", + example => "1", + description => "require SSL? strongly recommended", + safe => 0, + rebuild => 1, + }, + plugin => { + description => "Unix user authentication", + safe => 0, + rebuild => 1, + }, +} + +# Checks if a string matches a user's password, and returns true or false. +sub checkpassword ($$;$) { + my $user=shift; + my $password=shift; + my $field=shift || "password"; + + # It's very important that the user not be allowed to log in with + # an empty password! + if (! length $password) { + return 0; + } + + my $ret=0; + if (! exists $config{unixauth_type}) { + # admin needs to carefully think over his configuration + return 0; + } + elsif ($config{unixauth_type} eq "checkpassword") { + open UNIXAUTH, "|$config{unixauth_command} true 3<&0" or die("Could not run $config{unixauth_type}"); + print UNIXAUTH "$user\0$password\0Y123456\0"; + close UNIXAUTH; + $ret=!($?>>8); + } + elsif ($config{unixauth_type} eq "pwauth") { + open UNIXAUTH, "|$config{unixauth_command}" or die("Could not run $config{unixauth_type}"); + print UNIXAUTH "$user\n$password\n"; + close UNIXAUTH; + $ret=!($?>>8); + } + else { + # no such authentication type + return 0; + } + + if ($ret) { + my $userinfo=IkiWiki::userinfo_retrieve(); + if (! length $user || ! defined $userinfo || + ! exists $userinfo->{$user} || ! ref $userinfo->{$user}) { + IkiWiki::userinfo_setall($user, { + 'email' => '', + 'regdate' => time, + }); + } + } + + return $ret; +} + +sub formbuilder_setup (@) { + my %params=@_; + + my $form=$params{form}; + my $session=$params{session}; + my $cgi=$params{cgi}; + + # if not under SSL, die before even showing a login form, + # unless the admin explicitly says it's fine + if (! exists $config{unixauth_requiressl}) { + $config{unixauth_requiressl} = 1; + } + if ($config{unixauth_requiressl}) { + if ((! $config{sslcookie}) || (! exists $ENV{'HTTPS'})) { + die("SSL required to login. Contact your administrator.
"); + } + } + + if ($form->title eq "signin") { + $form->field(name => "name", required => 0); + $form->field(name => "password", type => "password", required => 0); + + if ($form->submitted) { + my $submittype=$form->submitted; + # Set required fields based on how form was submitted. + my %required=( + "Login" => [qw(name password)], + ); + foreach my $opt (@{$required{$submittype}}) { + $form->field(name => $opt, required => 1); + } + + # Validate password against name for Login. + if ($submittype eq "Login") { + $form->field( + name => "password", + validate => sub { + checkpassword($form->field("name"), shift); + }, + ); + } + + # XXX is this reachable? looks like no + elsif ($submittype eq "Login") { + $form->field( + name => "name", + validate => sub { + my $name=shift; + length $name && + IkiWiki::userinfo_get($name, "regdate"); + }, + ); + } + } + else { + # First time settings. + $form->field(name => "name"); + if ($session->param("name")) { + $form->field(name => "name", value => $session->param("name")); + } + } + } + elsif ($form->title eq "preferences") { + $form->field(name => "name", disabled => 1, + value => $session->param("name"), force => 1, + fieldset => "login"); + $form->field(name => "password", disabled => 1, type => "password", + fieldset => "login"), + } +} + +sub formbuilder (@) { + my %params=@_; + + my $form=$params{form}; + my $session=$params{session}; + my $cgi=$params{cgi}; + my $buttons=$params{buttons}; + + if ($form->title eq "signin") { + if ($form->submitted && $form->validate) { + if ($form->submitted eq 'Login') { + $session->param("name", $form->field("name")); + IkiWiki::cgi_postsignin($cgi, $session); + } + } + } + elsif ($form->title eq "preferences") { + if ($form->submitted eq "Save Preferences" && $form->validate) { + my $user_name=$form->field('name'); + } + } +} + +sub sessioncgi ($$) { + my $q=shift; + my $session=shift; +} + +1 diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 246c2260d..5953b3fee 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -554,6 +554,7 @@ sub refresh () { if (%rendered) { run_hooks(change => sub { shift->(keys %rendered) }); } + run_hooks(postrefresh => sub { shift->() }); } sub commandline_render () { -- cgit v1.2.3 From 604037b0f258f91c323c07ff985e8732a6d73e86 Mon Sep 17 00:00:00 2001 From: Amitai Schlair Date: Fri, 11 Sep 2009 17:42:51 -0400 Subject: Don't error out, either warn or say nothing, depending. --- IkiWiki/Plugin/rsync.pm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 3f049457b..70dd5a4c9 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -7,7 +7,6 @@ use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "rsync", call => \&getsetup); - hook(type => "checkconfig", id => "rsync", call => \&checkconfig); hook(type => "postrefresh", id => "rsync", call => \&postrefresh); } @@ -26,19 +25,14 @@ sub getsetup () { }, } -sub checkconfig { - if (! exists $config{rsync_command} || - ! defined $config{rsync_command}) { - error("Must specify rsync_command"); - } -} - sub postrefresh () { - system $config{rsync_command}; - if ($? == -1) { - error("failed to execute rsync_command: $!"); - } elsif ($? != 0) { - error(sprintf("rsync_command exited %d", $? >> 8)); + if (defined $config{rsync_command}) { + system $config{rsync_command}; + if ($? == -1) { + warn("failed to execute rsync_command: $!"); + } elsif ($? != 0) { + warn(sprintf("rsync_command exited %d", $? >> 8)); + } } } -- cgit v1.2.3 From 2d9e97c283cb7b1ecdd524e60bddec17ee638835 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Sep 2009 18:19:21 -0400 Subject: chdir to the destdir before running rsync Avoids needing to specify the path in the rsync command, can just use "." --- IkiWiki/Plugin/rsync.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 3f049457b..7c3fc127c 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -19,8 +19,8 @@ sub getsetup () { }, rsync_command => { type => "string", - example => "rsync -qa --delete /path/to/destdir/ user\@host:/path/to/docroot/", - description => "unattended command to upload regenerated pages", + example => "rsync -qa --delete . user\@host:/path/to/docroot/", + description => "command to run to sync updated pages", safe => 0, rebuild => 0, }, @@ -34,6 +34,7 @@ sub checkconfig { } sub postrefresh () { + chdir($config{destdir}) || error("chdir: $!"); system $config{rsync_command}; if ($? == -1) { error("failed to execute rsync_command: $!"); -- cgit v1.2.3 From 3c80557054fbaca6d0614e4327d49e721b9d4fdc Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Sep 2009 18:22:06 -0400 Subject: localize user-visible warnings and tack on missing newlines --- IkiWiki/Plugin/rsync.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 9afbe9487..a62347a44 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -30,10 +30,10 @@ sub postrefresh () { chdir($config{destdir}) || error("chdir: $!"); system $config{rsync_command}; if ($? == -1) { - warn("failed to execute rsync_command: $!"); + warn(sprintf(gettext("failed to execute rsync_command: %s"), $!))."\n"; } elsif ($? != 0) { - warn(sprintf("rsync_command exited %d", $? >> 8)); + warn(sprintf(gettext("rsync_command exited %d"), $? >> 8))."\n"; } } } -- cgit v1.2.3 From 5b818c9f2ac9c9a2d953f29194913036ab26c225 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Sep 2009 18:28:35 -0400 Subject: doc update, add --exclude ikiwiki.cgi to examples --- IkiWiki/Plugin/rsync.pm | 2 +- doc/plugins/contrib/rsync.mdwn | 21 --------- doc/plugins/contrib/rsync/discussion.mdwn | 77 ------------------------------- doc/plugins/rsync.mdwn | 17 +++++++ doc/plugins/rsync/discussion.mdwn | 77 +++++++++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 99 deletions(-) delete mode 100644 doc/plugins/contrib/rsync.mdwn delete mode 100644 doc/plugins/contrib/rsync/discussion.mdwn create mode 100644 doc/plugins/rsync.mdwn create mode 100644 doc/plugins/rsync/discussion.mdwn (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index a62347a44..f14989ff8 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -18,7 +18,7 @@ sub getsetup () { }, rsync_command => { type => "string", - example => "rsync -qa --delete . user\@host:/path/to/docroot/", + example => "rsync -qa --delete . user\@host:/path/to/docroot/ --exclude ikiwiki.cgi", description => "command to run to sync updated pages", safe => 0, rebuild => 0, diff --git a/doc/plugins/contrib/rsync.mdwn b/doc/plugins/contrib/rsync.mdwn deleted file mode 100644 index 71cd63947..000000000 --- a/doc/plugins/contrib/rsync.mdwn +++ /dev/null @@ -1,21 +0,0 @@ -[[!template id=plugin name=rsync core=0 author="[[schmonz]]"]] - -[[!template id=gitbranch branch=schmonz author="[[schmonz]]"]] - -This plugin allows ikiwiki to push generated pages to another host -by running a command such as `rsync`. - -### Usage -7. Enable automated SSH key exchange between ikiwiki and the remote - host. [keychain](http://www.gentoo.org/proj/en/keychain/) makes - it easy to use a passphrase-protected key for this purpose. It's - also a good idea to specify the exact command line to be permitted - in the remote host's `$HOME/.ssh/authorized_keys`. -7. Set `rsync_command` in your setup file. If you're using a - passphrase-protected key, then set `rsync_command` to a shell - script which reads `keychain`'s current state before calling - `rsync`. - -### Implementation details -* The plugin relies on a new "postrefresh" hook called at the very end of - `IkiWiki/Render.pm:refresh()`. diff --git a/doc/plugins/contrib/rsync/discussion.mdwn b/doc/plugins/contrib/rsync/discussion.mdwn deleted file mode 100644 index 6bf7a3826..000000000 --- a/doc/plugins/contrib/rsync/discussion.mdwn +++ /dev/null @@ -1,77 +0,0 @@ -## A use case - -Why I needed this plugin: I have two web servers available to me -for a project. Neither does everything I need, but together they -do. (This is a bit like the [Amazon S3 -scenario](http://kitenet.net/~joey/blog/entry/running_a_wiki_on_Amazon_S3/).) - -Server (1) is a university web server. It provides plentiful space -and bandwidth, easy authentication for people editing the wiki, and -a well-known stable URL. The wiki really wants to live here and -very easily could except that the server doesn't allow arbitrary -CGIs. - -Server (2) is provided by a generous alumnus's paid [[tips/DreamHost]] -account. Disk and particularly network usage need to be minimized -because over some threshold it costs him. CGI, etc. are available. - -My plan was to host the wiki on server (1) by taking advantage of -server (2) to store the repository, source checkout, and generated -pages, to host the repository browser, and to handle ikiwiki's CGI -operations. In order for this to work, web edits on (2) would need -to automatically push any changed pages to (1). - -As a proof of concept, I added an rsync post-commit hook after -ikiwiki's usual. It worked, just not for web edits, which is how -the wiki will be used. So I wrote this plugin to finish the job. -The wiki now lives on (1), and clicking "edit" just works. --[[schmonz]] - -> Just out of interest, why use `rsync` and not `git push`. i.e. a -> different setup to solve the same problem would be to run a -> normal ikiwiki setup on the universities server with its git -> repository available over ssh (same security setup your using -> for rsync should work for git over ssh). On the cgi-capable server, -> when it would rsync, make it git push. It would seem that git -> has enough information that it should be able to be more -> network efficient. It also means that corruption at one end -> wouldn't be propagated to the other end. -- [[Will]] - ->> Hey, that's a nice solution. (The site was in svn to begin with, ->> but it's in git now.) One advantage of my approach in this particular ->> case: server (1) doesn't have `git` installed, but does have `rsync`, ->> so (1)'s environment can remain completely untweaked other than the ->> SSH arrangement. I kind of like that all the sysadmin effort is ->> contained on one host. ->> ->> This plugin is definitely still useful for projects not able to use ->> a DVCS (of which I've got at least one other), and possibly for ->> other uses not yet imagined. ;-) --[[schmonz]] - ----- - -Revew: --[[Joey]] - -* I think it should not throw an error if no command is set. Just don't do anything. -* If the rsync fails, it currently errors out, which will probably also leave - the wiki in a broken state, since ikiwiki will not get a chance to save - its state. This seems fragile; what if the laptop is offline, or the - server is down, etc. Maybe it should just warn if the rsync fails? -* Is a new hook really needed? The savestate hook runs at a similar time; - only issue with it is that it is run even when ikiwiki has not - rendered any updated pages. Bah, I think you do need the new hook, how - annoying.. - -> * Depends whether the plugin would be on by default. If yes, then yes. -> If the admin has to enable it, I'd think they'd want the error. -> * Changed the other errors to warnings. -> * The name might be wrong: there isn't anything rsync-specific about the -> plugin, that's just the command I personally need to run. --[[schmonz]] - ->> One problem with the error is that it prevents dumping a new setup file with ->> the plugin enabled, and then editing it to configure. ie: - - joey@gnu:~>ikiwiki -setup .ikiwiki/joeywiki.setup -plugin rsync -dumpsetup new.setup - Must specify rsync_command - -> rsync seems by far the most likely command, though someone might use something -> to push via ftp instead. I think calling it rsync is ok. --[[Joey]] diff --git a/doc/plugins/rsync.mdwn b/doc/plugins/rsync.mdwn new file mode 100644 index 000000000..0ab3872d9 --- /dev/null +++ b/doc/plugins/rsync.mdwn @@ -0,0 +1,17 @@ +[[!template id=plugin name=rsync author="[[schmonz]]"]] + +This plugin allows ikiwiki to push generated pages to another host +by running a command such as `rsync`. + +The command to run is specified by setting `rsync_command` in your setup +file. The command will be run in your destdir, so something like this +is a typical command: + + rsync -qa --delete . user\@host:/path/to/docroot/ --exclude ikiwiki.cgi + +If using rsync over ssh, you will need to enable noninteractive ssh login +to the remote host. It's also a good idea to specify the exact command line +to be permitted in the remote host's `$HOME/.ssh/authorized_keys`. + +Be sure to exclude the `ikiwiki.cgi` wrapper from being sent to the remote +host. diff --git a/doc/plugins/rsync/discussion.mdwn b/doc/plugins/rsync/discussion.mdwn new file mode 100644 index 000000000..6bf7a3826 --- /dev/null +++ b/doc/plugins/rsync/discussion.mdwn @@ -0,0 +1,77 @@ +## A use case + +Why I needed this plugin: I have two web servers available to me +for a project. Neither does everything I need, but together they +do. (This is a bit like the [Amazon S3 +scenario](http://kitenet.net/~joey/blog/entry/running_a_wiki_on_Amazon_S3/).) + +Server (1) is a university web server. It provides plentiful space +and bandwidth, easy authentication for people editing the wiki, and +a well-known stable URL. The wiki really wants to live here and +very easily could except that the server doesn't allow arbitrary +CGIs. + +Server (2) is provided by a generous alumnus's paid [[tips/DreamHost]] +account. Disk and particularly network usage need to be minimized +because over some threshold it costs him. CGI, etc. are available. + +My plan was to host the wiki on server (1) by taking advantage of +server (2) to store the repository, source checkout, and generated +pages, to host the repository browser, and to handle ikiwiki's CGI +operations. In order for this to work, web edits on (2) would need +to automatically push any changed pages to (1). + +As a proof of concept, I added an rsync post-commit hook after +ikiwiki's usual. It worked, just not for web edits, which is how +the wiki will be used. So I wrote this plugin to finish the job. +The wiki now lives on (1), and clicking "edit" just works. --[[schmonz]] + +> Just out of interest, why use `rsync` and not `git push`. i.e. a +> different setup to solve the same problem would be to run a +> normal ikiwiki setup on the universities server with its git +> repository available over ssh (same security setup your using +> for rsync should work for git over ssh). On the cgi-capable server, +> when it would rsync, make it git push. It would seem that git +> has enough information that it should be able to be more +> network efficient. It also means that corruption at one end +> wouldn't be propagated to the other end. -- [[Will]] + +>> Hey, that's a nice solution. (The site was in svn to begin with, +>> but it's in git now.) One advantage of my approach in this particular +>> case: server (1) doesn't have `git` installed, but does have `rsync`, +>> so (1)'s environment can remain completely untweaked other than the +>> SSH arrangement. I kind of like that all the sysadmin effort is +>> contained on one host. +>> +>> This plugin is definitely still useful for projects not able to use +>> a DVCS (of which I've got at least one other), and possibly for +>> other uses not yet imagined. ;-) --[[schmonz]] + +---- + +Revew: --[[Joey]] + +* I think it should not throw an error if no command is set. Just don't do anything. +* If the rsync fails, it currently errors out, which will probably also leave + the wiki in a broken state, since ikiwiki will not get a chance to save + its state. This seems fragile; what if the laptop is offline, or the + server is down, etc. Maybe it should just warn if the rsync fails? +* Is a new hook really needed? The savestate hook runs at a similar time; + only issue with it is that it is run even when ikiwiki has not + rendered any updated pages. Bah, I think you do need the new hook, how + annoying.. + +> * Depends whether the plugin would be on by default. If yes, then yes. +> If the admin has to enable it, I'd think they'd want the error. +> * Changed the other errors to warnings. +> * The name might be wrong: there isn't anything rsync-specific about the +> plugin, that's just the command I personally need to run. --[[schmonz]] + +>> One problem with the error is that it prevents dumping a new setup file with +>> the plugin enabled, and then editing it to configure. ie: + + joey@gnu:~>ikiwiki -setup .ikiwiki/joeywiki.setup -plugin rsync -dumpsetup new.setup + Must specify rsync_command + +> rsync seems by far the most likely command, though someone might use something +> to push via ftp instead. I think calling it rsync is ok. --[[Joey]] -- cgit v1.2.3 From a7545978c76902076b42b774938e6f60b96aa396 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 11 Sep 2009 18:29:56 -0400 Subject: got rid of the postrefresh hook after all Instead, use the change and delete hooks, and launch rsync if either hook is called. --- IkiWiki/Plugin/rsync.pm | 8 ++++++-- IkiWiki/Render.pm | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index f14989ff8..45bff19bd 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -7,7 +7,8 @@ use IkiWiki 3.00; sub import { hook(type => "getsetup", id => "rsync", call => \&getsetup); - hook(type => "postrefresh", id => "rsync", call => \&postrefresh); + hook(type => "change", id => "rsync", call => \&postrefresh); + hook(type => "delete", id => "rsync", call => \&postrefresh); } sub getsetup () { @@ -25,8 +26,11 @@ sub getsetup () { }, } +my $ran=0; + sub postrefresh () { - if (defined $config{rsync_command}) { + if (defined $config{rsync_command} && ! $ran) { + $ran=1; chdir($config{destdir}) || error("chdir: $!"); system $config{rsync_command}; if ($? == -1) { diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 5953b3fee..246c2260d 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -554,7 +554,6 @@ sub refresh () { if (%rendered) { run_hooks(change => sub { shift->(keys %rendered) }); } - run_hooks(postrefresh => sub { shift->() }); } sub commandline_render () { -- cgit v1.2.3 From f1999df705f22638a6d9d44c728c4282e674b982 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 12 Sep 2009 00:24:57 -0400 Subject: remove cgi exclusion Note that a typical use of this plugin is for a static site, w/o cgi support enabled. --- IkiWiki/Plugin/rsync.pm | 2 +- doc/plugins/rsync.mdwn | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 45bff19bd..e38801e4a 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -19,7 +19,7 @@ sub getsetup () { }, rsync_command => { type => "string", - example => "rsync -qa --delete . user\@host:/path/to/docroot/ --exclude ikiwiki.cgi", + example => "rsync -qa --delete . user\@host:/path/to/docroot/", description => "command to run to sync updated pages", safe => 0, rebuild => 0, diff --git a/doc/plugins/rsync.mdwn b/doc/plugins/rsync.mdwn index 9bfe7303e..e0ab96d14 100644 --- a/doc/plugins/rsync.mdwn +++ b/doc/plugins/rsync.mdwn @@ -7,11 +7,12 @@ The command to run is specified by setting `rsync_command` in your setup file. The command will be run in your destdir, so something like this is a typical command: - rsync => 'rsync -qa --delete . user@host:/path/to/docroot/ --exclude ikiwiki.cgi', + rsync => 'rsync -qa --delete . user@host:/path/to/docroot/', If using rsync over ssh, you will need to enable noninteractive ssh login to the remote host. It's also a good idea to specify the exact command line to be permitted in the remote host's `$HOME/.ssh/authorized_keys`. -Be sure to exclude the `ikiwiki.cgi` wrapper from being sent to the remote -host, as in the above example. +A typival ikiwiki configuration when using this plugin is to disable cgi +support, so ikiwiki builds a completely static site that can be served from +the remote host. -- cgit v1.2.3 From 20ba12802b3897bf48d8a7704a57e9cede2466bd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Feb 2010 04:22:15 -0500 Subject: add section information --- IkiWiki/Plugin/404.pm | 1 + IkiWiki/Plugin/aggregate.pm | 1 + IkiWiki/Plugin/amazon_s3.pm | 1 + IkiWiki/Plugin/attachment.pm | 1 + IkiWiki/Plugin/autoindex.pm | 1 + IkiWiki/Plugin/comments.pm | 1 + IkiWiki/Plugin/editdiff.pm | 1 + IkiWiki/Plugin/edittemplate.pm | 1 + IkiWiki/Plugin/getsource.pm | 1 + IkiWiki/Plugin/google.pm | 1 + IkiWiki/Plugin/goto.pm | 1 + IkiWiki/Plugin/mirrorlist.pm | 1 + IkiWiki/Plugin/norcs.pm | 1 + IkiWiki/Plugin/pingee.pm | 1 + IkiWiki/Plugin/pinger.pm | 1 + IkiWiki/Plugin/remove.pm | 1 + IkiWiki/Plugin/rename.pm | 1 + IkiWiki/Plugin/repolist.pm | 1 + IkiWiki/Plugin/rsync.pm | 1 + IkiWiki/Plugin/search.pm | 1 + IkiWiki/Plugin/testpagespec.pm | 1 + IkiWiki/Plugin/underlay.pm | 1 + IkiWiki/Plugin/websetup.pm | 1 + IkiWiki/Plugin/wmd.pm | 2 ++ doc/plugins/write.mdwn | 3 ++- 25 files changed, 27 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/404.pm b/IkiWiki/Plugin/404.pm index 85486e559..8adfd5dd9 100644 --- a/IkiWiki/Plugin/404.pm +++ b/IkiWiki/Plugin/404.pm @@ -21,6 +21,7 @@ sub getsetup () { # server admin action too safe => 0, rebuild => 0, + section => "web", } } diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 5a9eb433d..c18d413e6 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -43,6 +43,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, aggregateinternal => { type => "boolean", diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index cfd8cd347..f2f4dbcf2 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -45,6 +45,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, + section => "special-purpose", }, amazon_s3_key_id => { type => "string", diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index cbe6efc21..ad1dd9bca 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, allowed_attachments => { type => "pagespec", diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index 555856b11..e50464dca 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index caed0d58c..1e71749a4 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -38,6 +38,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, comments_pagespec => { type => 'pagespec', diff --git a/IkiWiki/Plugin/editdiff.pm b/IkiWiki/Plugin/editdiff.pm index 7df6a9ffb..d8f53a42e 100644 --- a/IkiWiki/Plugin/editdiff.pm +++ b/IkiWiki/Plugin/editdiff.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index a163b0d84..5f0551d92 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -23,6 +23,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "web", }, } diff --git a/IkiWiki/Plugin/getsource.pm b/IkiWiki/Plugin/getsource.pm index d1555430e..b362de726 100644 --- a/IkiWiki/Plugin/getsource.pm +++ b/IkiWiki/Plugin/getsource.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, getsource_mimetype => { type => "string", diff --git a/IkiWiki/Plugin/google.pm b/IkiWiki/Plugin/google.pm index 483fa1707..48ad4c8ce 100644 --- a/IkiWiki/Plugin/google.pm +++ b/IkiWiki/Plugin/google.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, } diff --git a/IkiWiki/Plugin/goto.pm b/IkiWiki/Plugin/goto.pm index 439552f62..03bd682b3 100644 --- a/IkiWiki/Plugin/goto.pm +++ b/IkiWiki/Plugin/goto.pm @@ -14,6 +14,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", } } diff --git a/IkiWiki/Plugin/mirrorlist.pm b/IkiWiki/Plugin/mirrorlist.pm index d0a6107ef..92be7913e 100644 --- a/IkiWiki/Plugin/mirrorlist.pm +++ b/IkiWiki/Plugin/mirrorlist.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, mirrorlist => { type => "string", diff --git a/IkiWiki/Plugin/norcs.pm b/IkiWiki/Plugin/norcs.pm index bfe84c0e1..e6a05a3c5 100644 --- a/IkiWiki/Plugin/norcs.pm +++ b/IkiWiki/Plugin/norcs.pm @@ -25,6 +25,7 @@ sub getsetup () { plugin => { safe => 0, # rcs plugin rebuild => 0, + section => "rcs", }, } diff --git a/IkiWiki/Plugin/pingee.pm b/IkiWiki/Plugin/pingee.pm index f5386d0ca..aafce9e70 100644 --- a/IkiWiki/Plugin/pingee.pm +++ b/IkiWiki/Plugin/pingee.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm index c20ecb5d4..a797fc7bd 100644 --- a/IkiWiki/Plugin/pinger.pm +++ b/IkiWiki/Plugin/pinger.pm @@ -21,6 +21,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "special-purpose", }, pinger_timeout => { type => "integer", diff --git a/IkiWiki/Plugin/remove.pm b/IkiWiki/Plugin/remove.pm index 3c1e0c713..f59d0269e 100644 --- a/IkiWiki/Plugin/remove.pm +++ b/IkiWiki/Plugin/remove.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/rename.pm b/IkiWiki/Plugin/rename.pm index 8213d21f6..3908443ca 100644 --- a/IkiWiki/Plugin/rename.pm +++ b/IkiWiki/Plugin/rename.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, } diff --git a/IkiWiki/Plugin/repolist.pm b/IkiWiki/Plugin/repolist.pm index f69ec3988..ba7c5f0aa 100644 --- a/IkiWiki/Plugin/repolist.pm +++ b/IkiWiki/Plugin/repolist.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "web", }, repositories => { type => "string", diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index e38801e4a..8dd983be7 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, + section => "special-purpose", }, rsync_command => { type => "string", diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 393c17e0f..fb68396a1 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, + section => "web", }, omega_cgi => { type => "string", diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 440fca33b..17a77cb69 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/underlay.pm b/IkiWiki/Plugin/underlay.pm index 116fe7324..ab74fc37e 100644 --- a/IkiWiki/Plugin/underlay.pm +++ b/IkiWiki/Plugin/underlay.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 0, rebuild => undef, + section => "special-purpose", }, add_underlays => { type => "string", diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 445552e40..5c19c9b63 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, + section => "web", }, websetup_force_plugins => { type => "string", diff --git a/IkiWiki/Plugin/wmd.pm b/IkiWiki/Plugin/wmd.pm index 9ddd237ab..5361d2914 100644 --- a/IkiWiki/Plugin/wmd.pm +++ b/IkiWiki/Plugin/wmd.pm @@ -17,6 +17,8 @@ sub getsetup () { return plugin => { safe => 1, + rebuild => 0, + section => "web", }, } diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 68454d56c..fbaabb6a0 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -498,7 +498,8 @@ describes the plugin as a whole. For example: 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. + the plugin fits in. The convention is to name the sections the + same as the tags used for [[plugins|plugin]] on this wiki. ### genwrapper -- cgit v1.2.3 From 34fff64e7b56f4f8cd99430f9f927d2a5d1e3619 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Feb 2010 06:35:52 -0500 Subject: setup file ordering --- IkiWiki/Plugin/aggregate.pm | 1 - IkiWiki/Plugin/amazon_s3.pm | 1 - IkiWiki/Plugin/autoindex.pm | 1 - IkiWiki/Plugin/calendar.pm | 1 + IkiWiki/Plugin/color.pm | 1 + IkiWiki/Plugin/conditional.pm | 2 +- IkiWiki/Plugin/cutpaste.pm | 1 + IkiWiki/Plugin/date.pm | 1 + IkiWiki/Plugin/format.pm | 1 + IkiWiki/Plugin/fortune.pm | 1 + IkiWiki/Plugin/graphviz.pm | 1 + IkiWiki/Plugin/haiku.pm | 1 + IkiWiki/Plugin/img.pm | 1 + IkiWiki/Plugin/linkmap.pm | 1 + IkiWiki/Plugin/listdirectives.pm | 1 + IkiWiki/Plugin/map.pm | 1 + IkiWiki/Plugin/more.pm | 1 + IkiWiki/Plugin/orphans.pm | 1 + IkiWiki/Plugin/pagecount.pm | 1 + IkiWiki/Plugin/pagestats.pm | 1 + IkiWiki/Plugin/pingee.pm | 1 - IkiWiki/Plugin/pinger.pm | 1 - IkiWiki/Plugin/poll.pm | 1 + IkiWiki/Plugin/polygen.pm | 1 + IkiWiki/Plugin/postsparkline.pm | 1 + IkiWiki/Plugin/progress.pm | 1 + IkiWiki/Plugin/recentchanges.pm | 1 - IkiWiki/Plugin/rsync.pm | 1 - IkiWiki/Plugin/shortcut.pm | 1 + IkiWiki/Plugin/sparkline.pm | 1 + IkiWiki/Plugin/table.pm | 1 + IkiWiki/Plugin/template.pm | 1 + IkiWiki/Plugin/testpagespec.pm | 1 - IkiWiki/Plugin/teximg.pm | 1 + IkiWiki/Plugin/toc.pm | 1 + IkiWiki/Plugin/toggle.pm | 1 + IkiWiki/Plugin/underlay.pm | 1 - IkiWiki/Plugin/version.pm | 1 + IkiWiki/Setup.pm | 4 +++- 39 files changed, 32 insertions(+), 11 deletions(-) (limited to 'IkiWiki/Plugin/rsync.pm') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index c18d413e6..5a9eb433d 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -43,7 +43,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, - section => "special-purpose", }, aggregateinternal => { type => "boolean", diff --git a/IkiWiki/Plugin/amazon_s3.pm b/IkiWiki/Plugin/amazon_s3.pm index f2f4dbcf2..cfd8cd347 100644 --- a/IkiWiki/Plugin/amazon_s3.pm +++ b/IkiWiki/Plugin/amazon_s3.pm @@ -45,7 +45,6 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, - section => "special-purpose", }, amazon_s3_key_id => { type => "string", diff --git a/IkiWiki/Plugin/autoindex.pm b/IkiWiki/Plugin/autoindex.pm index e50464dca..555856b11 100644 --- a/IkiWiki/Plugin/autoindex.pm +++ b/IkiWiki/Plugin/autoindex.pm @@ -16,7 +16,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, - section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm index 2b87451ce..aaee2c610 100644 --- a/IkiWiki/Plugin/calendar.pm +++ b/IkiWiki/Plugin/calendar.pm @@ -38,6 +38,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, archivebase => { type => "string", diff --git a/IkiWiki/Plugin/color.pm b/IkiWiki/Plugin/color.pm index b9407ba28..d550dd9f4 100644 --- a/IkiWiki/Plugin/color.pm +++ b/IkiWiki/Plugin/color.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm index beeddc672..892b1cff9 100644 --- a/IkiWiki/Plugin/conditional.pm +++ b/IkiWiki/Plugin/conditional.pm @@ -16,7 +16,7 @@ sub getsetup { plugin => { safe => 1, rebuild => undef, - section => "core", + section => "widget", }, } diff --git a/IkiWiki/Plugin/cutpaste.pm b/IkiWiki/Plugin/cutpaste.pm index 417442f34..01e9ce043 100644 --- a/IkiWiki/Plugin/cutpaste.pm +++ b/IkiWiki/Plugin/cutpaste.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/date.pm b/IkiWiki/Plugin/date.pm index 652e6df0a..ea5c9a9c5 100644 --- a/IkiWiki/Plugin/date.pm +++ b/IkiWiki/Plugin/date.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/format.pm b/IkiWiki/Plugin/format.pm index c8041209f..d54e71131 100644 --- a/IkiWiki/Plugin/format.pm +++ b/IkiWiki/Plugin/format.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm index 17e57dea1..f481c7eac 100644 --- a/IkiWiki/Plugin/fortune.pm +++ b/IkiWiki/Plugin/fortune.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index 32e994d6b..bec122076 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/haiku.pm b/IkiWiki/Plugin/haiku.pm index 5a062a276..bf23dce67 100644 --- a/IkiWiki/Plugin/haiku.pm +++ b/IkiWiki/Plugin/haiku.pm @@ -16,6 +16,7 @@ sub getsetup { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 82db15a7e..f06121578 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/linkmap.pm b/IkiWiki/Plugin/linkmap.pm index 68eb6c8c6..ac26e072e 100644 --- a/IkiWiki/Plugin/linkmap.pm +++ b/IkiWiki/Plugin/linkmap.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/listdirectives.pm b/IkiWiki/Plugin/listdirectives.pm index 09f08c567..8a67f7160 100644 --- a/IkiWiki/Plugin/listdirectives.pm +++ b/IkiWiki/Plugin/listdirectives.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, directive_description_dir => { type => "string", diff --git a/IkiWiki/Plugin/map.pm b/IkiWiki/Plugin/map.pm index 788b96827..ce3ac1d24 100644 --- a/IkiWiki/Plugin/map.pm +++ b/IkiWiki/Plugin/map.pm @@ -21,6 +21,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/more.pm b/IkiWiki/Plugin/more.pm index 77d5fb077..266c8e1d0 100644 --- a/IkiWiki/Plugin/more.pm +++ b/IkiWiki/Plugin/more.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm index 702943f87..e3cc3c940 100644 --- a/IkiWiki/Plugin/orphans.pm +++ b/IkiWiki/Plugin/orphans.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/pagecount.pm b/IkiWiki/Plugin/pagecount.pm index 8d36f057e..dd5de3c83 100644 --- a/IkiWiki/Plugin/pagecount.pm +++ b/IkiWiki/Plugin/pagecount.pm @@ -15,6 +15,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/pagestats.pm b/IkiWiki/Plugin/pagestats.pm index 4313aa271..1c0b46830 100644 --- a/IkiWiki/Plugin/pagestats.pm +++ b/IkiWiki/Plugin/pagestats.pm @@ -27,6 +27,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/pingee.pm b/IkiWiki/Plugin/pingee.pm index aafce9e70..f5386d0ca 100644 --- a/IkiWiki/Plugin/pingee.pm +++ b/IkiWiki/Plugin/pingee.pm @@ -15,7 +15,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, - section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/pinger.pm b/IkiWiki/Plugin/pinger.pm index a797fc7bd..c20ecb5d4 100644 --- a/IkiWiki/Plugin/pinger.pm +++ b/IkiWiki/Plugin/pinger.pm @@ -21,7 +21,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => 0, - section => "special-purpose", }, pinger_timeout => { type => "integer", diff --git a/IkiWiki/Plugin/poll.pm b/IkiWiki/Plugin/poll.pm index bc1e3501e..6bc4579c2 100644 --- a/IkiWiki/Plugin/poll.pm +++ b/IkiWiki/Plugin/poll.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm index bc21d71c7..78e3611e1 100644 --- a/IkiWiki/Plugin/polygen.pm +++ b/IkiWiki/Plugin/polygen.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index 0d5a12e33..2fae9c5fe 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/progress.pm b/IkiWiki/Plugin/progress.pm index fe64b40b1..d27df5ca8 100644 --- a/IkiWiki/Plugin/progress.pm +++ b/IkiWiki/Plugin/progress.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 04219b721..5c7b71aaa 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -22,7 +22,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => 1, - section => "core", }, recentchangespage => { type => "string", diff --git a/IkiWiki/Plugin/rsync.pm b/IkiWiki/Plugin/rsync.pm index 8dd983be7..e38801e4a 100644 --- a/IkiWiki/Plugin/rsync.pm +++ b/IkiWiki/Plugin/rsync.pm @@ -16,7 +16,6 @@ sub getsetup () { plugin => { safe => 0, rebuild => 0, - section => "special-purpose", }, rsync_command => { type => "string", diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index 1840a5722..0cedbe447 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index fb4849492..42665ac63 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -24,6 +24,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index 96d63f455..2edd1eacd 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -16,6 +16,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index 39d9667f9..3e024c5f8 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -19,6 +19,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 17a77cb69..440fca33b 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -15,7 +15,6 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, - section => "special-purpose", }, } diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index f92ed0132..0aaa79698 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -31,6 +31,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, teximg_dvipng => { type => "boolean", diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index b8537d3eb..ac07b9af6 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -18,6 +18,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index ef066a42f..f9c899540 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -20,6 +20,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Plugin/underlay.pm b/IkiWiki/Plugin/underlay.pm index ab74fc37e..116fe7324 100644 --- a/IkiWiki/Plugin/underlay.pm +++ b/IkiWiki/Plugin/underlay.pm @@ -18,7 +18,6 @@ sub getsetup () { plugin => { safe => 0, rebuild => undef, - section => "special-purpose", }, add_underlays => { type => "string", diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm index 587cd55fa..c13643478 100644 --- a/IkiWiki/Plugin/version.pm +++ b/IkiWiki/Plugin/version.pm @@ -17,6 +17,7 @@ sub getsetup () { plugin => { safe => 1, rebuild => undef, + section => "widget", }, } diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 7a7683fab..a3fd5ce66 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -121,9 +121,11 @@ sub getsetup () { $config{syslog}=$syslog; return map { sort { $a->[0] cmp $b->[0] } @{$sections{$_}} } - sort { # core first, then alphabetical + sort { # core first, other last, otherwise alphabetical ($b eq "core") <=> ($a eq "core") || + ($a eq "other") <=> ($b eq "other") + || $a cmp $b } keys %sections; } -- cgit v1.2.3