Mercurial > hg > autobot
changeset 13:59cc21718ced
select factory
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 07 Jan 2011 12:04:16 -0800 |
parents | 848569b7f91a |
children | ddacd5faf0b4 |
files | autobot/template.py |
diffstat | 1 files changed, 18 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/autobot/template.py Fri Jan 07 11:49:53 2011 -0800 +++ b/autobot/template.py Fri Jan 07 12:04:16 2011 -0800 @@ -7,6 +7,7 @@ import os import sys from makeitso.cli import MakeItSoCLI +from makeitso.projects import factories from makeitso.template import MakeItSoTemplate from makeitso.template import Variable @@ -20,7 +21,19 @@ Variable('htmlport', 'port for waterfall display', default=8010)] def pre(self, variables): - variables['factory'] = 'foo' + factory = variables.get['factory'] + if factory: + assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) + elif self.interactive: + print 'Please select a Factory:\n' + for key in sorted(factories.keys()): + print '%s:' % key + print getattr(factories[key], '__doc__', '').strip() + print + factory = raw_input() + assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) + else: + raise AssertionError("No factory provided") class AutobotSlaveTemplate(MakeItSoTemplate): name = 'autobot-slave' @@ -28,6 +41,10 @@ templates = [os.path.join('template', 'slave')] look = True +class MasterTemplateCLI(MakeItSoCLI): + def __init__(self): + + def main(args=sys.argv[1:]): cli = MakeItSoCLI(AutobotMasterTemplate) template = cli.parse()