From 38a3b9fcaaab32bfc4dc5f9e02f62810024599d2 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 31 Jul 2011 11:53:49 +0100 Subject: Add rsync-publish command. --- unperish | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'unperish') diff --git a/unperish b/unperish index 40b3038..eb32618 100755 --- a/unperish +++ b/unperish @@ -60,6 +60,12 @@ class Unperish(cliapp.Application): self.settings.string(['web-directory'], 'put files to go on the web in DIR', metavar='DIR') + self.settings.string_list(['rsync-glob'], + 'publish files matching GLOB with rsync', + metavar='GLOB') + self.settings.string_list(['rsync-to'], + 'publish files with rsync to LOCATION', + metavar='LOCATION') def process_args(self, args): self.meta = self.create_meta() @@ -260,6 +266,16 @@ class Unperish(cliapp.Application): publish(name, manpage + '.txt') os.remove(name) + def cmd_rsync_publish(self, args): + '''Publish files via rsync.''' + + filenames = [] + for pattern in self.settings['rsync-glob']: + filenames += glob.glob(pattern) + + self.runcmd(['rsync', '-av', '--delete-after'] + filenames + + self.settings['rsync-to']) + def cmd_clean(self, args): '''Clean up the build-area (remove everything except the dir).''' area = self.settings['build-area'] -- cgit v1.2.1