You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2014/04/19 14:49:41 UTC

[1/2] webworks commit: CB-6398 Support additional commands in blackberry10.json

Repository: cordova-blackberry
Updated Branches:
  refs/heads/master ee0904cfe -> c686aa4e5


CB-6398 Support additional commands in blackberry10.json

blackberry-nativepackager
blackberry-debugtokenrequest
blackberry-deploy
blackberry-signer


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

Branch: refs/heads/master
Commit: c686aa4e59d1672fb86ee69ad56e9e3b54ee6cd8
Parents: 7741564
Author: Josh Soref <js...@blackberry.com>
Authored: Thu Apr 3 17:47:13 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Sat Apr 19 08:49:04 2014 -0400

----------------------------------------------------------------------
 .../project/cordova/lib/debugtoken-helper.js    | 40 +++++++++++++-------
 1 file changed, 27 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/c686aa4e/blackberry10/bin/templates/project/cordova/lib/debugtoken-helper.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/debugtoken-helper.js b/blackberry10/bin/templates/project/cordova/lib/debugtoken-helper.js
index 49abda9..4916ba5 100755
--- a/blackberry10/bin/templates/project/cordova/lib/debugtoken-helper.js
+++ b/blackberry10/bin/templates/project/cordova/lib/debugtoken-helper.js
@@ -22,6 +22,7 @@ var childProcess = require("child_process"),
     logger = require("./logger"),
     pkgrUtils = require("./packager-utils"),
     utils = require("./utils"),
+    getParams = require("./params"),
     workingDir = path.normalize(__dirname + "/.."),
     debugTokenDir = path.normalize(path.join(utils.getCordovaDir(), "blackberry10debugtoken.bar")),
     properties,
@@ -67,15 +68,23 @@ function isDebugTokenValid(pin, data) {
 
 function generateCreateTokenOptions(pins, password) {
     var options = [],
+        params = getParams("blackberry-debugtokenrequest") || {},
         i;
 
-    options.push("-storepass");
-    options.push(password);
+    params["-storepass"] = password;
 
-    for (i = 0; i < pins.length; i++) {
+    Object.getOwnPropertyNames(params).forEach(function (p) {
+        options.push(p);
+
+        if (params[p]) {
+            options.push(params[p]);
+        }
+    });
+
+    pins.forEach(function(pin) {
         options.push("-devicepin");
-        options.push(pins[i]);
-    }
+        options.push(pin);
+    });
 
     options.push(debugTokenDir);
 
@@ -83,19 +92,24 @@ function generateCreateTokenOptions(pins, password) {
 }
 
 function generateDeployTokenOptions(targetIp, targetPassword) {
-    var options = [];
-
-    options.push("-installDebugToken");
-    options.push(debugTokenDir);
+    var options = [],
+        params = getParams("blackberry-deploy") || {};
 
-    options.push("-device");
-    options.push(targetIp);
+    params["-installDebugToken"] = debugTokenDir;
+    params["-device"] = targetIp;
 
     if (targetPassword) {
-        options.push("-password");
-        options.push(targetPassword);
+        params["-password"] = targetPassword;
     }
 
+    Object.getOwnPropertyNames(params).forEach(function (p) {
+        options.push(p);
+
+        if (params[p]) {
+            options.push(params[p]);
+        }
+    });
+
     return options;
 }
 


[2/2] webworks commit: Refactor getParams() out of session

Posted by bh...@apache.org.
Refactor getParams() out of session


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

Branch: refs/heads/master
Commit: 7741564a06d5a3f87e13d07b8f7b8125b34aa4da
Parents: ee0904c
Author: Josh Soref <js...@blackberry.com>
Authored: Thu Apr 3 17:28:56 2014 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Sat Apr 19 08:49:04 2014 -0400

----------------------------------------------------------------------
 .../bin/templates/project/cordova/lib/params.js | 56 ++++++++++++++++++++
 .../templates/project/cordova/lib/session.js    | 42 ++-------------
 2 files changed, 61 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7741564a/blackberry10/bin/templates/project/cordova/lib/params.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/params.js b/blackberry10/bin/templates/project/cordova/lib/params.js
new file mode 100644
index 0000000..955302f
--- /dev/null
+++ b/blackberry10/bin/templates/project/cordova/lib/params.js
@@ -0,0 +1,56 @@
+/*
+ *  Copyright 2014 BlackBerry Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var path = require("path"),
+    fs = require("fs"),
+    utils = require("./utils"),
+    localize = require("./localize");
+
+function getParams(toolName, cmdline) {
+    var properties = utils.getProperties(),
+        params = properties[toolName],
+        paramsPath,
+        cmdParams;
+
+    if (cmdline && cmdline.params) {
+        if (!cmdParams) {
+            paramsPath = path.resolve(cmdline.params);
+
+            if (fs.existsSync(paramsPath)) {
+                try {
+                    cmdParams = require(paramsPath);
+                } catch (e) {
+                    throw localize.translate("EXCEPTION_PARAMS_FILE_ERROR", paramsPath);
+                }
+            } else {
+                throw localize.translate("EXCEPTION_PARAMS_FILE_NOT_FOUND", paramsPath);
+            }
+        }
+    }
+
+    if (cmdParams && cmdParams[toolName]) {
+        if (params) {
+            params = utils.mixin(cmdParams[toolName], params);
+        } else {
+            params = cmdParams[toolName];
+        }
+    }
+
+    return params;
+}
+
+
+module.exports = getParams;

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/7741564a/blackberry10/bin/templates/project/cordova/lib/session.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/session.js b/blackberry10/bin/templates/project/cordova/lib/session.js
index 786e7cd..3dd8763 100644
--- a/blackberry10/bin/templates/project/cordova/lib/session.js
+++ b/blackberry10/bin/templates/project/cordova/lib/session.js
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2012 Research In Motion Limited.
+ *  Copyright 2014 BlackBerry Limited.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,45 +22,13 @@ var path = require("path"),
     signingUtils = require("./signing-utils"),
     barConf = require("./bar-conf"),
     localize = require("./localize"),
-    cmdParams;
-
-function getParams(cmdline, toolName) {
-    var properties = utils.getProperties(),
-        params = properties[toolName],
-        paramsPath;
-
-    if (cmdline.params) {
-        if (!cmdParams) {
-            paramsPath = path.resolve(cmdline.params);
-
-            if (fs.existsSync(paramsPath)) {
-                try {
-                    cmdParams = require(paramsPath);
-                } catch (e) {
-                    throw localize.translate("EXCEPTION_PARAMS_FILE_ERROR", paramsPath);
-                }
-            } else {
-                throw localize.translate("EXCEPTION_PARAMS_FILE_NOT_FOUND", paramsPath);
-            }
-        }
-    }
-
-    if (cmdParams && cmdParams[toolName]) {
-        if (params) {
-            params = utils.mixin(cmdParams[toolName], params);
-        } else {
-            params = cmdParams[toolName];
-        }
-    }
-
-    return params;
-}
+    getParams = require("./params");
 
 
 module.exports = {
     getKeyStorePass: function (cmdline) {
         var properties = utils.getProperties(),
-            params = getParams(cmdline, "blackberry-signer") || {},
+            params = getParams("blackberry-signer", cmdline) || {},
             keystorepass;
 
         //Check commandline first, then properties, then params
@@ -87,7 +55,7 @@ module.exports = {
             archiveName = utils.genBarName(),
             appdesc,
             buildId = cmdline.buildId,
-            signerParams = getParams(cmdline, "blackberry-signer") || {},
+            signerParams = getParams("blackberry-signer", cmdline) || {},
             keystore = signerParams["-keystore"],
             bbidtoken = signerParams["-bbidtoken"];
 
@@ -146,7 +114,7 @@ module.exports = {
             "buildId": buildId,
             "appdesc" : appdesc,
             getParams: function (toolName) {
-                return getParams(cmdline, toolName);
+                return getParams(toolName, cmdline);
             },
             isSigningRequired: function (config) {
                 return (keystore || signingUtils.getKeyStorePath()) && signingPassword;