Commits

Ryan Wilcox committed c023af4

setup_project now can accept parameters to run only a certain step

Comments (0)

Files changed (1)

 @task
 @consume_args
 def setup_project(options, info):
-    """Run the PROJECT setup steps declared, or use the second parameter to specify exactly which one """
+    """Run the PROJECT setup steps declared, or use the second parameter to specify exactly which one.
+    Use --help as second parameter to see the list of steps"""
     projectname = options["args"][0]
-    # TODO: implement logic telling us which one to run
-    for info, our_callable, options in setups.project_setup_task_list:
+    selector = (options["args"][1] if len( options["args"] ) > 1  else None)
+    
+    if selector == "--help":
+        print "The following subcommands are available:"
+        print
+        
+        for info, our_callable, options in setups.project_setup_task_list:
+            print "paver setup_project %(projectname)s %(optionname)s" % dict(
+                    projectname=projectname, optionname=our_callable.__name__)
+            print "    * " + info
+        return
+    
+    task_list = setups.project_setup_task_list
+    
+    if selector:
+        task_list = [curr_item for curr_item in task_list if curr_item[1].__name__ == selector]
+    
+    for info, our_callable, options in task_list:
         call_it = True
         if options.get("optional", False):
             answer = raw_input(info + "? [yes]/no: ")
     """Run the APPLICATION setup declared, or use the second parameter to specify exactly which one"""
     projectname = options["args"][0]
     appname = options["args"][1]
+    
     for info, our_callable, options in setups.app_setup_task_list:
         call_it = True
         if options.get("optional", False):