You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by js...@apache.org on 2014/10/21 22:14:26 UTC

[1/3] git commit: CB-7033 Improve cordova platform check

Repository: cordova-lib
Updated Branches:
  refs/heads/master fef0ee701 -> 1fc9ba475


CB-7033 Improve cordova platform check

* Report when cordova is out of date


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/1fc9ba47
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/1fc9ba47
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/1fc9ba47

Branch: refs/heads/master
Commit: 1fc9ba475a8e4c600e87ac3349807cbdf69ade15
Parents: 6d34b0e
Author: Josh Soref <js...@blackberry.com>
Authored: Mon Oct 20 20:58:47 2014 -0400
Committer: Josh Soref <js...@blackberry.com>
Committed: Tue Oct 21 16:13:40 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 38 ++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1fc9ba47/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 55a9ca0..ed7d5af 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -201,6 +201,29 @@ function check(hooksRunner, projectRoot) {
         listeners = events._events;
     events._events = {};
     var result = Q.defer();
+    var updateCordova = Q.defer();
+    superspawn.spawn('npm',
+                     ['--loglevel=silent', '--json', 'outdated', 'cordova-lib'],
+                     {cwd: path.dirname(require.main.filename)}
+                    ).then(
+        function (output) {
+            var vers;
+            try {
+                var json = JSON.parse(output)['cordova-lib'];
+                vers = [json.latest, json.current];
+            } catch (e) {
+                vers = ('' || output).match(/cordova-lib@(\S+)\s+\S+\s+current=(\S+)/);
+            }
+            if (vers) {
+                updateCordova.resolve([vers[1], vers[2]]);
+            } else {
+                updateCordova.resolve();
+            }
+        }
+    ).catch(function (){
+        /* oh well */
+        updateCordova.resolve();
+    });
     cordova.raw.create(scratch)
     .then(function () {
         var h = new HooksRunner(scratch);
@@ -266,16 +289,27 @@ function check(hooksRunner, projectRoot) {
             return d.promise;
         })).then(function() {
             var results = '';
+            var resultQ = Q.defer();
             events._events = listeners;
             shell.rm('-rf', scratch);
+            updateCordova.promise.then(function (versions) {
+                var message = '';
+                if (versions && semver.gt(versions[0], versions[1])) {
+                    message = 'An update of cordova is available: ' + versions[0] + '\n';
+                }
+                resultQ.promise.then(function (output) {
+                    var results = message + output;
+                    events.emit('results', results);
+                    result.resolve();
+                });
+            });
             if (platformsText) {
                 results = platformsText.filter(function (p) { return !!p; }).sort().join('\n');
             }
             if (!results) {
                 results = 'No platforms can be updated at this time.';
             }
-            events.emit('results', results);
-            result.resolve();
+            resultQ.resolve(results);
         })
         .done();
     }).catch(function (){


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[3/3] git commit: CB-7033 Improve cordova platform check

Posted by js...@apache.org.
CB-7033 Improve cordova platform check

* Fix spelling of determined


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/638f7788
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/638f7788
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/638f7788

Branch: refs/heads/master
Commit: 638f77883ba578c4633d81154dfc0c46bdaa98e7
Parents: fef0ee7
Author: Josh Soref <js...@blackberry.com>
Authored: Mon Oct 20 21:40:38 2014 -0400
Committer: Josh Soref <js...@blackberry.com>
Committed: Tue Oct 21 16:13:40 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/638f7788/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index 85eda0a..b7fde87 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -240,13 +240,13 @@ function check(hooksRunner, projectRoot) {
                 var m, prefix = p + ' @ ' + (v || 'unknown');
                 switch (avail) {
                 case 'install-failed':
-                    m = prefix + '; current did not install, and thus its version cannot be deterimined';
+                    m = prefix + '; current did not install, and thus its version cannot be determined';
                     break;
                 case 'version-failed':
-                    m = prefix + '; current version script failed, and thus its version cannot be deterimined';
+                    m = prefix + '; current version script failed, and thus its version cannot be determined';
                     break;
                 case 'version-empty':
-                    m = prefix + '; current version script failed to return a version, and thus its version cannot be deterimined';
+                    m = prefix + '; current version script failed to return a version, and thus its version cannot be determined';
                     break;
                 default:
                     if (!v || v === 'broken' || semver.gt(avail, v)) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/3] git commit: CB-7033 Improve cordova platform check

Posted by js...@apache.org.
CB-7033 Improve cordova platform check

* Make a softer statement about up-to-date status


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/6d34b0e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/6d34b0e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/6d34b0e5

Branch: refs/heads/master
Commit: 6d34b0e5e67c1b23e457e15cd3e260fce5f34e92
Parents: 638f778
Author: Josh Soref <js...@blackberry.com>
Authored: Mon Oct 20 20:58:05 2014 -0400
Committer: Josh Soref <js...@blackberry.com>
Committed: Tue Oct 21 16:13:40 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/6d34b0e5/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js b/cordova-lib/src/cordova/platform.js
index b7fde87..55a9ca0 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -272,7 +272,7 @@ function check(hooksRunner, projectRoot) {
                 results = platformsText.filter(function (p) { return !!p; }).sort().join('\n');
             }
             if (!results) {
-                results = 'All platforms are up-to-date.';
+                results = 'No platforms can be updated at this time.';
             }
             events.emit('results', results);
             result.resolve();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org