cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: 0.7.14. Fixed [CB-3943]: dont error out <engine> element checking if version script fails.
Date Thu, 20 Jun 2013 16:26:06 GMT
Updated Branches:
  refs/heads/master 962317b22 -> 79d1cf652


0.7.14. Fixed [CB-3943]: dont error out <engine> element checking if version script
fails.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/79d1cf65
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/79d1cf65
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/79d1cf65

Branch: refs/heads/master
Commit: 79d1cf652b66b3fd0c543fbab1b331ccbe7557a9
Parents: 962317b
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Jun 20 09:26:00 2013 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Jun 20 09:26:00 2013 -0700

----------------------------------------------------------------------
 package.json   |  2 +-
 src/install.js | 40 ++++++++++++++++------------------------
 2 files changed, 17 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/79d1cf65/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 7b4dafa..fe62338 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Andrew Lunny <alunny@gmail.com>",
   "name": "plugman",
   "description": "install/uninstall Cordova plugins",
-  "version": "0.7.13",
+  "version": "0.7.14",
   "repository": {
     "type": "git",
     "url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/79d1cf65/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 461549c..37f09c8 100644
--- a/src/install.js
+++ b/src/install.js
@@ -75,41 +75,33 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir,
opt
     
     // checking engine 
     // will there be a case for multiple engine support?
-    
     var versionPath = path.join(project_dir, 'cordova', 'version');
     if (fs.existsSync(versionPath)) {
-        
         // need to rethink this so I don't have to chmod anything
         fs.chmodSync(versionPath, '755');
         var versionScript = shell.exec(versionPath, {silent: true});
-        
-        var engines = plugin_et.findall('engines/engine');
-        engines.forEach(function(engine){
-            if(engine.attrib["name"].toLowerCase() === "cordova"){
-                var engineVersion = engine.attrib["version"];
-                if(versionScript.code>0){
-                    var err = new Error('Failed to identify Cordova version: ' + versionPath
+ '\n' + versionScript.output);
-                    if (callback) callback(err);
-                    else throw err;
-                }else{
+        // Only check cordova version if the version script was successful.
+        if (versionScript.code === 0) {
+            var engines = plugin_et.findall('engines/engine');
+            engines.forEach(function(engine){
+                if(engine.attrib["name"].toLowerCase() === "cordova"){
+                    var engineVersion = engine.attrib["version"];
                     // clean only versionScript.output since semver.clean strips out 
                     // the gt and lt operators
-                    if(versionScript.output.trim() === 'dev' || semver.satisfies(semver.clean(versionScript.output),
engineVersion)){
+                    var current_version = versionScript.output.trim();
+                    if(current_version === 'dev' || semver.satisfies(semver.clean(current_version),
engineVersion)){
                         // engine ok!
-                    
-                    }else{
-                        var err = new Error('Plugin doesn\'t support Cordova version. Check
plugin.xml');
-                    if (callback) callback(err);
+                    } else {
+                        var err = new Error('Plugin doesn\'t support this project\'s Cordova
version. Project version: ' + current_version + ', failed version requirement: ' + engineVersion);
+                        if (callback) return callback(err);
                         else throw err; 
                     }
+                } else {
+                    // check for other engines? worklight phonegap etc
                 }
-            } else {
-                // check for other engines?
-            }
-        });
-    } 
-    else
-    {
+            });
+        }
+    } else {
         console.log('Warning: cordova version not detected. installing anyway.');
     }
 


Mime
View raw message