cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tim...@apache.org
Subject [1/5] git commit: [CB-4036] - first pass for adding version script
Date Thu, 01 Aug 2013 22:27:00 GMT
Updated Branches:
  refs/heads/versionCheck [created] f716822be


[CB-4036] - first pass for adding version script


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

Branch: refs/heads/versionCheck
Commit: 5607ff8f360f36e79367f5f93a659fff0a1c9183
Parents: 13b6232
Author: Tim Kim <timk@adobe.com>
Authored: Thu Jul 25 14:56:23 2013 -0700
Committer: Tim Kim <timk@adobe.com>
Committed: Thu Aug 1 14:37:48 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/plugin.xml | 10 +++++++---
 src/install.js                       | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5607ff8f/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 62233e3..c29bb8c 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -23,8 +23,12 @@
 
     <name>Engine Choo Choo</name>
 
-    <engines>
-        <engine name="cordova" version=">=2.3.0" />
-    </engines>
+
+    
     
+    <platform name="android" min-sdk-version="1.0.1" min-os-version="9.2.1" />
+    <platform name="blackberry10" min-sdk-version="0.0.1" min-os-version="0.0.1" />
+    <platform name="ios" min-sdk-version="5.1" min-os-version="10.1" />
+    <platform name="wp7" min-sdk-version="0.0.1"/>
+    <platform name="wp8"  min-os-version="0.0.1"/>
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5607ff8f/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 556ac7e..381b6fe 100644
--- a/src/install.js
+++ b/src/install.js
@@ -134,6 +134,35 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir,
opt
         require('../plugman').emit('log', 'Cordova project version not detected (lacks a
./cordova/version script), continuing.');
     }
 
+    // check platform requirements - min sdks/min os version etc
+    var platformMinReqScript = { code: 0, output: { min_os_version: "5.0.0" , min_sdk_version:
"1.0.0" } }; // place holder for now until we have an actual script    
+    if(platformMinReqScript.code === 0){
+        var platformMinOS = plugin_et.findall('./platform[@name="'+platform+'"][@min-os-version]')[0].attrib["min-os-version"];
+        var platformMinSDK = plugin_et.findall('./platform[@name="'+platform+'"][@min-sdk-version]')[0].attrib["min-sdk-version"];
   
+
+        if( platformMinReqScript.output.min_os_version ) {
+            if(semver.satisfies(platformMinReqScript.output.min_os_version, platformMinOS)){
+                // min-os version ok
+            } else {
+                var err = new Error('Plugin doesn\'t support ' + platform + '  minimum os
version.  ' + platform + '  minimum os version: ' + platformMinReqScript.output.min_os_version
+ ', failed version requirement: ' + platformMinOS);
+                if (callback) return callback(err);
+                else throw err;
+            }            
+        }
+
+        if(platformMinReqScript.output.min_sdk_version) {
+            if(semver.satisfies(platformMinReqScript.output.min_sdk_version, platformMinSDK)){
+                // min-sdk version ok
+            } else {
+                var err = new Error('Plugin doesn\'t support ' + platform + '  minimum sdk
version.  ' + platform + '  minimum sdk version: ' + platformMinReqScript.output.min_sdk_version+
', failed version requirement: ' + platformMinSDK);
+                if (callback) return callback(err);
+                else throw err;
+            }                        
+        }
+    } else {
+        require('../plugman').emit('log', 'Cordova project minimum sdk or os version not
detected (lacks a ./cordova/sdkRequirement script), continuing.');
+    }
+    
     // checking preferences, if certain variables are not provided, we should throw.
     prefs = plugin_et.findall('./preference') || [];
     prefs = prefs.concat(plugin_et.findall('./platform[@name="'+platform+'"]/preference'));


Mime
View raw message