Mercurial > piecrust2
comparison piecrust/publishing/rsync.py @ 885:13e8b50a2113
publish: Fix publishers API and add a simple "copy" publisher.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 20 Jun 2017 21:12:35 -0700 |
parents | f6a13dba38d6 |
children |
comparison
equal
deleted
inserted
replaced
884:18b3e2acd069 | 885:13e8b50a2113 |
---|---|
1 from piecrust.publishing.base import ShellCommandPublisherBase | 1 from piecrust.publishing.shell import ShellCommandPublisherBase |
2 | 2 |
3 | 3 |
4 class RsyncPublisher(ShellCommandPublisherBase): | 4 class RsyncPublisher(ShellCommandPublisherBase): |
5 PUBLISHER_NAME = 'rsync' | 5 PUBLISHER_NAME = 'rsync' |
6 PUBLISHER_SCHEME = 'rsync' | 6 PUBLISHER_SCHEME = 'rsync' |
7 | 7 |
8 def parseUrlTarget(self, url): | |
9 self.config = { | |
10 'destination': (url.netloc + url.path) | |
11 } | |
12 | |
8 def _getCommandArgs(self, ctx): | 13 def _getCommandArgs(self, ctx): |
9 if self.has_url_config: | 14 orig = self.config.get('source', ctx.bake_out_dir) |
10 orig = ctx.bake_out_dir | 15 dest = self.config.get('destination') |
11 dest = self.config.netloc + self.config.path | 16 if not dest: |
12 else: | 17 raise Exception("No destination specified.") |
13 orig = self.getConfigValue('source', ctx.bake_out_dir) | |
14 dest = self.getConfigValue('destination') | |
15 | 18 |
16 rsync_options = None | 19 rsync_options = self.config.get('options') |
17 if not self.has_url_config: | |
18 rsync_options = self.getConfigValue('options') | |
19 if rsync_options is None: | 20 if rsync_options is None: |
20 rsync_options = ['-avc', '--delete'] | 21 rsync_options = ['-avc', '--delete'] |
21 | 22 |
22 args = ['rsync'] + rsync_options | 23 args = ['rsync'] + rsync_options |
23 args += [orig, dest] | 24 args += [orig, dest] |