# HG changeset patch # User Ludovic Chabant # Date 1454993078 28800 # Node ID 5d8e0c8cdb5f3c5d1f80746bb8d615c324b285a1 # Parent 8f9c0bdb3724b3eaa63072532c56a5d0c3977524 publish: Add the `rsync` publisher. diff -r 8f9c0bdb3724 -r 5d8e0c8cdb5f piecrust/plugins/builtin.py --- a/piecrust/plugins/builtin.py Mon Feb 08 20:44:26 2016 -0800 +++ b/piecrust/plugins/builtin.py Mon Feb 08 20:44:38 2016 -0800 @@ -35,6 +35,7 @@ from piecrust.processing.sitemap import SitemapProcessor from piecrust.processing.util import ConcatProcessor from piecrust.publishing.shell import ShellCommandPublisher +from piecrust.publishing.rsync import RsyncPublisher from piecrust.sources.default import DefaultPageSource from piecrust.sources.posts import ( FlatPostsSource, ShallowPostsSource, HierarchyPostsSource) @@ -122,5 +123,6 @@ def getPublishers(self): return [ - ShellCommandPublisher] + ShellCommandPublisher, + RsyncPublisher] diff -r 8f9c0bdb3724 -r 5d8e0c8cdb5f piecrust/publishing/rsync.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piecrust/publishing/rsync.py Mon Feb 08 20:44:38 2016 -0800 @@ -0,0 +1,23 @@ +from piecrust.publishing.base import ShellCommandPublisherBase + + +class RsyncPublisher(ShellCommandPublisherBase): + PUBLISHER_NAME = 'rsync' + PUBLISHER_SCHEME = 'rsync' + + def _getCommandArgs(self, ctx): + if self.has_url_config: + dest = self.parsed_url.netloc + self.parsed_url.path + else: + dest = self.getConfigValue('destination') + + rsync_options = None + if not self.has_url_config: + rsync_options = self.getConfigValue('options') + if rsync_options is None: + rsync_options = ['-avc', '--delete'] + + args = ['rsync'] + rsync_options + args += [ctx.bake_out_dir, dest] + return args +