Mercurial > hg > autobot
diff autobot/template.py @ 67:e8dabfd24c42
stub for a template to create new autobot factories; unfinished
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 11 Jan 2011 10:55:52 -0800 |
parents | cbcb96142ed6 |
children | fbd4a34d8e42 |
line wrap: on
line diff
--- a/autobot/template.py Tue Jan 11 10:15:33 2011 -0800 +++ b/autobot/template.py Tue Jan 11 10:55:52 2011 -0800 @@ -96,7 +96,18 @@ def post(self, variables): AutobotMasterTemplate.create(self, os.path.join(self.output, 'master'), variables) - AutobotSlaveTemplate.create(self, os.path.join(self.output, 'slave'), variables) + AutobotSlaveTemplate.create(self, os.path.join(self.output, 'slave'), variables) + + +class ProjectTemplate(MakeItSoTemplate): + """ + template for creating new autobot project stubs for testing + """ + name = 'autobot-project' + templates = [os.path.join('projects', 'project.template')] + vars = [Variable('project', 'name of the project'), + Variable('description'), + Variable('repo', 'repository location of the project')] # CLI front end class @@ -129,6 +140,17 @@ # call the parent return MakeItSoCLI.parse(self, args, parser, options) +class ProjectTemplateCLI(MakeItSoCLI): + def __init__(self): + MakeItSoCLI.__init__(self, ProjectTemplate) + def parse(self, args=None, parser=None, options=None): + if not args: + # deploy to the correct place + here = os.path.dirname(os.path.abspath(__file__)) + args = [os.path.join(here, 'projects')] + print args[0] + + ### console_script front-ends @@ -144,5 +166,8 @@ cli = AutobotMasterCLI(AutobotTemplate) cli(*args) +def create_project(args=sys.argv[1:]): + cli = ProjectTemplateCLI() + if __name__ == '__main__': create_master()