# HG changeset patch # User Jeff Hammel # Date 1294772152 28800 # Node ID e8dabfd24c42f9d00c2baf4e528c5167be9c3fb0 # Parent cbcb96142ed6c4727de910a1f2f30e31193c695d stub for a template to create new autobot factories; unfinished diff -r cbcb96142ed6 -r e8dabfd24c42 autobot/projects/project.template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autobot/projects/project.template Tue Jan 11 10:55:52 2011 -0800 @@ -0,0 +1,17 @@ +from buildbot.process.factory import BuildFactory +from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import WithProperties + +class Test{{project.title()}}(BuildFactory): + """ + {{description}}: + {{repo}} + """ + + def __init__(self): + BuildFactory.__init__(self) + + # checkout the repository + #self.addStep(ShellCommand(command=['hg', 'clone', '{{repo}}'])) + + # run the tests [TODO] diff -r cbcb96142ed6 -r e8dabfd24c42 autobot/template.py --- 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() diff -r cbcb96142ed6 -r e8dabfd24c42 setup.py --- a/setup.py Tue Jan 11 10:15:33 2011 -0800 +++ b/setup.py Tue Jan 11 10:55:52 2011 -0800 @@ -29,5 +29,6 @@ create-autobot = autobot.template:create_autobot create-autobot-master = autobot.template:create_master create-autobot-slave = autobot.template:create_slave + create-autobot-project = autobot.template:create_project """, )