Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C8826109BB for ; Mon, 11 Nov 2013 16:10:44 +0000 (UTC) Received: (qmail 1504 invoked by uid 500); 11 Nov 2013 16:10:44 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 1487 invoked by uid 500); 11 Nov 2013 16:10:44 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 1477 invoked by uid 99); 11 Nov 2013 16:10:44 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Nov 2013 16:10:44 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CA4BE8A22DB; Mon, 11 Nov 2013 16:10:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: bhiggins@apache.org To: commits@cordova.apache.org Message-Id: <03d19f781c5b433cab7007608489ad45@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: webworks commit: CB-5317 Move signing warn logic to build/run scripts Date: Mon, 11 Nov 2013 16:10:43 +0000 (UTC) Updated Branches: refs/heads/3.2.x ed8cd4d1d -> 12b2c52b7 CB-5317 Move signing warn logic to build/run scripts - Moved to warn function in signing-utils - Removed duplicate copy of that module Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/12b2c52b Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/12b2c52b Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/12b2c52b Branch: refs/heads/3.2.x Commit: 12b2c52b7f140d7be68ff51d56008010e801687b Parents: ed8cd4d Author: Bryan Higgins Authored: Sat Nov 9 11:09:54 2013 -0500 Committer: Bryan Higgins Committed: Mon Nov 11 11:09:56 2013 -0500 ---------------------------------------------------------------------- blackberry10/.gitignore | 1 + blackberry10/bin/check_reqs.js | 11 --- blackberry10/bin/lib/signing-utils.js | 27 ++++++- .../bin/templates/project/cordova/lib/build.js | 3 + .../bin/templates/project/cordova/lib/run.js | 3 + .../project/cordova/lib/signing-utils.js | 79 -------------------- 6 files changed, 33 insertions(+), 91 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/.gitignore ---------------------------------------------------------------------- diff --git a/blackberry10/.gitignore b/blackberry10/.gitignore index bd46f91..64194f5 100644 --- a/blackberry10/.gitignore +++ b/blackberry10/.gitignore @@ -19,6 +19,7 @@ dist/ bin/node_modules bin/templates/project/lib bin/templates/project/cordova/lib/utils.js +bin/templates/project/cordova/lib/signing-utils.js example/ node_modules/ .tmp http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/bin/check_reqs.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/check_reqs.js b/blackberry10/bin/check_reqs.js index b8acada..c932122 100644 --- a/blackberry10/bin/check_reqs.js +++ b/blackberry10/bin/check_reqs.js @@ -34,17 +34,6 @@ if (!isNodeNewerThanMin()) { exit(ERROR_VALUE); } -if (!signingUtils.getKeyStorePath()) { - console.log("WARNING: Cannot sign applications. Author.p12 file cannot be found at default location: " + signingUtils.getDefaultPath("author.p12")); -} - -if (!signingUtils.getKeyStorePathBBID()) { - if (signingUtils.getCskPath() && signingUtils.getDbPath()) { - console.log('NOTE: BlackBerry ID tokens can now be used in place of your old signing keys. For more information on linking old signing keys with a BlackBerry ID token, please log in at http://developer.blackberry.com and click on Code Signing in the top menu bar.'); - } else { - console.log('WARNING: Cannot sign applications. bbidtoken.csk file cannot be found at default location: ' + signingUtils.getDefaultPath("bbidtoken.csk")); - } -} exit(0); http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/bin/lib/signing-utils.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/lib/signing-utils.js b/blackberry10/bin/lib/signing-utils.js index d2ebae3..a491975 100644 --- a/blackberry10/bin/lib/signing-utils.js +++ b/blackberry10/bin/lib/signing-utils.js @@ -11,6 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + var fs = require('fs'), path = require('path'), os = require('os'), @@ -58,7 +59,7 @@ _self = { getDefaultPath: getDefaultPath, getKeyStorePath : function () { - // Todo: decide where to put sigtool.p12 which is genereated and used in WebWorks SDK for Tablet OS + // Todo: decide where to put sigtool.p12 which is generated and used in WebWorks SDK for Tablet OS return getDefaultPathIfExists(AUTHOR_P12); }, @@ -72,6 +73,30 @@ _self = { getDbPath : function () { return getDefaultPathIfExists(DB); + }, + + warn: function () { + if (!this.getKeyStorePath()) { + console.error( + "WARNING: Cannot sign applications. Author.p12 file cannot be found at default location: " + + getDefaultPath("author.p12") + ); + } + + if (!this.getKeyStorePathBBID()) { + + if (this.getCskPath() && this.getDbPath()) { + console.error( + "WARNING: BlackBerry ID tokens can now be used in place of your old signing keys.\n" + + "For more information log in at http://developer.blackberry.com and click on Code Signing" + ); + } else { + console.error( + "WARNING: Cannot sign applications. bbidtoken.csk file cannot be found at default location: " + + getDefaultPath("bbidtoken.csk") + ); + } + } } }; http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/bin/templates/project/cordova/lib/build.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/build.js b/blackberry10/bin/templates/project/cordova/lib/build.js index a402f2b..0c1293c 100755 --- a/blackberry10/bin/templates/project/cordova/lib/build.js +++ b/blackberry10/bin/templates/project/cordova/lib/build.js @@ -21,6 +21,7 @@ var path = require("path"), command = require("commander"), os = require("os"), utils = require("./utils"), + signingUtils = require("./signing-utils"), bbProperties = utils.getProperties(), bbwpArgv = [ process.argv[0], @@ -63,6 +64,8 @@ try { exit(ERROR_VALUE); } + signingUtils.warn(); + utils.series( [ function clean (done) { http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/bin/templates/project/cordova/lib/run.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/run.js b/blackberry10/bin/templates/project/cordova/lib/run.js index de3f020..b3966ec 100755 --- a/blackberry10/bin/templates/project/cordova/lib/run.js +++ b/blackberry10/bin/templates/project/cordova/lib/run.js @@ -21,6 +21,7 @@ var path = require("path"), utils = require("./utils"), options = require('commander'), runUtils = require("./run-utils"), + signingUtils = require("./signing-utils"); async = require("async"); function install(deployTarget, done) { @@ -68,6 +69,8 @@ process.argv.forEach(function (argument, index, args) { options.parse(process.argv); +signingUtils.warn(); + utils.waterfall( [ runUtils.getValidatedTarget.bind(this, options), http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/12b2c52b/blackberry10/bin/templates/project/cordova/lib/signing-utils.js ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/signing-utils.js b/blackberry10/bin/templates/project/cordova/lib/signing-utils.js deleted file mode 100644 index ebcefca..0000000 --- a/blackberry10/bin/templates/project/cordova/lib/signing-utils.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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 fs = require('fs'), - path = require('path'), - os = require('os'), - childProcess = require('child_process'), - AUTHOR_P12 = "author.p12", - BBIDTOKEN = "bbidtoken.csk", - CSK = "barsigner.csk", - DB = "barsigner.db", - _self; - -function getDefaultPath(file) { - // The default location where signing key files are stored will vary based on the OS: - // Windows XP: %HOMEPATH%\Local Settings\Application Data\Research In Motion - // Windows Vista and Windows 7: %HOMEPATH%\AppData\Local\Research In Motion - // Mac OS: ~/Library/Research In Motion - // UNIX or Linux: ~/.rim - var p = ""; - if (os.type().toLowerCase().indexOf("windows") >= 0) { - // Try Windows XP location - p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\Local Settings\\Application Data\\Research In Motion\\"; - if (!fs.existsSync(p)) { - // Try Windows Vista and Windows 7 location - p = process.env.HOMEDRIVE + process.env.HOMEPATH + "\\AppData\\Local\\Research In Motion\\"; - } - } else if (os.type().toLowerCase().indexOf("darwin") >= 0) { - // Try Mac OS location - p = process.env.HOME + "/Library/Research In Motion/"; - } else if (os.type().toLowerCase().indexOf("linux") >= 0) { - // Try Linux location - p = process.env.HOME + "/.rim/"; - } - - return p + file; - -} - -function getDefaultPathIfExists(file) { - var p = getDefaultPath(file); - if (fs.existsSync(p)) { - return p; - } -} - -_self = { - getDefaultPath: getDefaultPath, - - getKeyStorePath : function () { - // Todo: decide where to put sigtool.p12 which is generated and used in WebWorks SDK for Tablet OS - return getDefaultPathIfExists(AUTHOR_P12); - }, - - getKeyStorePathBBID: function () { - return getDefaultPathIfExists(BBIDTOKEN); - }, - - getCskPath : function () { - return getDefaultPathIfExists(CSK); - }, - - getDbPath : function () { - return getDefaultPathIfExists(DB); - } -}; - -module.exports = _self;