Mercurial > piecrust2
changeset 622:5d8e0c8cdb5f
publish: Add the `rsync` publisher.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 08 Feb 2016 20:44:38 -0800 |
parents | 8f9c0bdb3724 |
children | 42da89d8bd51 |
files | piecrust/plugins/builtin.py piecrust/publishing/rsync.py |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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]
--- /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 +