Repository: cordova-windows Updated Branches: refs/heads/master 70d8a7e86 -> 070ce90b3
CB-7617 partial match support for --target Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/2750cf01 Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/2750cf01 Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/2750cf01 Branch: refs/heads/master Commit: 2750cf018faacdb85bf01fa2be3679369a1fe02e Parents: 27c5ab8 Author: sgrebnov <[email protected]> Authored: Wed Sep 24 20:42:23 2014 +0400 Committer: sgrebnov <[email protected]> Committed: Wed Sep 24 20:42:23 2014 +0400 ---------------------------------------------------------------------- windows/template/cordova/lib/package.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/2750cf01/windows/template/cordova/lib/package.js ---------------------------------------------------------------------- diff --git a/windows/template/cordova/lib/package.js b/windows/template/cordova/lib/package.js index ad609ed..20c0e2a 100644 --- a/windows/template/cordova/lib/package.js +++ b/windows/template/cordova/lib/package.js @@ -107,9 +107,13 @@ module.exports.getPackageName = function (platformPath) { module.exports.findDevice = function (target) { target = target.toLowerCase(); return module.exports.listDevices().then(function(deviceList) { - for (var idx in deviceList){ - if (deviceList[idx].toLowerCase() == target) { - return Q.resolve(idx); + // CB-7617 since we use partial match shorter names should go first, + // example case is ['Emulator 8.1 WVGA 4 inch 512MB', 'Emulator 8.1 WVGA 4 inch'] + var sortedList = deviceList.concat().sort(function (l, r) { return l.length > r.length; }); + for (var idx in sortedList){ + if (sortedList[idx].toLowerCase().indexOf(target) > -1) { + // we should return index based on original list + return Q.resolve(deviceList.indexOf(sortedList[idx])); } } return Q.reject('Specified device not found'); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
