changeset 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
files autobot/projects/project.template autobot/template.py setup.py
diffstat 3 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /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]
--- 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()
--- 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
       """,
       )