annotate piecrust/publishing/rsync.py @ 837:ad8f48a31c62

assets: Fix crash when a page doesn't have assets.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 05 Feb 2017 22:52:01 -0800
parents f6a13dba38d6
children 13e8b50a2113
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:
624
b45fb2137a07 publish: Add option to change the source for the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents: 622
diff changeset
10 orig = ctx.bake_out_dir
758
6abb436fea5b publish: Make publisher more powerful and better exposed on the command line.
Ludovic Chabant <ludovic@chabant.com>
parents: 624
diff changeset
11 dest = self.config.netloc + self.config.path
622
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
12 else:
763
f6a13dba38d6 publish: Fix stupid typo.
Ludovic Chabant <ludovic@chabant.com>
parents: 758
diff changeset
13 orig = self.getConfigValue('source', ctx.bake_out_dir)
622
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
14 dest = self.getConfigValue('destination')
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
15
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
16 rsync_options = None
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
17 if not self.has_url_config:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
18 rsync_options = self.getConfigValue('options')
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
19 if rsync_options is None:
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
20 rsync_options = ['-avc', '--delete']
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
21
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
22 args = ['rsync'] + rsync_options
624
b45fb2137a07 publish: Add option to change the source for the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents: 622
diff changeset
23 args += [orig, dest]
622
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
24 return args
5d8e0c8cdb5f publish: Add the `rsync` publisher.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff changeset
25