Commits

Anonymous committed 93841c3

add deploy help
make the "deploy" command actually run the deployment
fix subcommanddefault so that it actually works
don't set owner, group or permissions on the remote server because
the remote server won't match Bespin on those.

Comments (0)

Files changed (3)

backend/python/bespin/deploy.py

     recursive = True
     exclude_files = []
     include_files = []
-    exclude_dirs = []
+    exclude_dirs = r"\.svn|\.hg|\.git|\.bzr"
     include_dirs = []
     
+    # because Bespin is a shared environment, we cannot reasonably
+    # set these values on the remote system
+    exclude_attributes = set(["owner", "group", "perms"])
+    
     def __init__(self, opts):
         for key, value in opts.items():
             setattr(self, key, value)

frontend/js/bespin/cmd/commandline.js

         }
 
         if (command.subcommands) {
-            if (data.length < 1 || data[0] == '') data[0] = command.subcommanddefault || 'help';
+            if (data.length < 1 || !data[0]) {
+                argstr = command.subcommanddefault || 'help';
+            }
             return this._splitCommandAndArgs(command.subcommands, argstr, command);
         }
 

frontend/js/bespin/deploy.js

     subcommanddefault: 'now'
 });
 
+bespin.deploy.commands.addCommand({
+    name: 'help',
+    takes: ['search'],
+    preview: 'show commands for deploy subcommand',
+    description: 'The <u>help</u> gives you access to the various commands in the deploy subcommand space.<br/><br/>You can narrow the search of a command by adding an optional search params.<br/><br/>Finally, pass in the full name of a command and you can get the full description, which you just did to see this!',
+    completeText: 'optionally, narrow down the search',
+    execute: function(instruction, extra) {
+        var output = this.parent.getHelp(extra, {});
+        instruction.addOutput(output);
+    }
+});
+
+
 bespin.deploy._createOption = function(select, value, label, currentValue) {
     var opts = {
         value: value,
     }
 });
 
+bespin.deploy._deployCommand = function(instruction, project, opts) {
+    if (!project) {
+        bespin.withComponent('editSession', function(editSession) {
+            project = editSession.project;
+        });
+    }
+
+    if (!project) {
+        instruction.addErrorOutput("You need to pass in a project");
+        return;
+    }
+    
+    bespin.vcs.getInfoFromUser(instruction, function(values) {
+        var kcpass = values.kcpass;
+        var server = bespin.get("server");
+        var data = {
+            kcpass: kcpass,
+            dryRun: opts.dryRun
+        };
+        server.runDeploy(instruction, project, data, {
+            onSuccess: function(response) {
+                if (response.error) {
+                    instruction.addErrorOutput("<pre>" +
+                        response.output + "</pre>");
+                } else {
+                    instruction.addOutput("<pre>" + response.output
+                        + "</pre>");
+                }
+            },
+            onFailure: function(xhr) {
+                instruction.addError(xhr.response);
+            }
+        });
+    }, {getKeychain: true});
+}
+
 bespin.deploy.commands.addCommand({
     name: 'test',
     preview: 'Do a "dry run" to see what would happen in deployment',
     takes: ['project'],
     completeText: "Optionally provide the project to deploy",
     execute: function(instruction, project) {
-        if (!project) {
-            bespin.withComponent('editSession', function(editSession) {
-                project = editSession.project;
+        bespin.deploy._deployCommand(instruction, project,
+            {
+                dryRun: true
             });
-        }
-
-        if (!project) {
-            instruction.addErrorOutput("You need to pass in a project");
-            return;
-        }
-        
-        bespin.vcs.getInfoFromUser(instruction, function(values) {
-            var kcpass = values.kcpass;
-            var server = bespin.get("server");
-            var data = {
-                kcpass: kcpass,
-                dryRun: true
-            };
-            server.runDeploy(instruction, project, data, {
-                onSuccess: function(response) {
-                    console.log(response);
-                    if (response.error) {
-                        instruction.addErrorOutput("<pre>" +
-                            response.output + "</pre>");
-                    } else {
-                        instruction.addOutput("<pre>" + response.output
-                            + "</pre>");
-                    }
-                },
-                onFailure: function(xhr) {
-                    instruction.addError(xhr.response);
-                }
-            });
-        }, {getKeychain: true});
     }
 });
 
     takes: ['project'],
     completeText: "Optionally provide the project to deploy",
     execute: function(instruction, project) {
-        
+        bespin.deploy._deployCommand(instruction, project,
+            {
+                dryRun: false
+            });
     }
 });