You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/13 01:35:46 UTC
[05/16] git commit: [CB-3904]: platform ls now shows installed and
available platforms.
[CB-3904]: platform ls now shows installed and available platforms.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/66f15d23
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/66f15d23
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/66f15d23
Branch: refs/heads/ffos
Commit: 66f15d23fd783746d2955e080a0aa90b59c8a045
Parents: fd8b2f1
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Sep 3 13:44:51 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue Sep 3 13:46:43 2013 -0400
----------------------------------------------------------------------
src/platform.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/66f15d23/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 06b75cc..fea9a64 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -20,6 +20,7 @@ var config = require('./config'),
cordova_util = require('./util'),
util = require('util'),
fs = require('fs'),
+ os = require('os'),
path = require('path'),
hooker = require('./hooker'),
events = require('./events'),
@@ -137,7 +138,21 @@ module.exports = function platform(command, targets, callback) {
if (callback) callback(err);
else throw err;
} else {
- events.emit('results', (platforms_on_fs.length ? platforms_on_fs : 'No platforms added. Use `cordova platform add <platform>`.'));
+ var results = 'Installed platforms: ' + platforms_on_fs.join(', ') + '\n';
+ var available = ['android', 'blackberry10'];
+ if (os.platform() === 'darwin')
+ available.push('ios');
+ if (os.platform() === 'win32') {
+ available.push('wp7');
+ available.push('wp8');
+ }
+
+ available = available.filter(function(p) {
+ return platforms_on_fs.indexOf(p) < 0; // Only those not already installed.
+ });
+ results += 'Available platforms: ' + available.join(', ');
+
+ events.emit('results', results);
hooks.fire('after_platform_ls', function(err) {
if (err) {
if (callback) callback(err);