changeset 16:9ad3a9e220bc

get factory from command line
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 07 Jan 2011 13:05:10 -0800
parents d7c4e9d6d9dd
children baee795ad6df
files autobot/template.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/autobot/template.py	Fri Jan 07 12:45:13 2011 -0800
+++ b/autobot/template.py	Fri Jan 07 13:05:10 2011 -0800
@@ -7,9 +7,9 @@
 import os
 import sys
 from makeitso.cli import MakeItSoCLI
-from makeitso.projects import factories
 from makeitso.template import MakeItSoTemplate
 from makeitso.template import Variable
+from projects import factories
 
 class AutobotMasterTemplate(MakeItSoTemplate):
     name = 'autobot-master'
@@ -21,17 +21,19 @@
             Variable('htmlport', 'port for waterfall display', default=8010)]
 
     def pre(self, variables):
-        factory = variables.get['factory']
+        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'
+            print 'Factories:\n'
             for key in sorted(factories.keys()):
                 print '%s:' % key
                 print getattr(factories[key], '__doc__', '').strip()
                 print
+            sys.stdout.write('Enter factory: ')
             factory = raw_input()
             assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys())
+            variables['factory'] = factory
         else:
             raise AssertionError("No factory provided")
 
@@ -41,10 +43,6 @@
     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()