[CB-3604] build and run project level scripts updated to use targets.json
Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/773001d3 Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/773001d3 Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/773001d3 Branch: refs/heads/master Commit: 773001d33a13c7d5aa97c145209369b8fef38d14 Parents: 25bad0d Author: lorinbeer <[email protected]> Authored: Wed Jun 12 14:59:00 2013 -0700 Committer: lorinbeer <[email protected]> Committed: Wed Jun 12 15:02:07 2013 -0700 ---------------------------------------------------------------------- .../bin/templates/project/cordova/lib/build | 16 ++++++------ .../bin/templates/project/cordova/lib/run | 27 ++++++++++---------- 2 files changed, 22 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/773001d3/blackberry10/bin/templates/project/cordova/lib/build ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/build b/blackberry10/bin/templates/project/cordova/lib/build index 5e15425..8843457 100755 --- a/blackberry10/bin/templates/project/cordova/lib/build +++ b/blackberry10/bin/templates/project/cordova/lib/build @@ -18,13 +18,13 @@ var path = require("path"), command = require("commander"), - projectProperties = require("../../project.json"), + targets = require(path.join(__dirname,"targets.json")), bbwpArgv = [ - process.argv[0], - path.resolve(path.join(__dirname, process.argv[1])), - path.resolve(path.join(__dirname, "..", "..", "www")), - "-o", - path.resolve(path.join(__dirname, "..", "..", "build")) + process.argv[0], + path.resolve(path.join(__dirname, process.argv[1])), + path.resolve(path.join(__dirname, "..", "..", "www")), + "-o", + path.resolve(path.join(__dirname, "..", "..", "build")) ], jWorkflow = require("jWorkflow"), childProcess = require("child_process"), @@ -50,9 +50,9 @@ function doReleaseBuild() { if (command["keystorepass"]) { bbwpArgv.push("--password"); bbwpArgv.push(command["keystorepass"]); - } else if (projectProperties.keystorepass) { + } else if (targets.keystorepass) { bbwpArgv.push("--password"); - bbwpArgv.push( projectProperties.keystorepass); + bbwpArgv.push(targets.keystorepass); } else { console.log("No signing password provided. Please use --keystorepass via command-line or enter a value for keystorepass in project.json"); console.log(command.helpInformation()); http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/773001d3/blackberry10/bin/templates/project/cordova/lib/run ---------------------------------------------------------------------- diff --git a/blackberry10/bin/templates/project/cordova/lib/run b/blackberry10/bin/templates/project/cordova/lib/run index d4430f9..791dabe 100755 --- a/blackberry10/bin/templates/project/cordova/lib/run +++ b/blackberry10/bin/templates/project/cordova/lib/run @@ -25,7 +25,8 @@ var childProcess = require("child_process"), localize = require("./localize"), pkgrUtils = require("./packager-utils"), debugTokenHelper = require("./debugtoken-helper"), - properties = require('../../project.json'), + targets = require(path.join(__dirname,'targets.json')), + projectProperties = require(path.join(__dirname,'..','..','project.json')), program = require('commander'), xml2js = require('xml2js'), jWorkflow = require("jWorkflow"), @@ -41,7 +42,7 @@ var childProcess = require("child_process"), function generateOptions(uninstall) { var options = []; - barPath = pkgrUtils.escapeStringForShell(path.normalize(__dirname + "/../../build/" + properties.targets[target].type + "/" + properties.barName + ".bar")); + barPath = pkgrUtils.escapeStringForShell(path.normalize(__dirname + "/../../build/" + targets.targets[target].type + "/" + projectProperties.barName + ".bar")); options.push("-device"); options.push(ip); @@ -104,20 +105,20 @@ function checkTarget() { console.log(program.helpInformation()); return false; } - if (!properties.targets[target]) { + if (!targets.targets[target]) { console.log("The target \""+target+"\" does not exist, to add that target please run target add "+target+" <ip> [-t | --type <device | simulator>] [-p <password>] [--pin <devicepin>]"); console.log(program.helpInformation()); return false; } - if (properties.targets[target].ip) { - ip = properties.targets[target].ip; + if (targets.targets[target].ip) { + ip = targets.targets[target].ip; } else { console.log("IP is not defined in target \""+target+"\""); console.log(program.helpInformation()); return false; } - if (properties.targets[target].password) { - password = properties.targets[target].password; + if (targets.targets[target].password) { + password = targets.targets[target].password; } return true; } @@ -168,8 +169,8 @@ function checkDebugtoken(previous, baton) { baton.take(); // if target has no pin, skip the debug token feature - if (properties.targets[target].pin) { - debugTokenHelper.checkDebugToken(properties.targets[target].pin, function (valid) { + if (targets.targets[target].pin) { + debugTokenHelper.checkDebugToken(targets.targets[target].pin, function (valid) { // If the debug token is not valid, we need create new debug token if (valid) { // No need to create the debug token @@ -186,12 +187,12 @@ function checkDebugtoken(previous, baton) { } function createDebugToken(previous, baton) { - var keystorepass = program["keystorepass"] ? program["keystorepass"] : properties.keystorepass; + var keystorepass = program["keystorepass"] ? program["keystorepass"] : targets.keystorepass; baton.take(); if (needCreateDebugToken) { - debugTokenHelper.createToken(properties, "all", keystorepass, function (code) { + debugTokenHelper.createToken(targets, "all", keystorepass, function (code) { if (code === 0) { // Deploy the debug token if created needDeployDebugToken = true; @@ -209,7 +210,7 @@ function deployDebugToken(previous, baton) { // If in debug build and debug token was created, deploy the debug token and wait until the deployment is finished if (needDeployDebugToken) { - debugTokenHelper.deployToken(properties, target, function () { + debugTokenHelper.deployToken(targets, target, function () { baton.pass(); }); } else { @@ -276,7 +277,7 @@ function exec() { } program.parse(process.argv); - target = program.args[0] ? program.args[0] : properties.defaultTarget; + target = program.args[0] ? program.args[0] : targets.defaultTarget; if (checkTarget()) { if (program.build) {
