Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 996B918A79 for ; Wed, 8 Jul 2015 01:41:56 +0000 (UTC) Received: (qmail 3111 invoked by uid 500); 8 Jul 2015 01:41:56 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 3069 invoked by uid 500); 8 Jul 2015 01:41:56 -0000 Mailing-List: contact dev-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 dev@cordova.apache.org Received: (qmail 3058 invoked by uid 99); 8 Jul 2015 01:41:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2015 01:41:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D67CCE3AA2; Wed, 8 Jul 2015 01:41:55 +0000 (UTC) From: nikhilkh To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-windows pull request: CB-9283: Add support for Windows 10 ... Content-Type: text/plain Message-Id: <20150708014155.D67CCE3AA2@git1-us-west.apache.org> Date: Wed, 8 Jul 2015 01:41:55 +0000 (UTC) Github user nikhilkh commented on a diff in the pull request: https://github.com/apache/cordova-windows/pull/96#discussion_r34109798 --- Diff: template/cordova/lib/package.js --- @@ -130,58 +145,47 @@ module.exports.findDevice = function (target) { }; // returns array of available devices names -module.exports.listDevices = function () { - return utils.getAppDeployUtils().then(function(appDeployUtils) { - return exec('"' + appDeployUtils + '" /enumeratedevices').then(function(output) { - return Q.resolve(output.split('\n').map(function(line) { - var match = /\s*(\d)+\s+(.*)/.exec(line); - return match && match[2]; - }).filter(function (line) { - return line; - })); +module.exports.listDevices = function (deploymentTool) { + + return deploymentTool.enumerateDevices().then(function(deviceList) { + return deviceList.map(function(device) { + return device.toString(); }); - }); -}; - -function installAppToPhone(appDeployUtils, package, target, update) { - // /installlaunch option sometimes fails with 'Error: The parameter is incorrect.' - // so we use separate steps to /install or /update and then /launch - var cmd = update ? '/update' : '/install'; - console.log('Installing application...'); - return spawn(appDeployUtils, [cmd, package.appx, '/targetdevice:' + target]); -} + }, function(e) { + console.warn('Failed to enumerate devices'); + console.warn(e); -function runAppOnPhone(appDeployUtils, target) { - return Q().then(function() { - return module.exports.getAppId(path.join(__dirname, '..', '..')); - }).then(function(appId) { - console.log('Running application... '); - return spawn(appDeployUtils, ['/launch', appId, '/targetdevice:' + target]); + throw e; }); -} +}; + function uninstallAppFromPhone(appDeployUtils, package, target) { console.log('Attempting to remove previously installed application...'); - return spawn(appDeployUtils, ['/uninstall', package.phoneId, '/targetdevice:' + target]); + return appDeployUtils.uninstallAppPackage(package.phoneId, target); } // deploys specified phone package to device/emulator and launches it -module.exports.deployToPhone = function (package, deployTarget, targetWindows10) { - var getTarget = deployTarget == 'device' ? Q('de') : - deployTarget == 'emulator' ? Q('xd') : module.exports.findDevice(deployTarget); - - return getTarget.then(function(target) { - return utils.getAppDeployUtils(targetWindows10).then(function(appDeployUtils) { +module.exports.deployToPhone = function (package, deployTarget, targetWindows10, deploymentTool) { + var deployment; + if (deploymentTool) { + deployment = Q(deploymentTool); + } + else { + deployment = utils.getAppDeployUtils(targetWindows10); + } - return uninstallAppFromPhone(appDeployUtils, package, target).then( + return deployment.then(function(deploymentTool) { + return module.exports.findDevice(deploymentTool, deployTarget).then(function(target) { + return uninstallAppFromPhone(deploymentTool, package, target).then( function() {}, function() {}).then(function() { - return installAppToPhone(appDeployUtils, package, target, false); - }).then(function() { - return runAppOnPhone(appDeployUtils, target); - }, function(error) { + // shouldUpdate = false because we've already uninstalled + return deploymentTool.installAppPackage(package.appx, target, true, false); + }).then(function() { }, function(error) { + console.dir(error); --- End diff -- should the console.dir be removed? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org