Mercurial > mozilla > hg > DocumentIt
changeset 6:5a4c1339b2f9
more stubbing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 01 Aug 2011 22:05:30 -0700 |
parents | 3464eda1af80 |
children | 6bf82220a04c |
files | document_it.py |
diffstat | 1 files changed, 23 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/document_it.py Mon Aug 01 21:54:31 2011 -0700 +++ b/document_it.py Mon Aug 01 22:05:30 2011 -0700 @@ -41,10 +41,11 @@ def parse_manifest(filename, directory=None): """ reads a documentation manifest; returns a list of two-tuples: - [ + [(filename, destination)] """ - assert os.path.exists(filename) and os.path.isfile(filename) + assert os.path.exists(filename) and os.path.isfile(filename), "%s not found" % filename + if directory is None: directory = os.path.dirname(os.path.abspath(filename)) lines = [line.strip() for line in file(filename).readlines()] @@ -80,28 +81,38 @@ parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) parser.add_option('-d', '--directory', dest='directory', - help='render the documentation to this directory') + help='render the documentation from this directory') parser.add_option('--dest', dest='dest', default=DEST, - help='base URL of destination') + help='base directory or URL of destination') parser.add_option('-u', '--user', dest='user', help='user name') - parser.add_option('--list', dest='list', action='store_true', - help="list packages") + parser.add_option('--list', dest='list', action='store_true', default=False, + help="list files") options, manifests = parser.parse_args(args) + # print help if no manifests given if not args: parser.print_help() parser.exit() - # run setup_development.py in this directory - # to ensure documentation is up to date - # TODO; as yet unneeded + # read the manifests + files = [] + for manifest in manifests: + for item in parse_manifest(manifest): + if item not in files: + files.append(item) + if options.list: + for item in files: + print '%s -> %s' % (item[0], item[1]) + # render and upload READMEs - # TODO - - + if options.directory: + pass + else: + # TODO check credentials + raise NotImplementedError if __name__ == '__main__': main()