cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [08/40] git commit: [CB-4036] - fixed up some failing tests
Date Thu, 12 Sep 2013 18:14:36 GMT
[CB-4036] - fixed up some failing tests


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

Branch: refs/heads/ffos
Commit: 5504bc2ef4b68c70e02189940232234df898bbdc
Parents: d6ac577
Author: Tim Kim <timk@adobe.com>
Authored: Thu Aug 1 14:18:59 2013 -0700
Committer: Tim Kim <timk@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 spec/engine.spec.js                  | 55 -------------------------------
 spec/plugins/EnginePlugin/plugin.xml | 10 ++----
 src/install.js                       | 17 ++++++----
 3 files changed, 14 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5504bc2e/spec/engine.spec.js
----------------------------------------------------------------------
diff --git a/spec/engine.spec.js b/spec/engine.spec.js
deleted file mode 100644
index 89a7f9e..0000000
--- a/spec/engine.spec.js
+++ /dev/null
@@ -1,55 +0,0 @@
-var install = require('../src/install'),
-    actions = require('../src/util/action-stack'),
-    config_changes = require('../src/util/config-changes'),
-    xml_helpers = require('../src/util/xml-helpers'),
-    plugman = require('../plugman'),
-    fs      = require('fs'),
-    os      = require('osenv'),
-    path    = require('path'),
-    shell   = require('shelljs'),
-    semver  = require('semver'),
-    temp    = __dirname,
-    dummyplugin = 'DummyPlugin',
-    dummy_id = 'com.phonegap.plugins.dummyplugin',
-    variableplugin = 'VariablePlugin',
-    engineplugin = 'EnginePlugin',
-    childplugin = 'ChildBrowser',
-    plugins_dir = path.join(temp, 'plugins');
-
-describe('install', function() {
-    var exists, get_json, chmod, exec, proc, add_to_queue, prepare, actions_push, c_a, mkdir;
-    beforeEach(function() {
-        proc = spyOn(actions.prototype, 'process').andCallFake(function(platform, proj, cb)
{
-            cb();
-        });
-        mkdir = spyOn(shell, 'mkdir');
-        actions_push = spyOn(actions.prototype, 'push');
-        c_a = spyOn(actions.prototype, 'createAction');
-        prepare = spyOn(plugman, 'prepare');
-        exec = spyOn(shell, 'exec').andReturn({code:1});
-        chmod = spyOn(fs, 'chmodSync');
-        exists = spyOn(fs, 'existsSync').andReturn(true);
-        get_json = spyOn(config_changes, 'get_platform_json').andReturn({
-            installed_plugins:{},
-            dependent_plugins:{}
-        });
-        add_to_queue = spyOn(config_changes, 'add_installed_plugin_to_prepare_queue');
-    });
-    describe('success', function() {
-        it('should check version if plugin has engine tag', function(){
-            var spy = spyOn(semver, 'satisfies').andReturn(true);
-            install('android', temp, 'engineplugin', plugins_dir, {});
-            expect(spy).toHaveBeenCalledWith('5.0.0','9.2.1');
-        });
-        
-        /*
-        it('should check version and munge it a little if it has "rc" in it so it plays nice
with semver (introduce a dash in it)', function() {
-            var spy = spyOn(semver, 'satisfies').andReturn(true);
-            exec.andReturn({code:0,output:"3.0.0rc1"});
-            install('android', temp, 'engineplugin', plugins_dir, {});
-            expect(spy).toHaveBeenCalledWith('3.0.0-rc1','>=2.3.0');
-        });
-        */
-    });
-
-});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5504bc2e/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index c29bb8c..62233e3 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -23,12 +23,8 @@
 
     <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/5504bc2e/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index a02e8f6..7ef27ad 100644
--- a/src/install.js
+++ b/src/install.js
@@ -110,7 +110,7 @@ function getCurrentProjectVersion(versionPath, platformPath) {
     if (fs.existsSync(versionPath)) {   
         var versionScript = shell.exec(versionPath, {silent: true});
         if (versionScript.code === 0) {
-            cordovaVersion = cordovaVersion.output.trim();
+            cordovaVersion = versionScript.output.trim();
             var rc_index = cordovaVersion.indexOf('rc');
             if (rc_index > -1) {
                 cordovaVersion = cordovaVersion.substr(0, rc_index) + '-' + cordovaVersion.substr(rc_index);
@@ -142,7 +142,8 @@ function getCurrentProjectVersion(versionPath, platformPath) {
     return { 'cordovaVersion' : cordovaVersion, 'platformInfo' : platformInfo };
 }
 
-function getMinReq(pluginElement){
+function getMinReq(pluginElement, platform){
+
     var cordovaMinVersion, platformMinOS, platformMinSDK;
     
     var engines = pluginElement.findall('engines/engine');
@@ -153,9 +154,13 @@ function getMinReq(pluginElement){
                     // check for other engines - if found, shove the info into return statement

                 }
             });
-            
-    platformMinOS = plugin_et.findall('./platform[@name="'+platform+'"][@min-os-version]')[0].attrib["min-os-version"];
-    platformMinSDK = plugin_et.findall('./platform[@name="'+platform+'"][@min-sdk-version]')[0].attrib["min-sdk-version"];
+    
+    
+    platformMinOS = pluginElement.findall('./platform[@name="'+platform+'"][@min-os-version]');
+    platformMinOS = platformMinOS[0] ? platformMinOS[0].attrib["min-os-version"] : null
+
+    platformMinSDK = pluginElement.findall('./platform[@name="'+platform+'"][@min-sdk-version]');
+    platformMinSDK = platformMinSDK[0] ? platformMinSDK[0].attrib["min-sdk-version"] : null;
     
     return { 'cordovaMinVersion': cordovaMinVersion, 'platformMinOS' : platformMinOS, 'platformMinSDK'
: platformMinSDK };
 }
@@ -199,7 +204,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir,
opt
     var platformPath = path.join(project_dir, 'cordova', 'platformReq');
     
     var currentProjectInfo = getCurrentProjectVersion(versionPath, platformPath);
-    var minRequirements = getMinReq(plugin_et);
+    var minRequirements = getMinReq(plugin_et, platform);
     
     checkMinimumReq(currentProjectInfo, minRequirements, platform, callback);
     


Mime
View raw message