You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/03/31 20:22:56 UTC
git commit: CB-6322 Simplify platforms/platform code for platform
specifics
Repository: cordova-cli
Updated Branches:
refs/heads/master 6a3fbf151 -> c91e52c25
CB-6322 Simplify platforms/platform code for platform specifics
github: close #146
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/c91e52c2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/c91e52c2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/c91e52c2
Branch: refs/heads/master
Commit: c91e52c25a6eb4070460dbcd0931890461271168
Parents: 6a3fbf1
Author: Josh Soref <js...@blackberry.com>
Authored: Thu Mar 20 17:24:40 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Mar 31 14:20:15 2014 -0400
----------------------------------------------------------------------
platforms.js | 6 ++++++
src/platform.js | 23 ++++++++++++-----------
2 files changed, 18 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c91e52c2/platforms.js
----------------------------------------------------------------------
diff --git a/platforms.js b/platforms.js
index 79f404a..e7a7535 100644
--- a/platforms.js
+++ b/platforms.js
@@ -19,6 +19,7 @@
module.exports = {
'ios' : {
+ hostos : ['darwin'],
parser : './src/metadata/ios_parser',
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-ios.git',
version: '3.4.0'
@@ -29,6 +30,7 @@ module.exports = {
version: '3.4.0'
},
'ubuntu' : {
+ hostos : ['linux'],
parser : './src/metadata/ubuntu_parser',
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-ubuntu.git',
version: '3.4.0'
@@ -39,12 +41,14 @@ module.exports = {
version: '3.4.0'
},
'wp7' : {
+ hostos : ['win32'],
parser : './src/metadata/wp7_parser',
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git',
version: '3.4.0',
subdirectory: 'wp7'
},
'wp8' : {
+ hostos : ['win32'],
parser : './src/metadata/wp8_parser',
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-wp8.git',
version: '3.4.0',
@@ -57,6 +61,7 @@ module.exports = {
subdirectory: 'blackberry10'
},
'www':{
+ hostos : [],
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-app-hello-world.git',
version: '3.4.0'
},
@@ -66,6 +71,7 @@ module.exports = {
version: '3.4.0'
},
'windows8':{
+ hostos : ['win32'],
parser: './src/metadata/windows8_parser',
url : 'https://git-wip-us.apache.org/repos/asf?p=cordova-windows.git',
version: '3.4.0',
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c91e52c2/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index bd439b5..b932df9 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -222,21 +222,22 @@ function list(hooks, projectRoot) {
}));
}).then(function(platformsText) {
var results = 'Installed platforms: ' + platformsText.join(', ') + '\n';
- var available = ['android', 'blackberry10', 'firefoxos'];
- if (process.platform === 'darwin')
- available.push('ios');
- if (process.platform.slice(0, 3) === 'win') {
- available.push('wp7');
- available.push('wp8');
- available.push('windows8');
- }
- if (process.platform === 'linux')
- available.push('ubuntu');
+ var available = Object.getOwnPropertyNames(platforms).filter(function(p) {
+ var platform = platforms[p] || {},
+ hostos = platform.hostos || null;
+ if (!hostos)
+ return true;
+ if (hostos.indexOf('*') >= 0)
+ return true;
+ if (hostos.indexOf(process.platform) >= 0)
+ return true;
+ return false;
+ });
available = available.filter(function(p) {
return platforms_on_fs.indexOf(p) < 0; // Only those not already installed.
});
- results += 'Available platforms: ' + available.join(', ');
+ results += 'Available platforms: ' + available.sort().join(', ');
events.emit('results', results);
}).then(function() {