view piecrust/publishing/rsync.py @ 623:42da89d8bd51

publish: Change the `shell` config setting name for the command to run.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 08 Feb 2016 21:05:26 -0800
parents 5d8e0c8cdb5f
children b45fb2137a07
line wrap: on
line source

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