You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2013/05/17 23:47:32 UTC

[3/3] git commit: [CB-3234] - first pass at implementing engine tag

[CB-3234] - first pass at implementing engine tag


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

Branch: refs/heads/engine
Commit: eb363bee2e667115cdeacd8a6d34bccb83c4b23f
Parents: 8b99d7c
Author: Tim Kim <ti...@adobe.com>
Authored: Fri May 17 14:47:20 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Fri May 17 14:47:20 2013 -0700

----------------------------------------------------------------------
 package.json                                       |    3 +-
 spec/install.spec.js                               |   15 +-
 spec/plugins/EnginePlugin/plugin.xml               |   30 +
 spec/projects/android_one/assets/www/cordova.js    | 6848 +++++++++++++++
 spec/projects/android_one/cordova/appinfo.jar      |  Bin 0 -> 1574 bytes
 spec/projects/android_one/cordova/build            |   23 +
 spec/projects/android_one/cordova/clean            |   23 +
 spec/projects/android_one/cordova/lib/cordova      |  386 +
 .../android_one/cordova/lib/install-device         |   23 +
 .../android_one/cordova/lib/install-emulator       |   23 +
 spec/projects/android_one/cordova/lib/list-devices |   23 +
 .../android_one/cordova/lib/list-emulator-images   |   23 +
 .../android_one/cordova/lib/list-started-emulators |   23 +
 .../android_one/cordova/lib/start-emulator         |   23 +
 spec/projects/android_one/cordova/log              |   23 +
 spec/projects/android_one/cordova/run              |   23 +
 spec/projects/android_one/cordova/version          |   32 +
 src/install.js                                     |   35 +
 18 files changed, 7576 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eb363bee/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 2dfe157..cdb8efb 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
     "plist": "0.4.x",
     "bplist-parser": "0.0.x",
     "shelljs": "0.1.x",
-    "osenv": "0.0.x"
+    "osenv": "0.0.x",
+    "semver": "1.x.x"
   },
   "devDependencies": {
     "jasmine-node": "1.7.0"

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eb363bee/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index c471747..3f641bc 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -1,5 +1,6 @@
 var install = require('../src/install'),
     android = require('../src/platforms/android'),
+    blackberry = require('../src/platforms/blackberry'),
     common = require('../src/platforms/common'),
     //ios     = require('../src/platforms/ios'),
     //blackberry = require('../src/platforms/blackberry'),
@@ -9,13 +10,15 @@ var install = require('../src/install'),
     os      = require('osenv'),
     path    = require('path'),
     shell   = require('shelljs'),
+    semver  = require('semver'),
     temp    = path.join(os.tmpdir(), 'plugman'),
     childbrowser = path.join(__dirname, 'plugins', 'ChildBrowser'),
     dummyplugin = path.join(__dirname, 'plugins', 'DummyPlugin'),
     variableplugin = path.join(__dirname, 'plugins', 'VariablePlugin'),
     faultyplugin = path.join(__dirname, 'plugins', 'FaultyPlugin'),
+    engineplugin = path.join(__dirname, 'plugins','EnginePlugin'),
     android_one_project = path.join(__dirname, 'projects', 'android_one', '*');
-    //blackberry_project = path.join(__dirname, 'projects', 'blackberry', '*');
+    blackberry_project = path.join(__dirname, 'projects', 'blackberry', '*');
     //ios_project = path.join(__dirname, 'projects', 'ios-config-xml', '*');
     plugins_dir = path.join(temp, 'cordova', 'plugins');
 
@@ -138,8 +141,14 @@ describe('install', function() {
             android_installer.mostRecentCall.args[5](null); // fake out handler install callback
             expect(spy).toHaveBeenCalledWith(plugins_dir, 'DummyPlugin', 'android', {});
         });
+        it('should check version if plugin has engine tag', function(){
+            shell.cp('-rf', engineplugin, plugins_dir);
+            var spy = spyOn(semver, 'satisfies').andCallThrough();
+            install('android', temp, 'engineplugin', plugins_dir, {});
+            expect(spy).toHaveBeenCalledWith('2.7.0rc1', '>=2.3.0');
+        });
     });
-
+    
     describe('failure', function() {
         it('should throw if asset target already exists', function() {
             shell.cp('-rf', dummyplugin, plugins_dir);
@@ -194,5 +203,7 @@ describe('install', function() {
             expect(fs.existsSync(path.join(temp, 'assets', 'www', 'dummyplugin.js'))).toBe(false);
             expect(fs.existsSync(path.join(temp, 'assets', 'www', 'dummyplugin'))).toBe(false);
         });
+        if('should throw if cordova version isn\'t high enough', function(){
+        });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eb363bee/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
new file mode 100644
index 0000000..62233e3
--- /dev/null
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed 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.
+
+-->
+
+<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
+    xmlns="http://www.phonegap.com/ns/plugins/1.0"
+    id="com.cordova.engine"
+    version="1.0.0">
+
+    <name>Engine Choo Choo</name>
+
+    <engines>
+        <engine name="cordova" version=">=2.3.0" />
+    </engines>
+    
+</plugin>