annotate piecrust/publishing/rsync.py @ 622:5d8e0c8cdb5f

publish: Add the `rsync` publisher.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 08 Feb 2016 20:44:38 -0800
parents
children b45fb2137a07
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
622
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
1 from piecrust.publishing.base import ShellCommandPublisherBase
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
2
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
3
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
4 class RsyncPublisher(ShellCommandPublisherBase):
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
5 PUBLISHER_NAME = 'rsync'
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
6 PUBLISHER_SCHEME = 'rsync'
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
7
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
8 def _getCommandArgs(self, ctx):
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
9 if self.has_url_config:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
10 dest = self.parsed_url.netloc + self.parsed_url.path
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
11 else:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12 dest = self.getConfigValue('destination')
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
13
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
14 rsync_options = None
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
15 if not self.has_url_config:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
16 rsync_options = self.getConfigValue('options')
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
17 if rsync_options is None:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
18 rsync_options = ['-avc', '--delete']
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
19
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
20 args = ['rsync'] + rsync_options
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
21 args += [ctx.bake_out_dir, dest]
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
22 return args
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
23