[CB-3646] - fixed custom engine src script not being properly set
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/d83ce8e6 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d83ce8e6 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d83ce8e6 Branch: refs/heads/master Commit: d83ce8e61de543542eba928cdf4cb268fdea810c Parents: 8ed4394 Author: Tim Kim <[email protected]> Authored: Mon Aug 26 14:51:41 2013 -0700 Committer: Tim Kim <[email protected]> Committed: Mon Aug 26 16:47:18 2013 -0700 ---------------------------------------------------------------------- spec/install.spec.js | 2 +- spec/plugins/EnginePlugin/megaFunVersion | 23 +++++++++++++++++++++++ spec/plugins/EnginePlugin/plugin.xml | 2 +- src/install.js | 8 ++++---- 4 files changed, 29 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d83ce8e6/spec/install.spec.js ---------------------------------------------------------------------- diff --git a/spec/install.spec.js b/spec/install.spec.js index 325c8e8..ccee749 100644 --- a/spec/install.spec.js +++ b/spec/install.spec.js @@ -94,7 +94,7 @@ describe('install', function() { 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'); + expect(spy).toHaveBeenCalledWith(null,'>=1.0.0'); }); it('should queue up actions as appropriate for that plugin and call process on the action stack', function() { install('android', temp, dummyplugin, plugins_dir, {}); http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d83ce8e6/spec/plugins/EnginePlugin/megaFunVersion ---------------------------------------------------------------------- diff --git a/spec/plugins/EnginePlugin/megaFunVersion b/spec/plugins/EnginePlugin/megaFunVersion new file mode 100755 index 0000000..1e4c706 --- /dev/null +++ b/spec/plugins/EnginePlugin/megaFunVersion @@ -0,0 +1,23 @@ +#! /bin/sh + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +echo 1.0.0 +exit 0 \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d83ce8e6/spec/plugins/EnginePlugin/plugin.xml ---------------------------------------------------------------------- diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml index aef8225..a855d1b 100644 --- a/spec/plugins/EnginePlugin/plugin.xml +++ b/spec/plugins/EnginePlugin/plugin.xml @@ -26,7 +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="*" /> + <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" /> </engines> </plugin> http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d83ce8e6/src/install.js ---------------------------------------------------------------------- diff --git a/src/install.js b/src/install.js index 92d7d9d..13599e5 100644 --- a/src/install.js +++ b/src/install.js @@ -67,7 +67,7 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options, function checkEngines(engines, callback) { engines.forEach(function(engine){ - if(semver.satisfies(engine.currentVersion, engine.minVersion || engine.currentVersion == null)){ + if(semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion == null){ // engine ok! }else{ var err = new Error('Plugin doesn\'t support this project\'s '+engine.name+' version. '+engine.name+': ' + engine.currentVersion + ', failed version requirement: ' + engine.minVersion); @@ -121,7 +121,7 @@ function callEngineScripts(engines) { } // return only the engines we care about/need -function getEngines(pluginElement, platform, project_dir){ +function getEngines(pluginElement, platform, project_dir, plugin_dir){ var engines = pluginElement.findall('engines/engine'); var defaultEngines = require('./util/default-engines')(project_dir); var uncheckedEngines = []; @@ -143,7 +143,7 @@ function getEngines(pluginElement, platform, project_dir){ uncheckedEngines.push(defaultEngines[theName]); // check for other engines }else if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){ - uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':engine.attrib["scriptSrc"], 'minVersion' : engine.attrib["version"]}); + uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':path.resolve(plugin_dir, engine.attrib["scriptSrc"]), 'minVersion' : engine.attrib["version"]}); } }); @@ -182,7 +182,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt return; } - var theEngines = getEngines(plugin_et, platform, project_dir); + var theEngines = getEngines(plugin_et, platform, project_dir, plugin_dir); theEngines = callEngineScripts(theEngines); checkEngines(theEngines, callback);
