From fbe02b0bfdd2924f532d9d90fcbc0dfa7cf49850 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 14 Jan 2012 20:33:49 +0000 Subject: make publish-docs get list of files to publish from --doc setting --- unperish | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'unperish') diff --git a/unperish b/unperish index 2ee408a..c6ea035 100755 --- a/unperish +++ b/unperish @@ -110,6 +110,11 @@ class Unperish(cliapp.Application): self.settings.string(['web-directory'], 'put files to go on the web in DIR', metavar='DIR') + self.settings.string_list(['doc'], + 'add FILE to docs to publish with ' + 'publish-docs (default: %default)', + metavar='FILE', + default=['README', 'NEWS']) self.settings.string_list(['rsync-glob'], 'publish files matching GLOB with rsync', metavar='GLOB') @@ -430,7 +435,16 @@ class Unperish(cliapp.Application): self.output.write(out) def cmd_publish_docs(self, args): - '''Publish docs related to this project.''' + '''Publish docs related to this project. + + By default, the README and NEWS files and any manual pages are + published. README and NEWS can be replaced with the --doc option. + Any documents get a .mdwn suffix added: it is assumed that they're + marked up using Markdown and published in an ikiwiki instance. + Manual pages are formatted into plain text and get a .txt suffix + added when copying. + + ''' def publish(source, target_base): target = os.path.join(self.settings['web-directory'], target_base) @@ -442,10 +456,8 @@ class Unperish(cliapp.Application): raise cliapp.AppException('Need --web-directory ' 'for publish-docs.') - docs = ['README', 'NEWS'] - for doc in docs: + for doc in self.settings['doc']: src = self.join(self.dirname, doc) - print 'pd: src: %s' % src if os.path.exists(src): publish(src, doc + '.mdwn') -- cgit v1.2.1