CB-7045 plugman.install: engine.currentVersion should be a semver or null

not ""


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

Branch: refs/heads/master
Commit: 56276ef3e4d407bdd9c1212f5d75b267ede0530d
Parents: 864a2fe
Author: Josh Soref <[email protected]>
Authored: Fri Jun 27 16:39:55 2014 -0400
Committer: Josh Soref <[email protected]>
Committed: Fri Jun 27 16:47:30 2014 -0400

----------------------------------------------------------------------
 cordova-lib/spec-plugman/install.spec.js | 6 +++---
 cordova-lib/src/plugman/install.js       | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/56276ef3/cordova-lib/spec-plugman/install.spec.js
----------------------------------------------------------------------
diff --git a/cordova-lib/spec-plugman/install.spec.js 
b/cordova-lib/spec-plugman/install.spec.js
index 74e7e0d..ed9b828 100644
--- a/cordova-lib/spec-plugman/install.spec.js
+++ b/cordova-lib/spec-plugman/install.spec.js
@@ -286,10 +286,10 @@ describe('install', function() {
                 var plugmanVersion = require('../package.json').version;
 
                 expect(spy.calls.length).toBe(4);
-                expect(spy.calls[0].args).toEqual([ '', '>=2.3.0' ]);
+                expect(spy.calls[0].args).toEqual([ null, '>=2.3.0' ]);
                 expect(spy.calls[1].args).toEqual([ plugmanVersion, '>=0.10.0' 
]);
-                expect(spy.calls[2].args).toEqual([ '', '>=1.0.0' ]);
-                expect(spy.calls[3].args).toEqual([ '', '>=3.0.0' ]);
+                expect(spy.calls[2].args).toEqual([ null, '>=1.0.0' ]);
+                expect(spy.calls[3].args).toEqual([ null, '>=3.0.0' ]);
             });
         });
         it('should not check custom engine version that is not supported for 
platform', function() {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/56276ef3/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js 
b/cordova-lib/src/plugman/install.js
index e17f941..ed86855 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -177,6 +177,10 @@ function callEngineScripts(engines) {
                         engine.currentVersion = null;
                     } else {
                         engine.currentVersion = cleanVersionOutput(stdout, 
engine.name);
+                        if (engine.currentVersion === "") {
+                            events.emit('warn', engine.name +' version check 
returned nothing ('+ scriptPath +'), continuing anyways.');
+                            engine.currentVersion = null;
+                        }
                     }
 
                     d.resolve(engine);

Reply via email to