]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
Merge commit 'schmonz/master'
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 11 Sep 2009 22:20:23 +0000 (18:20 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 11 Sep 2009 22:20:23 +0000 (18:20 -0400)
Conflicts:
IkiWiki/Plugin/rsync.pm

1  2 
IkiWiki/Plugin/rsync.pm

diff --combined IkiWiki/Plugin/rsync.pm
index 7c3fc127cf6f2c15f18cf18399aca4c5556383f0,70dd5a4c9270b211d477c2fd15e07034795ac790..9afbe948728507c5a72fbea480919c6c43ddd15c
@@@ -7,7 -7,6 +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);
  }
  
@@@ -19,27 -18,21 +18,23 @@@ 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,
                },
  }
  
- sub checkconfig {
-       if (! exists $config{rsync_command} ||
-           ! defined $config{rsync_command}) {
-               error("Must specify rsync_command");
-       }
- }
  sub postrefresh () {
-       chdir($config{destdir}) || error("chdir: $!");
-       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}) {
++              chdir($config{destdir}) || error("chdir: $!");
+               system $config{rsync_command};
+               if ($? == -1) {
+                       warn("failed to execute rsync_command: $!");
 -              } elsif ($? != 0) {
++              }
++              elsif ($? != 0) {
+                       warn(sprintf("rsync_command exited %d", $? >> 8));
+               }
        }
  }