cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject webworks commit: CB-4340 Auto-detect target pin when its not there
Date Mon, 28 Oct 2013 15:06:35 GMT
Updated Branches:
  refs/heads/master e00a0c7b7 -> 9708560fc


CB-4340 Auto-detect target pin when its not there

Reviewed by Bryan Higgins <bhiggins@blackberry.com>


Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/9708560f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/9708560f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/9708560f

Branch: refs/heads/master
Commit: 9708560fc183b83a85f1eddef425488bed4e4a24
Parents: e00a0c7
Author: Jeffrey Heifetz <jheifetz@blackberry.com>
Authored: Tue Oct 22 22:17:28 2013 -0400
Committer: Bryan Higgins <bhiggins@blackberry.com>
Committed: Mon Oct 28 11:06:10 2013 -0400

----------------------------------------------------------------------
 .../templates/project/cordova/lib/run-utils.js  | 51 ++++++++++++--------
 1 file changed, 30 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/9708560f/blackberry10/bin/templates/project/cordova/lib/run-utils.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/run-utils.js b/blackberry10/bin/templates/project/cordova/lib/run-utils.js
index 8d6731f..10c7097 100644
--- a/blackberry10/bin/templates/project/cordova/lib/run-utils.js
+++ b/blackberry10/bin/templates/project/cordova/lib/run-utils.js
@@ -101,13 +101,14 @@ function validateTarget(options, targetName, allDone) {
                 err = "IP is not defined in target \"" + target + "\"";
             }
         }
+
         if (!deployTarget.password && deployTarget.password !== "") {
             if (options.devicepass || options.devicepass === "") {
                 deployTarget.password = options.devicepass;
             } else {
                 if (options.query) {
                     runTasks.push(function (done) {
-                         var description = options.device ? "Please enter your " + deployTarget.type
+  " password: " : "Please enter your " + deployTarget.type +  " password (For no password
press Enter): ";
+                        var description = options.device ? "Please enter your " + deployTarget.type
+  " password: " : "Please enter your " + deployTarget.type +  " password (For no password
press Enter): ";
                         utils.prompt({description: description, hidden: true}, function (e,
devicePass) {
                             deployTarget.password = devicePass;
                             done(e);
@@ -118,6 +119,15 @@ function validateTarget(options, targetName, allDone) {
                 }
             }
         }
+
+        if (!deployTarget.pin) {
+            runTasks.push(function (done) {
+                targetUtils.getDeviceInfo.bind(deployTarget.ip, deployTarget.devicePass,
function (err, result) {
+                    deployTarget.pin = result.pin;
+                    done(err);
+                });
+            });
+        }
     }
 
     async.series(runTasks, function (e) {
@@ -247,25 +257,24 @@ _self = {
                 args.push("-password", deployTarget.password);
             }
             runTasks = [
-            utils.exec.bind(this, script, args, { "cwd": projectRootDir, _customOptions:
{silent: true}}),
-            function listInstalledAppsOutput (stdout, stderr, done) {
-                installedAppsOutput = stdout;
-                fs.readFile(path.join(__dirname + "/../../www/", "config.xml"), done);
-            },
-            function configXMLOutput (result, done) {
-                var parser = new xml2js.Parser();
-                parser.parseString(result, done);
-            },
-            function parsedConfigXMLOutput (result, done) {
-                if (installedAppsOutput.indexOf(result['@'].id) !== -1) {
-                    var deployOptions = generateDeployOptions(options, deployTarget, true);
-                    execNativeDeploy(deployOptions, done);
-                } else {
-                    done();
+                utils.exec.bind(this, script, args, { "cwd": projectRootDir, _customOptions:
{silent: true}}),
+                function listInstalledAppsOutput (stdout, stderr, done) {
+                    installedAppsOutput = stdout;
+                    fs.readFile(path.join(__dirname + "/../../www/", "config.xml"), done);
+                },
+                function configXMLOutput (result, done) {
+                    var parser = new xml2js.Parser();
+                    parser.parseString(result, done);
+                },
+                function parsedConfigXMLOutput (result, done) {
+                    if (installedAppsOutput.indexOf(result['@'].id) !== -1) {
+                        var deployOptions = generateDeployOptions(options, deployTarget,
true);
+                        execNativeDeploy(deployOptions, done);
+                    } else {
+                        done();
+                    }
                 }
-            }
-
-            ]
+            ];
         }
 
         async.waterfall(runTasks,
@@ -273,7 +282,7 @@ _self = {
                 //Absorb error for uninstallation
                 allDone(null, deployTarget);
             }
-            );
+        );
     },
 
     //Function returns (error || deployTarget)
@@ -292,7 +301,7 @@ _self = {
     //No options needed within function Function returns (error || options, targetName)
     checkDeviceInfo : function (options, ip, deviceType, devicePass, done) {
         var props = utils.getProperties(),
-        targetName;
+            targetName;
 
         targetUtils.getDeviceInfo(ip, devicePass, function (err, device) {
             if (!err) {


Mime
View raw message