You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/12 20:14:40 UTC
[12/40] git commit: [CB-4036] - fixed custom engine loading and added
test
[CB-4036] - fixed custom engine loading and added test
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/8ed43948
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/8ed43948
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/8ed43948
Branch: refs/heads/ffos
Commit: 8ed43948e7877e89111ae2ab63f4520485fae24c
Parents: c23d328
Author: Tim Kim <ti...@adobe.com>
Authored: Fri Aug 23 16:05:44 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:17 2013 -0700
----------------------------------------------------------------------
spec/install.spec.js | 5 +++++
spec/plugins/EnginePlugin/plugin.xml | 1 +
src/install.js | 10 ++++------
3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8ed43948/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 97e8f1d..325c8e8 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -91,6 +91,11 @@ describe('install', function() {
install('android', temp, 'engineplugin', plugins_dir, {});
expect(spy).toHaveBeenCalledWith(null,'>=0.10.0');
});
+ it('should check custom engine version', function() {
+ var spy = spyOn(semver, 'satisfies').andReturn(true);
+ install('android', temp, 'engineplugin', plugins_dir, {});
+ expect(spy).toHaveBeenCalledWith(null,'>=100');
+ });
it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
install('android', temp, dummyplugin, plugins_dir, {});
expect(actions_push.calls.length).toEqual(3);
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8ed43948/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 4d9332f..aef8225 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -26,6 +26,7 @@
<engines>
<engine name="cordova" version=">=2.3.0"/>
<engine name="cordova-plugman" version=">=0.10.0" />
+ <engine name="mega-fun-plugin" version=">=100" scriptSrc="megaFunVesion" platform="*" />
</engines>
</plugin>
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8ed43948/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index bb3a2e2..92d7d9d 100644
--- a/src/install.js
+++ b/src/install.js
@@ -125,10 +125,11 @@ function getEngines(pluginElement, platform, project_dir){
var engines = pluginElement.findall('engines/engine');
var defaultEngines = require('./util/default-engines')(project_dir);
var uncheckedEngines = [];
- var tempEngine, cordovaEngineIndex, cordovaPlatformEngineIndex, theName;
+ var cordovaEngineIndex, cordovaPlatformEngineIndex, theName;
// load in known defaults and update when necessary
engines.forEach(function(engine){
theName = engine.attrib["name"];
+ // check to see if the engine is listed as a default engine
if(defaultEngines[theName] && (defaultEngines[theName].platform === platform || defaultEngines[theName].platform === '*')){
defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib["version"];
defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
@@ -140,12 +141,9 @@ function getEngines(pluginElement, platform, project_dir){
if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
uncheckedEngines.push(defaultEngines[theName]);
-
+ // check for other engines
}else if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
- // check for other engines
- tempEngine = {};
- tempEngine[theName] = { 'platform': engine.attrib["platform"], 'scriptSrc':engine.attrib["scriptSrc"], 'minVersion' : engine.attrib["version"]};
- uncheckedEngines.push(tempEngine);
+ uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':engine.attrib["scriptSrc"], 'minVersion' : engine.attrib["version"]});
}
});