You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by br...@apache.org on 2013/09/19 17:14:30 UTC
git commit: Add version numbers to `platform ls` output.
Updated Branches:
refs/heads/master 69479bcda -> a43d946fb
Add version numbers to `platform ls` output.
Forgive me father, for I have sinned: I have used shelljs.exec's
synchronous version. I will atone by converting this to promises on the
async branch.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/a43d946f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/a43d946f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/a43d946f
Branch: refs/heads/master
Commit: a43d946fb6cf5bf649e880f8a047458e76528d0c
Parents: 69479bc
Author: Braden Shepherdson <br...@gmail.com>
Authored: Thu Sep 19 11:13:27 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Thu Sep 19 11:13:27 2013 -0400
----------------------------------------------------------------------
spec/platform.spec.js | 3 ++-
src/platform.js | 15 +++++++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a43d946f/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/platform.spec.js b/spec/platform.spec.js
index 198015e..17915ee 100644
--- a/spec/platform.spec.js
+++ b/spec/platform.spec.js
@@ -67,7 +67,8 @@ describe('platform command', function() {
cb();
});
exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) {
- cb(0, '');
+ if (cb) cb(0, '');
+ else return { code: 0, output: '' };
});
prep_spy = spyOn(cordova, 'prepare').andCallFake(function(t, cb) {
cb();
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a43d946f/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 214c78d..e39a6be 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -150,8 +150,19 @@ module.exports = function platform(command, targets, callback) {
if (callback) callback(err);
else throw err;
} else {
- var results = 'Installed platforms: ' + platforms_on_fs.join(', ') + '\n';
- var available = ['android', 'blackberry10'];
+ // Acquire the version number of each platform we have installed, and output that too.
+ var platformsText = platforms_on_fs.map(function(p) {
+ var script = path.join(projectRoot, 'platforms', p, 'cordova', 'version');
+ var result = shell.exec(script, { silent: true, async: false });
+ if (result.code > 0 || !result.output) {
+ return p; // Unknown version number, so output without it.
+ } else {
+ return p + ' ' + result.output.trim();
+ }
+ });
+
+ var results = 'Installed platforms: ' + platformsText.join(', ') + '\n';
+ var available = ['android', 'blackberry10', 'firefoxos'];
if (os.platform() === 'darwin')
available.push('ios');
if (os.platform() === 'win32') {