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:42 UTC
[2/2] webworks commit: Refactor getParams() out of session
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;