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 0CA2810465 for ; Thu, 9 Jan 2014 14:19:39 +0000 (UTC) Received: (qmail 51479 invoked by uid 500); 9 Jan 2014 14:18:01 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 51194 invoked by uid 500); 9 Jan 2014 14:17:50 -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 51090 invoked by uid 99); 9 Jan 2014 14:17: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; Thu, 09 Jan 2014 14:17:44 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D051D8B3648; Thu, 9 Jan 2014 14:17: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: <92b624d2cbe644de85d64eb25b7ad161@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: webworks commit: CB-5741 Send single command for uninstall / install Date: Thu, 9 Jan 2014 14:17:43 +0000 (UTC) Updated Branches: refs/heads/master 048fda118 -> 86e654ca0 CB-5741 Send single command for uninstall / install - Fixes issues with app name / icon persisting in navigator during re-deploy Project: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/commit/86e654ca Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/86e654ca Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/86e654ca Branch: refs/heads/master Commit: 86e654ca0d2f5d5fa3048dfca08a5b9dd7b56867 Parents: 048fda1 Author: Kristoffer Flores Authored: Tue Jan 7 14:00:13 2014 -0500 Committer: Bryan Higgins Committed: Thu Jan 9 09:19:33 2014 -0500 ---------------------------------------------------------------------- .../templates/project/cordova/lib/run-utils.js | 62 ++++++-------------- .../bin/templates/project/cordova/lib/run.js | 6 +- 2 files changed, 19 insertions(+), 49 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/86e654ca/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 5f74615..82bb436 100644 --- a/blackberry10/bin/templates/project/cordova/lib/run-utils.js +++ b/blackberry10/bin/templates/project/cordova/lib/run-utils.js @@ -183,7 +183,7 @@ function handleDebugToken(options, deployTarget, allDone) { } } -function generateDeployOptions(options, deployTarget, uninstall) { +function generateDeployOptions(options, deployTarget) { var deployOptions = [], barPath = pkgrUtils.escapeStringForShell( path.normalize(__dirname + "/../../build/" + @@ -200,20 +200,14 @@ function generateDeployOptions(options, deployTarget, uninstall) { deployOptions.push("-package"); deployOptions.push(barPath); + deployOptions.push("-uninstallApp"); + deployOptions.push("-installApp"); - if (uninstall) { - deployOptions.push("-uninstallApp"); - return deployOptions; - } else { - - deployOptions.push("-installApp"); - - if (options.launch) { - deployOptions.push("-launchApp"); - } - - return deployOptions; + if (options.launch) { + deployOptions.push("-launchApp"); } + + return deployOptions; } function execNativeDeploy(deployOptions, callback) { @@ -236,16 +230,11 @@ _self = { ], callback ); }, - //options looking for are: (launch) Function returns (error || null) - deployToTarget : function (options, deployTarget, callback) { - execNativeDeploy(generateDeployOptions(options, deployTarget, false)); - }, - //options looking for are: (uninstall) Function returns (error || null) - uninstall : function (options, deployTarget, allDone) { + //Function returns (error || null) + install : function (options, deployTarget, allDone) { var script = path.join(process.env.CORDOVA_BBTOOLS, "blackberry-deploy"), args = [ - "-listInstalledApps", "-device", deployTarget.ip ], @@ -253,34 +242,18 @@ _self = { installedAppsOutput, runTasks = []; - if (options.uninstall) { - if (deployTarget.password) { - 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(); - } - } - ]; + if (deployTarget.password) { + args.push("-password", deployTarget.password); } + runTasks = [ + function uninstallInstallLaunchApp (result, done) { + var deployOptions = generateDeployOptions(options, deployTarget); + execNativeDeploy(deployOptions, done); + } + ]; async.waterfall(runTasks, function (err, results) { - //Absorb error for uninstallation allDone(null, deployTarget); } ); @@ -296,7 +269,6 @@ _self = { } else { allDone("No build file exists, please run: build [--debug] [--release] [-k | --keystorepass] [-b | --buildId ] [-p | --params ] [-ll | --loglevel ] "); } - }, //No options needed within function Function returns (error || options, targetName) http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/86e654ca/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 4b4bcba..f60cd14 100755 --- a/blackberry10/bin/templates/project/cordova/lib/run.js +++ b/blackberry10/bin/templates/project/cordova/lib/run.js @@ -33,8 +33,7 @@ function install(deployTarget, done) { installTasks.push(utils.exec.bind(this, buildCmd, buildArgs, {"cwd": projectRootDir})); } - installTasks.push(runUtils.uninstall.bind(this, options, deployTarget), - runUtils.deployToTarget.bind(this, options, deployTarget)); + installTasks.push(runUtils.install.bind(this, options, deployTarget)); async.series(installTasks, done); } @@ -47,10 +46,9 @@ options .option('--devicepass ', 'device password') .option('--target ', 'specifies the target to run the application') .option('--query', 'query on the commandline when a password is needed') - .option('--no-uninstall', 'does not uninstall application from device') .option('--no-launch', 'do not launch the application on device') .option('--no-build', 'deploy the pre-built bar file and skip building') - .on('--help', function () { + .on('--help', function() { console.log(' Examples:'); console.log(''); console.log(" Deploying to a predefined target");