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:29 UTC

[01/40] git commit: [CB-4036] - added test file for checking engine and versions

Updated Branches:
  refs/heads/ffos 6825c2b17 -> 6980f182c


[CB-4036] - added test file for checking engine and versions


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

Branch: refs/heads/ffos
Commit: 59ff79e015acf92a2786edab61615a4e4045b966
Parents: 42056f9
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Jul 25 15:00:20 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:15 2013 -0700

----------------------------------------------------------------------
 spec/engine.spec.js | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/59ff79e0/spec/engine.spec.js
----------------------------------------------------------------------
diff --git a/spec/engine.spec.js b/spec/engine.spec.js
new file mode 100644
index 0000000..89a7f9e
--- /dev/null
+++ b/spec/engine.spec.js
@@ -0,0 +1,55 @@
+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');
+        });
+        */
+    });
+
+});


[33/40] git commit: [CB-4793] Lazily require modules in plugin.js

Posted by st...@apache.org.
[CB-4793] Lazily require modules in plugin.js

Cuts ~350ms off of many commands on my MBP.


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

Branch: refs/heads/ffos
Commit: b5ba62d8225e8b00c45f11e288e041a073f3f323
Parents: 6486e7f
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 11 14:54:28 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 11 14:55:14 2013 -0400

----------------------------------------------------------------------
 plugman.js | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b5ba62d8/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 4ca7846..b9748ac 100755
--- a/plugman.js
+++ b/plugman.js
@@ -21,24 +21,29 @@
 
 var emitter = require('./src/events');
 
+function addProperty(o, symbol, modulePath) {
+    Object.defineProperty(o, symbol, {
+        get : function() { return require(modulePath); }});
+}
+
 plugman = {
-    help:               require('./src/help'),
-    install:            require('./src/install'),
-    uninstall:          require('./src/uninstall'),
-    fetch:              require('./src/fetch'),
-    prepare:            require('./src/prepare'),
-    config:             require('./src/config'), 
-    adduser:            require('./src/adduser'),
-    publish:            require('./src/publish'),
-    unpublish:          require('./src/unpublish'),
-    search:             require('./src/search'),
-    info:               require('./src/info'),
-    config_changes:     require('./src/util/config-changes'),
     on:                 emitter.addListener,
     off:                emitter.removeListener,
     removeAllListeners: emitter.removeAllListeners,
     emit:               emitter.emit
 };
+addProperty(plugman, 'help', './src/help');
+addProperty(plugman, 'install', './src/install');
+addProperty(plugman, 'uninstall', './src/uninstall');
+addProperty(plugman, 'fetch', './src/fetch');
+addProperty(plugman, 'prepare', './src/prepare');
+addProperty(plugman, 'config', './src/config');
+addProperty(plugman, 'adduser', './src/adduser');
+addProperty(plugman, 'publish', './src/publish');
+addProperty(plugman, 'unpublish', './src/unpublish');
+addProperty(plugman, 'search', './src/search');
+addProperty(plugman, 'info', './src/info');
+addProperty(plugman, 'config_changes', './src/util/config-changes');
 
 plugman.commands =  {
     'config'   : function(cli_opts) {


[14/40] git commit: [CB-4036] - forgot to add test file

Posted by st...@apache.org.
[CB-4036] - forgot to add test file


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

Branch: refs/heads/ffos
Commit: 6e76e3a5bfdc4407aa6b32b53188e8c3a54f7be0
Parents: 2e03e73
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Aug 26 16:32:44 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:18 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/megaBoringVersion | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/6e76e3a5/spec/plugins/EnginePlugin/megaBoringVersion
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/megaBoringVersion b/spec/plugins/EnginePlugin/megaBoringVersion
new file mode 100755
index 0000000..cbf7911
--- /dev/null
+++ b/spec/plugins/EnginePlugin/megaBoringVersion
@@ -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 4.0.0
+exit 0
\ No newline at end of file


[39/40] git commit: removed unncessary console.logs

Posted by st...@apache.org.
removed unncessary console.logs


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

Branch: refs/heads/ffos
Commit: 5f98a829cd2f1c4306ea1081833d5a3b40c4b8cf
Parents: 5d2cb21
Author: Steven Gill <st...@gmail.com>
Authored: Fri Aug 23 18:47:04 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Sep 12 11:13:07 2013 -0700

----------------------------------------------------------------------
 plugman.js                    | 2 +-
 src/platforms/blackberry10.js | 2 --
 2 files changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f98a829/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index e1f7745..625933d 100755
--- a/plugman.js
+++ b/plugman.js
@@ -58,7 +58,7 @@ plugman.commands =  {
     },
     'install'  : function(cli_opts) {
         if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
-            return //console.log(plugman.help());
+            return console.log(plugman.help());
         }
         var cli_variables = {}
         if (cli_opts.variable) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f98a829/src/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/src/platforms/blackberry10.js b/src/platforms/blackberry10.js
index bb9f2e1..c3d1ce9 100644
--- a/src/platforms/blackberry10.js
+++ b/src/platforms/blackberry10.js
@@ -37,10 +37,8 @@ module.exports = {
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
             var src = source_el.attrib['src'];
             var target = source_el.attrib['target-dir'] || plugin_id;
-            console.log(target);
             TARGETS.forEach(function(arch) {
                 var dest = path.join("native", arch, "chrome", "plugin", target, path.basename(src));
-                console.log(dest);
                 common.copyFile(plugin_dir, src, project_dir, dest);
             });
         },


[02/40] git commit: [CB-4036] - first pass for adding version script

Posted by st...@apache.org.
[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/42056f9a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/42056f9a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/42056f9a

Branch: refs/heads/ffos
Commit: 42056f9a79f57956f03820efd3d18ee6b9e62758
Parents: 2ea4ddd
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Jul 25 14:56:23 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:15 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/42056f9a/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/42056f9a/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'));


[29/40] git commit: Revert "[CB-4714] Add -f option to 'plugin rm' to forcefully remove a plugin."

Posted by st...@apache.org.
Revert "[CB-4714] Add -f option to 'plugin rm' to forcefully remove a plugin."

This reverts commit c2461bc946555a3f43928d35ba1768c3cdcff03a.
Didn't mean to check this in. Still has pending code review comments.


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

Branch: refs/heads/ffos
Commit: f57dbd3d5029c1906a12a73dd4a651ad1b1e4415
Parents: 83bc35e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 4 14:36:50 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 4 14:37:16 2013 -0400

----------------------------------------------------------------------
 src/uninstall.js         | 28 ++++++++--------------------
 src/util/dependencies.js | 10 ++--------
 2 files changed, 10 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f57dbd3d/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index f87ec20..c0cddf5 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -44,10 +44,8 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
 
 module.exports.uninstallPlugin = function(id, plugins_dir, callback) {
     var plugin_dir = path.join(plugins_dir, id);
-    
-    // If already removed, skip.    
+    // If already removed, skip.
     if (!fs.existsSync(plugin_dir)) {
-        // console.log("Skipped " + plugin_dir + " (not found)");
         if (callback) callback();
         return;
     }
@@ -77,34 +75,24 @@ module.exports.uninstallPlugin = function(id, plugins_dir, callback) {
 
 // possible options: cli_variables, www_dir, is_top_level
 function runUninstall(actions, platform, project_dir, plugin_dir, plugins_dir, options, callback) {
-    var xml_path     = path.join(plugin_dir, 'plugin.xml');
-    if (!fs.existsSync(xml_path)) {
-        // log warning?
-        return;
-    }
-    
-    var plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
+    var xml_path     = path.join(plugin_dir, 'plugin.xml')
+      , plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
     var plugin_id    = plugin_et._root.attrib['id'];
     options = options || {};
 
-    var dependency_info = dependencies.generate_dependency_info(plugins_dir, platform, 'remove');
+    var dependency_info = dependencies.generate_dependency_info(plugins_dir, platform);
     var graph = dependency_info.graph;
     var dependents = graph.getChain(plugin_id);
 
-    var forced = options.cmd && (options.cmd.indexOf('-f') + options.cmd.indexOf('-force') > -2);   
     var tlps = dependency_info.top_level_plugins;
     var diff_arr = [];
     tlps.forEach(function(tlp) {
         if (tlp != plugin_id) {
             var ds = graph.getChain(tlp);
             if (options.is_top_level && ds.indexOf(plugin_id) > -1) {
-                if(forced) {
-                    require('../plugman').emit('log', tlp + ' depends on '+ plugin_id + ', but forcing removal...');
-                } else {
-                    var err = new Error('Another top-level plugin (' + tlp + ') relies on plugin ' + plugin_id + ', therefore aborting uninstallation.');
-                    if (callback) return callback(err);
-                    else throw err;
-                }
+                var err = new Error('Another top-level plugin (' + tlp + ') relies on plugin ' + plugin_id + ', therefore aborting uninstallation.');
+                if (callback) return callback(err);
+                else throw err;
             }
             diff_arr.push(ds);
         }
@@ -183,7 +171,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
             // queue up the plugin so prepare can remove the config changes
             config_changes.add_uninstalled_plugin_to_prepare_queue(plugins_dir, path.basename(plugin_dir), platform, is_top_level);
             // call prepare after a successful uninstall
-            require('../plugman').prepare(project_dir, platform, plugins_dir);
+            require('./../plugman').prepare(project_dir, platform, plugins_dir);
             if (callback) callback();
         }
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f57dbd3d/src/util/dependencies.js
----------------------------------------------------------------------
diff --git a/src/util/dependencies.js b/src/util/dependencies.js
index bf40eb1..32e07eb 100644
--- a/src/util/dependencies.js
+++ b/src/util/dependencies.js
@@ -1,11 +1,10 @@
 var dep_graph = require('dep-graph'),
     path = require('path'),
-    fs = require('fs'),
     config_changes = require('./config-changes'),
     xml_helpers = require('./xml-helpers');
 
 module.exports = {
-    generate_dependency_info:function(plugins_dir, platform, context) {
+    generate_dependency_info:function(plugins_dir, platform) {
         var json = config_changes.get_platform_json(plugins_dir, platform);
         var tlps = [];
         var graph = new dep_graph();
@@ -19,12 +18,7 @@ module.exports = {
             });
         });
         Object.keys(json.dependent_plugins).forEach(function(plug) {
-            var xmlPath = path.join(plugins_dir, plug, 'plugin.xml');
-            if (context == 'remove' && !fs.existsSync(xmlPath)) {
-                return; // dependency may have been forcefully removed
-            }
-
-            var xml = xml_helpers.parseElementtreeSync(xmlPath);
+            var xml = xml_helpers.parseElementtreeSync(path.join(plugins_dir, plug, 'plugin.xml'));
             var deps = xml.findall('dependency');
             deps && deps.forEach(function(dep) {
                 var id = dep.attrib.id;


[07/40] git commit: [CB-4036] - refactored the engine/version checks for easier testing

Posted by st...@apache.org.
[CB-4036] - refactored the engine/version checks for easier testing


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

Branch: refs/heads/ffos
Commit: d6ac5779f7c6a3bb76c8f8c4fee2f6f57d9e3401
Parents: 59ff79e
Author: Tim Kim <ti...@adobe.com>
Authored: Wed Jul 31 16:54:12 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 src/install.js | 168 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 104 insertions(+), 64 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d6ac5779/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 381b6fe..a02e8f6 100644
--- a/src/install.js
+++ b/src/install.js
@@ -65,6 +65,102 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options,
     }
 }
 
+function checkMinimumReq(currentProjectInfo, minRequirements, platform, callback) {
+    if(currentProjectInfo.cordovaVersion) {
+        if(currentProjectInfo.cordovaVersion == 'dev' || semver.satisfies(currentProjectInfo.cordovaVersion, minRequirements.cordovaMinVersion)){
+            // engine ok!
+        } else {
+            var err = new Error('Plugin doesn\'t support this project\'s Cordova version. Project version: ' + currentProjectInfo.cordovaVersion + ', failed version requirement: ' + minRequirements.cordovaMinVersion);
+            if (callback) return callback(err);
+            else throw err;
+        }   
+    }
+    
+    if(currentProjectInfo.min_os_version) {
+        if(semver.satisfies(currentProjectInfo.min_os_version, minRequirements.platformMinOS)) {
+            // min-os version ok
+        } else {
+            var err = new Error('Plugin doesn\'t support ' + platform + '  minimum os version.  ' + platform + '  minimum os version: ' + currentProjectInfo.min_os_version + ', failed version requirement: ' + minRequirements.platformMinOS);
+            if (callback) return callback(err);
+            else throw err;
+        }            
+    }
+
+    if(currentProjectInfo.min_sdk_version) {
+        if(semver.satisfies(currentProjectInfo.min_sdk_version, minRequirements.platformMinSDK)) {
+            // min-sdk version ok
+        } else {
+            var err = new Error('Plugin doesn\'t support ' + platform + '  minimum sdk version.  ' + platform + '  minimum sdk version: ' + currentProjectInfo.min_sdk_version + ', failed version requirement: ' + minRequirements.platformMinSDK);
+            if (callback) return callback(err);
+            else throw err;
+        }                        
+    }     
+}
+
+// use the project level cordova scripts to get the current cordova version and platform information
+function getCurrentProjectVersion(versionPath, platformPath) {
+    // need to think about a more graceful way of handling when these scripts break or when they are not detected
+    // setting version/platform to null if they do fail or do not exist and then just continuing
+    
+    var cordovaVersion, platformInfo;
+    
+    fs.chmodSync(versionPath, '755');
+    fs.chmodSync(platformPath, '755');
+
+    if (fs.existsSync(versionPath)) {   
+        var versionScript = shell.exec(versionPath, {silent: true});
+        if (versionScript.code === 0) {
+            cordovaVersion = cordovaVersion.output.trim();
+            var rc_index = cordovaVersion.indexOf('rc');
+            if (rc_index > -1) {
+                cordovaVersion = cordovaVersion.substr(0, rc_index) + '-' + cordovaVersion.substr(rc_index);
+            }
+        }else{
+            cordovaVersion = null;
+            require('../plugman').emit('log', 'Cordova project version script failed (has a ./cordova/version script, but something went wrong executing it), continuing anyways.');
+        }
+    }else{
+        cordovaVersion = null;
+        require('../plugman').emit('log', 'Cordova project version not detected (lacks a ./cordova/version script), continuing.');
+    }  
+    
+    if (fs.existsSync(platformPath)) {   
+        var platformScript = shell.exec(platformPath, {silent: true});
+        if (platformScript.code === 0) {
+            // thinking platformScript.output would be a JSON string like:
+            // { min_os_version: "5.0.0" , min_sdk_version: "1.0.0" }
+            platformInfo = platformScript.output;
+        }else{
+            platformInfo =  null;
+            require('../plugman').emit('log', 'Cordova project platformReq script failed (has a ./cordova/platformReq script, but something went wrong executing it), continuing anyways.');
+        }
+    }else{  
+        platformInfo =  null;
+        require('../plugman').emit('log', 'Cordova project version not detected (lacks a ./cordova/version script), continuing.');
+    }     
+    
+    return { 'cordovaVersion' : cordovaVersion, 'platformInfo' : platformInfo };
+}
+
+function getMinReq(pluginElement){
+    var cordovaMinVersion, platformMinOS, platformMinSDK;
+    
+    var engines = pluginElement.findall('engines/engine');
+    engines.forEach(function(engine){
+                if(engine.attrib["name"].toLowerCase() === "cordova"){
+                    cordovaMinVersion = engine.attrib["version"];
+                }else{
+                    // 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"];
+    
+    return { 'cordovaMinVersion': cordovaMinVersion, 'platformMinOS' : platformMinOS, 'platformMinSDK' : platformMinSDK };
+}
+
+
 // possible options: cli_variables, www_dir, is_top_level
 function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, options, callback) {
     var xml_path     = path.join(plugin_dir, 'plugin.xml')
@@ -93,75 +189,19 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         if (callback) callback();
         return;
     }
-
-    // checking engine
-    // will there be a case for multiple engine support?
+    
     var versionPath = path.join(project_dir, 'cordova', 'version');
     // windows8, wp7, wp8 all use a .bat file
-    if (!fs.existsSync(versionPath)) {
+    if (platform === "windows8" || platform === "wp7" || platform === "wp8") {
         versionPath += ".bat";
     }
-    if (fs.existsSync(versionPath)) {
-        // need to rethink this so I don't have to chmod anything
-        fs.chmodSync(versionPath, '755');
-        var versionScript = shell.exec(versionPath, {silent: true});
-        // Only check cordova version if the version script was successful.
-        if (versionScript.code === 0) {
-            var current_version = versionScript.output.trim();
-            var rc_index = current_version.indexOf('rc');
-            if (rc_index > -1) {
-                current_version = current_version.substr(0, rc_index) + '-' + current_version.substr(rc_index);
-            }
-            var engines = plugin_et.findall('engines/engine');
-            engines.forEach(function(engine){
-                if(engine.attrib["name"].toLowerCase() === "cordova"){
-                    var engineVersion = engine.attrib["version"];
-                    // clean only versionScript.output since semver.clean strips out
-                    // the gt and lt operators
-                    if(current_version == 'dev' || semver.satisfies(current_version, engineVersion)){
-                        // engine ok!
-                    } else {
-                        var err = new Error('Plugin doesn\'t support this project\'s Cordova version. Project version: ' + current_version + ', failed version requirement: ' + engineVersion);
-                        if (callback) return callback(err);
-                        else throw err;
-                    }
-                } else {
-                    // check for other engines? worklight phonegap etc
-                }
-            });
-        }
-    } else {
-        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.');
-    }
+    var platformPath = path.join(project_dir, 'cordova', 'platformReq');
+    
+    var currentProjectInfo = getCurrentProjectVersion(versionPath, platformPath);
+    var minRequirements = getMinReq(plugin_et);
+    
+    checkMinimumReq(currentProjectInfo, minRequirements, platform, callback);
     
     // checking preferences, if certain variables are not provided, we should throw.
     prefs = plugin_et.findall('./preference') || [];


[27/40] git commit: [CB-4430] Add tests for lib-file support on Android.

Posted by st...@apache.org.
[CB-4430] Add tests for lib-file support on Android.


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

Branch: refs/heads/ffos
Commit: db43ef2522d3330b25927c7e482c3e663547f783
Parents: c5bdcf0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 4 13:58:04 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 4 13:58:51 2013 -0400

----------------------------------------------------------------------
 spec/install.spec.js                             |  2 +-
 spec/platforms/android.spec.js                   | 17 +++++++++++++++++
 spec/plugins/DummyPlugin/plugin.xml              |  1 +
 spec/plugins/DummyPlugin/src/android/TestLib.jar |  0
 spec/uninstall.spec.js                           |  4 ++--
 5 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 04fd7c2..1639fce 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -108,7 +108,7 @@ describe('install', function() {
         });
         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);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/platforms/android.spec.js
----------------------------------------------------------------------
diff --git a/spec/platforms/android.spec.js b/spec/platforms/android.spec.js
index cecb191..cafa730 100644
--- a/spec/platforms/android.spec.js
+++ b/spec/platforms/android.spec.js
@@ -23,6 +23,7 @@ var xml_path     = path.join(dummyplugin, 'plugin.xml')
 var platformTag = plugin_et.find('./platform[@name="android"]');
 var dummy_id = plugin_et._root.attrib['id'];
 var valid_source = platformTag.findall('./source-file'),
+    valid_libs = platformTag.findall('./lib-file'),
     assets = plugin_et.findall('./asset'),
     configChanges = platformTag.findall('./config-file');
 
@@ -65,6 +66,14 @@ describe('android project handler', function() {
         afterEach(function() {
             shell.rm('-rf', temp);
         });
+        describe('of <lib-file> elements', function() {
+            it("should copy jar files to project/libs", function () {
+                var s = spyOn(common, 'copyFile');
+
+                android['lib-file'].install(valid_libs[0], dummyplugin, temp);
+                expect(s).toHaveBeenCalledWith(dummyplugin, 'src/android/TestLib.jar', temp, path.join('libs', 'TestLib.jar'));
+            });
+        });
         describe('of <source-file> elements', function() {
             beforeEach(function() {
                 shell.cp('-rf', android_one_project, temp);
@@ -106,6 +115,14 @@ describe('android project handler', function() {
         afterEach(function() {
             shell.rm('-rf', temp);
         });
+        describe('of <lib-file> elements', function(done) {
+            it('should remove jar files', function () {
+                var s = spyOn(common, 'removeFile');
+                android['lib-file'].install(valid_libs[0], dummyplugin, temp);
+                android['lib-file'].uninstall(valid_libs[0], temp, dummy_id);
+                expect(s).toHaveBeenCalledWith(temp, path.join('libs', 'TestLib.jar'));
+            });
+        });
         describe('of <source-file> elements', function() {
             it('should remove stuff by calling common.deleteJava', function(done) {
                 var s = spyOn(common, 'deleteJava');

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/plugins/DummyPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/plugin.xml b/spec/plugins/DummyPlugin/plugin.xml
index 61e4e52..fad5072 100644
--- a/spec/plugins/DummyPlugin/plugin.xml
+++ b/spec/plugins/DummyPlugin/plugin.xml
@@ -64,6 +64,7 @@
 
         <source-file src="src/android/DummyPlugin.java"
                 target-dir="src/com/phonegap/plugins/dummyplugin" />
+        <lib-file src="src/android/TestLib.jar" />
     </platform>
 
     <!-- blackberry10 -->

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/plugins/DummyPlugin/src/android/TestLib.jar
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/src/android/TestLib.jar b/spec/plugins/DummyPlugin/src/android/TestLib.jar
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db43ef25/spec/uninstall.spec.js
----------------------------------------------------------------------
diff --git a/spec/uninstall.spec.js b/spec/uninstall.spec.js
index 0b6dd0c..74ef25f 100644
--- a/spec/uninstall.spec.js
+++ b/spec/uninstall.spec.js
@@ -54,7 +54,7 @@ describe('uninstallPlatform', function() {
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
             uninstall.uninstallPlatform('android', temp, dummyplugin, plugins_dir, {});
-            expect(actions_push.calls.length).toEqual(3);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });
@@ -210,7 +210,7 @@ describe('uninstall', function() {
         });
         it('should queue up actions as appropriate for that plugin and call process on the action stack', function() {
             uninstall('android', temp, dummyplugin, plugins_dir, {});
-            expect(actions_push.calls.length).toEqual(3);
+            expect(actions_push.calls.length).toEqual(4);
             expect(c_a).toHaveBeenCalledWith(jasmine.any(Function), [jasmine.any(Object), temp, dummy_id], jasmine.any(Function), [jasmine.any(Object), path.join(plugins_dir, dummyplugin), temp, dummy_id]);
             expect(proc).toHaveBeenCalled();
         });


[13/40] git commit: [CB-4036] - fixed up how plugin install handles the dev flag for repos as well as cleaned up some errors

Posted by st...@apache.org.
[CB-4036] - fixed up how plugin install handles the dev flag for repos as well as cleaned up some errors


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

Branch: refs/heads/ffos
Commit: 0414fe4a332dc38b4ea632e43c90bb1bb36a4f29
Parents: c06a07e
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Aug 15 17:13:03 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:17 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/plugin.xml |  1 +
 src/install.js                       | 58 +++++++++++++++++++------------
 src/util/default-engines.js          | 14 ++++----
 3 files changed, 44 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0414fe4a/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 169e8d1..72bf190 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" platform="*" />
         <engine name="cordova-plugman" version=">=0.10.0" platform="*" />
+        <engine name="cordova-android" version=">=3.1.0" platform="*" />
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0414fe4a/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 4e88b80..59334dc 100644
--- a/src/install.js
+++ b/src/install.js
@@ -66,8 +66,8 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options,
 }
 
 function checkMinimumReq(engines, callback) {
-    engines.forEach(function(engine){
-        if(engine.currentVersion == 'dev' || semver.satisfies(engine.currentVersion, engine.minVersion || engine.currentVersion == null)){
+    engines.forEach(function(engine){    
+        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);
@@ -77,12 +77,19 @@ function checkMinimumReq(engines, callback) {
     });
 }
 
-function cleanVersionRC(version){
+function cleanVersionOutput(version, platform){
     var out = version.trim();
     var rc_index = out.indexOf('rc');
+    var dev_index = out.indexOf('dev');
     if (rc_index > -1) {
         out = out.substr(0, rc_index) + '-' + out.substr(rc_index);
-    }    
+    }  
+
+    // strip out the -dev and put a warning about using the dev branch
+    if (dev_index > -1) {
+        out = out.substr(0, dev_index-1);
+        require('../plugman').emit('log', 'Cordova-'+platform+' has been detected as using a development branch. Attemping to install as Cordova-'+platform+' '+out);
+    }     
     return out;
 }
 
@@ -96,13 +103,13 @@ function callEngineScripts(engines) {
             fs.chmodSync(engine.scriptTarget, '755');
             engineScript = shell.exec(engine.scriptTarget, {silent: true});
             if (engineScript.code === 0) {
-                engineScriptVersion = cleanVersionRC(engineScript.output)
+                engineScriptVersion = cleanVersionOutput(engineScript.output, engine.platform)
             }else{
                 engineScriptVersion = null;
                 require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' script failed (has a '+ engine.scriptTarget +' script, but something went wrong executing it), continuing anyways.');
             }  
-        }else if(engine.minVersion){
-            engineScriptVersion = cleanVersionRC(engine.minVersion)           
+        }else if(engine.currentVersion){
+            engineScriptVersion = cleanVersionOutput(engine.currentVersion, engine.platform)           
         }else{
             engineScriptVersion = null;
             require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' not detected (lacks a '+ engine.scriptTarget +' script), continuing.');
@@ -119,22 +126,37 @@ function getEngines(pluginElement, platform, project_dir){
     var defaultEngines = require('./util/default-engines');
     var uncheckedEngines = [];
     var tempEngine;
-    // load in all known defaults and compare
+    var cordovaEngineIndex;
+    var cordovaPlatformEngineIndex;
+    
+    var theName;
+    // load in known defaults and update when necessary
     engines.forEach(function(engine){   
-        // this may need some changes - what to do for default platforms - why need to specify platforms?
         if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
-            if(defaultEngines[engine.attrib["name"]]){
-                defaultEngines[engine.attrib["name"]].minVersion = defaultEngines[engine.attrib["name"]].minVersion ? defaultEngines[engine.attrib["name"]].minVersion : engine.attrib["version"];
-                defaultEngines[engine.attrib["name"]].scriptTarget = defaultEngines[engine.attrib["name"]].scriptTarget ? path.join(project_dir, defaultEngines[engine.attrib["name"]].scriptTarget) : null;
-                uncheckedEngines.push(defaultEngines[engine.attrib["name"]]);
+            theName = engine.attrib["name"];
+            if(defaultEngines[theName]){
+                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib["version"];
+                defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
+                defaultEngines[theName].scriptTarget = defaultEngines[theName].scriptTarget ? path.join(project_dir, defaultEngines[theName].scriptTarget) : null;
+                defaultEngines[theName].name = theName;
+                
+                // set the indices so we can pop the cordova engine when needed
+                if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
+                if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
+                
+                uncheckedEngines.push(defaultEngines[theName]);
+                
             }else{
                 // check for other engines
                 tempEngine = {};
-                tempEngine[engine.attrib["name"]] = { 'platform': engine.attrib["platform"], 'scriptTarget':path.join(project_dir,engine.attrib["scriptTarget"]), 'minVersion' :  engine.attrib["version"]};
+                tempEngine[theName] = { 'platform': engine.attrib["platform"], 'scriptTarget':path.join(project_dir,engine.attrib["scriptTarget"]), 'minVersion' :  engine.attrib["version"]};
                 uncheckedEngines.push(tempEngine);
             }
         }    
     });
+    
+    // make sure we check for platform req's and not just cordova reqs
+    if(cordovaEngineIndex && cordovaPlatformEngineIndex) uncheckedEngines.pop(cordovaEngineIndex);
     return uncheckedEngines;
 }
 
@@ -167,14 +189,6 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         if (callback) callback();
         return;
     }
-
-    //var versionPath = path.join(project_dir, 'cordova', 'version');
-    // windows8, wp7, wp8 all use a .bat file
-    /*
-    if (platform === "windows8" || platform === "wp7" || platform === "wp8") {
-        versionPath += ".bat";
-    }
-    */
     
     var theEngines = getEngines(plugin_et, platform, project_dir);
     theEngines = callEngineScripts(theEngines);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0414fe4a/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index e1a26d1..b041951 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -9,19 +9,19 @@ module.exports = {
         { 'platform':'*', 'scriptTarget': path.join('cordova','version') },   
     // no location needed for plugman as this should be the calling process
     'cordova-plugman': 
-        { 'platform':'*', 'minVersion': process.version },
+        { 'platform':'*', 'currentVersion': process.version },
     'cordova-android': 
-        { 'platform':'android', 'scriptTarget': '' },
+        { 'platform':'android', 'scriptTarget': path.join('cordova','version') },
     'cordova-ios': 
-        { 'platform':'ios', 'scriptTarget': '' },
+        { 'platform':'ios', 'scriptTarget': path.join('cordova','version') },
     'cordova-blackberry10': 
-        { 'platform':'blackberry10', 'scriptTarget': '' },
+        { 'platform':'blackberry10', 'scriptTarget': path.join('cordova','version') },
     'cordova-wp7': 
-        { 'platform':'wp7', 'scriptTarget': '' },
+        { 'platform':'wp7', 'scriptTarget': path.join('cordova','version') },
     'cordova-wp8': 
-        { 'platform':'wp8', 'scriptTarget': '' },
+        { 'platform':'wp8', 'scriptTarget': path.join('cordova','version') },
     'cordova-windows8': 
-        { 'platform':'windows8', 'scriptTarget': '' },
+        { 'platform':'windows8', 'scriptTarget': path.join('cordova','version') },
     
     // ideally these sdk versions will be known via a script
     // that calls the sdk's version command - the idea would be that


[09/40] git commit: [CB-4036] Forgot updated default-engines file

Posted by st...@apache.org.
[CB-4036] Forgot updated default-engines file


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

Branch: refs/heads/ffos
Commit: c23d328b43d1760e8046e3ce523990fb242f988e
Parents: d1db04a
Author: Tim Kim <ti...@adobe.com>
Authored: Fri Aug 23 15:28:58 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:17 2013 -0700

----------------------------------------------------------------------
 src/util/default-engines.js | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c23d328b/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index cdfdfde..ce5f454 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -1,9 +1,5 @@
 var path = require('path');
 
-// wondering how to nicely store paths here...
-// it'd be nice to just point to this file and get the correct path
-// since these scripts should ideally be accessed from the cordova project folder
-
 module.exports = function(project_dir){
     return {
         'cordova': 
@@ -24,22 +20,15 @@ module.exports = function(project_dir){
         'cordova-windows8': 
             { 'platform':'windows8', 'scriptSrc': path.join(project_dir,'cordova','version') },
         
-        // ideally these sdk versions will be known via a script
-        // that calls the sdk's version command - the idea would be that
-        // these version scripts output all in the same way and parse
-        // the appropriate blob of info returned from the sdk version command
+        // TODO: these scripts have not been made!
         'apple-xcode' : 
-            { 'platform':'ios', 'scriptSrc': '' },
+            { 'platform':'ios', 'scriptSrc':  path.join(project_dir,'cordova','apple-xcode-version') },
         'apple-ios' : 
-            { 'platform':'ios', 'scriptSrc': '' },
+            { 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','apple-ios-version') },
         'blackberry-webworks' : 
-            // use path to sdk/Framework/lib/webworks-info.js 
-            // will export as version number
-            // currently though, all versions of webworks sdk should be good to go 
-            // so this is technically *not* needed right now
-            { 'platform':'blackberry10', 'scriptSrc': '' },
+            { 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'blackberry-webworks-version') },
         'android-sdk' : 
             // will have to parse string output from android list targets
-            { 'platform':'android', 'scriptSrc': '' }
+            { 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','android-sdk-version') }
     }
 };


[12/40] git commit: [CB-4036] - fixed custom engine loading and added test

Posted by st...@apache.org.
[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"]});
         }
     });
     


[36/40] git commit: Fix tests broken by lazy module requiring.

Posted by st...@apache.org.
Fix tests broken by lazy module requiring.


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

Branch: refs/heads/ffos
Commit: 7bd0266494e41ba2bb41bddfe8efdccf9872835a
Parents: 2d4ab6c
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Sep 12 11:47:04 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Sep 12 11:47:04 2013 -0400

----------------------------------------------------------------------
 plugman.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7bd02664/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 240e0db..625933d 100755
--- a/plugman.js
+++ b/plugman.js
@@ -22,8 +22,11 @@
 var emitter = require('./src/events');
 
 function addProperty(o, symbol, modulePath) {
+    var val = null;
     Object.defineProperty(o, symbol, {
-        get : function() { return require(modulePath); }});
+        get : function() { return val = val || require(modulePath); },
+        set : function(v) { val = v; }
+    });
 }
 
 plugman = {


[30/40] git commit: [CB-4750] Updated version and changelog for 0.11.0

Posted by st...@apache.org.
[CB-4750] Updated version and changelog for 0.11.0


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

Branch: refs/heads/ffos
Commit: dcc6fe2c7bc4a84df8f1d095458ec86010442845
Parents: f57dbd3
Author: Braden Shepherdson <br...@gmail.com>
Authored: Thu Sep 5 15:26:26 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Thu Sep 5 15:26:26 2013 -0400

----------------------------------------------------------------------
 CHANGELOG.md | 17 +++++++++++++++++
 package.json |  4 ++--
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dcc6fe2c/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..1d94527
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,17 @@
+# Changelog
+
+## 0.11.0
+
+### Features
+
+- Windows phone support
+- Track download counts from the plugin registry [CB-4492](https://issues.apache.org/jira/browse/CB-4492)
+- Plugin URLs can now be specified with a hash giving a git ref and subdirectory, as in `https://github.com/foo/bar.git#gitref:sub/dir`. Both parts are optional: `.../bar.git#gitref` and `.../bar.git#:sub/dir` both work. [CB-4622](https://issues.apache.org/jira/browse/CB-4622)
+- Engine data is now stored in the registry, and Plugman will not install plugins your Cordova version cannot support. [CB-4494](https://issues.apache.org/jira/browse/CB-4494)
+- `<lib-file>` tags are now allowed on Android. [CB-4430](https://issues.apache.org/jira/browse/CB-4430)
+
+### Bugfixes
+
+- `plugin rm` now doesn't choke when a file is already deleted
+- Fixed some trouble with filesystem paths vs. web paths; improves Windows host support.
+- Projects beginning with `x`, `y`, and `z` now work. [CB-4502](https://issues.apache.org/jira/browse/CB-4502)

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dcc6fe2c/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 6ce1ef5..0e31cdf 100644
--- a/package.json
+++ b/package.json
@@ -2,8 +2,8 @@
   "author": "Andrew Lunny <al...@gmail.com>",
   "name": "plugman",
   "description": "install/uninstall Cordova plugins",
-  "version": "0.10.1",
-"repository": {
+  "version": "0.11.0",
+  "repository": {
     "type": "git",
     "url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"
   },


[17/40] git commit: [CB-3646] - fixed custom engine src script not being properly set

Posted by st...@apache.org.
[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/ffos
Commit: d83ce8e61de543542eba928cdf4cb268fdea810c
Parents: 8ed4394
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Aug 26 14:51:41 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
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);
     


[16/40] git commit: [CB-4036] - fix for handling current state of platform branches with version listed as dev

Posted by st...@apache.org.
[CB-4036] - fix for handling current state of platform branches with version listed as dev


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

Branch: refs/heads/ffos
Commit: 0da4b356eecc7c724dcc6c5eda02184b5f812939
Parents: d83ce8e
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Aug 26 15:58:43 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:18 2013 -0700

----------------------------------------------------------------------
 src/install.js | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/0da4b356/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 13599e5..9934d82 100644
--- a/src/install.js
+++ b/src/install.js
@@ -77,7 +77,7 @@ function checkEngines(engines, callback) {
     });
 }
 
-function cleanVersionOutput(version, platform){
+function cleanVersionOutput(version, name){
     var out = version.trim();
     var rc_index = out.indexOf('rc');
     var dev_index = out.indexOf('dev');
@@ -87,8 +87,13 @@ function cleanVersionOutput(version, platform){
 
     // strip out the -dev and put a warning about using the dev branch
     if (dev_index > -1) {
-        out = out.substr(0, dev_index-1);
-        require('../plugman').emit('log', 'Cordova-'+platform+' has been detected as using a development branch. Attemping to install as Cordova-'+platform+' '+out);
+        // some platform still lists dev branches as just dev, set to null and continue
+        if(out=="dev"){
+            out = null;
+        }else{
+            out = out.substr(0, dev_index-1);
+        }
+        require('../plugman').emit('log', name+' has been detected as using a development branch. Attemping to install anyways.');
     }     
     return out;
 }
@@ -97,19 +102,19 @@ function cleanVersionOutput(version, platform){
 function callEngineScripts(engines) {
     var engineScript;
     var engineScriptVersion;
-    
+   
     engines.forEach(function(engine){
         if(fs.existsSync(engine.scriptSrc)){
             fs.chmodSync(engine.scriptSrc, '755');
             engineScript = shell.exec(engine.scriptSrc, {silent: true});
             if (engineScript.code === 0) {
-                engineScriptVersion = cleanVersionOutput(engineScript.output, engine.platform)
+                engineScriptVersion = cleanVersionOutput(engineScript.output, engine.name)
             }else{
                 engineScriptVersion = null;
                 require('../plugman').emit('log', 'Cordova project '+ engine.scriptSrc +' script failed (has a '+ engine.scriptSrc +' script, but something went wrong executing it), continuing anyways.');
             }  
         }else if(engine.currentVersion){
-            engineScriptVersion = cleanVersionOutput(engine.currentVersion, engine.platform)           
+            engineScriptVersion = cleanVersionOutput(engine.currentVersion, engine.name)           
         }else{
             engineScriptVersion = null;
             require('../plugman').emit('log', 'Cordova project '+ engine.scriptSrc +' not detected (lacks a '+ engine.scriptSrc +' script), continuing.');


[15/40] git commit: [CB-4036] - added ability to list multiple platforms in plugin.xml

Posted by st...@apache.org.
[CB-4036] - added ability to list multiple platforms in plugin.xml


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

Branch: refs/heads/ffos
Commit: 2e03e73225c91c9125c1687521706d22bdb2c528
Parents: 0da4b35
Author: Tim Kim <ti...@adobe.com>
Authored: Mon Aug 26 16:30:43 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:18 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2e03e732/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index ccee749..04fd7c2 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -96,6 +96,16 @@ describe('install', function() {
             install('android', temp, 'engineplugin', plugins_dir, {});
             expect(spy).toHaveBeenCalledWith(null,'>=1.0.0');
         });
+        it('should check custom engine version that supports multiple platforms', function() {
+            var spy = spyOn(semver, 'satisfies').andReturn(true);
+            install('android', temp, 'engineplugin', plugins_dir, {});
+            expect(spy).toHaveBeenCalledWith(null,'>=3.0.0');
+        });
+        it('should not check custom engine version that is not supported for platform', function() {
+            var spy = spyOn(semver, 'satisfies').andReturn(true);
+            install('blackberry10', temp, 'engineplugin', plugins_dir, {});
+            expect(spy).not.toHaveBeenCalledWith(null,'>=3.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, {});
             expect(actions_push.calls.length).toEqual(3);

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2e03e732/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index a855d1b..a58f19e 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -27,6 +27,7 @@
         <engine name="cordova" version=">=2.3.0"/>
         <engine name="cordova-plugman" version=">=0.10.0" />
         <engine name="mega-fun-plugin" version=">=1.0.0" scriptSrc="megaFunVersion" platform="*" />
+        <engine name="mega-boring-plugin" version=">=3.0.0" scriptSrc="megaBoringVersion" platform="ios|android" />
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2e03e732/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 9934d82..1959f07 100644
--- a/src/install.js
+++ b/src/install.js
@@ -130,25 +130,33 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
     var engines = pluginElement.findall('engines/engine');
     var defaultEngines = require('./util/default-engines')(project_dir);
     var uncheckedEngines = [];
-    var cordovaEngineIndex, cordovaPlatformEngineIndex, theName;
+    var cordovaEngineIndex, cordovaPlatformEngineIndex, theName, platformIndex, defaultPlatformIndex;
     // 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;
-            defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
-            defaultEngines[theName].name = theName;
-            
-            // set the indices so we can pop the cordova engine when needed
-            if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
-            if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
-            
-            uncheckedEngines.push(defaultEngines[theName]);
+        if(defaultEngines[theName]){
+            // make sure engine is for platform we are installing on
+            defaultPlatformIndex = defaultEngines[theName].platform.indexOf(platform);
+            if(defaultPlatformIndex > -1 || 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;
+                defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
+                defaultEngines[theName].name = theName;
+                
+                // set the indices so we can pop the cordova engine when needed
+                if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
+                if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
+                
+                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':path.resolve(plugin_dir, engine.attrib["scriptSrc"]), 'minVersion' :  engine.attrib["version"]});
+        }else{
+            platformIndex = engine.attrib["platform"].indexOf(platform);
+            if(platformIndex > -1 || engine.attrib["platform"] === '*'){
+                uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':path.resolve(plugin_dir, engine.attrib["scriptSrc"]), 'minVersion' :  engine.attrib["version"]});
+            }
         }
     });
     


[35/40] git commit: ...and fixing conflict

Posted by st...@apache.org.
...and fixing conflict


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

Branch: refs/heads/ffos
Commit: 2d4ab6cf517bca82d37e89293dc462f6f71a1b2c
Parents: 95745c2 b5ba62d
Author: Anis Kadri <an...@apache.org>
Authored: Wed Sep 11 16:27:32 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 11 16:27:32 2013 -0700

----------------------------------------------------------------------
 plugman.js | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2d4ab6cf/plugman.js
----------------------------------------------------------------------
diff --cc plugman.js
index bcd0044,b9748ac..240e0db
--- a/plugman.js
+++ b/plugman.js
@@@ -40,6 -32,18 +32,19 @@@ plugman = 
      removeAllListeners: emitter.removeAllListeners,
      emit:               emitter.emit
  };
+ addProperty(plugman, 'help', './src/help');
+ addProperty(plugman, 'install', './src/install');
+ addProperty(plugman, 'uninstall', './src/uninstall');
+ addProperty(plugman, 'fetch', './src/fetch');
+ addProperty(plugman, 'prepare', './src/prepare');
+ addProperty(plugman, 'config', './src/config');
++addProperty(plugman, 'owner', './src/owner');
+ addProperty(plugman, 'adduser', './src/adduser');
+ addProperty(plugman, 'publish', './src/publish');
+ addProperty(plugman, 'unpublish', './src/unpublish');
+ addProperty(plugman, 'search', './src/search');
+ addProperty(plugman, 'info', './src/info');
+ addProperty(plugman, 'config_changes', './src/util/config-changes');
  
  plugman.commands =  {
      'config'   : function(cli_opts) {


[10/40] git commit: [CB-4036] - fixed up the default engines and added some tests

Posted by st...@apache.org.
[CB-4036] - fixed up the default engines and added some 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/d1db04ae
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d1db04ae
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d1db04ae

Branch: refs/heads/ffos
Commit: d1db04ae822b37e47a99560bb96e0a068cfb5f27
Parents: 9d6b99e
Author: Tim Kim <ti...@adobe.com>
Authored: Fri Aug 23 15:26:06 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:17 2013 -0700

----------------------------------------------------------------------
 spec/install.spec.js                        |  8 ++-
 spec/plugins/EnginePluginAndroid/plugin.xml |  1 +
 src/install.js                              |  8 +--
 src/util/default-engines.js                 | 74 ++++++++++++------------
 4 files changed, 50 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d1db04ae/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 22740ef..97e8f1d 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -74,12 +74,18 @@ describe('install', function() {
             install('android', temp, 'engineplugin', plugins_dir, {});
             expect(spy).toHaveBeenCalledWith('3.0.0-rc1','>=2.3.0');
         });
-        it('should check specific platform version if specified', function() {
+        it('should check specific platform version over cordova version if specified', function() {
             var spy = spyOn(semver, 'satisfies').andReturn(true);
             exec.andReturn({code:0,output:"3.1.0"});
             install('android', temp, 'enginepluginAndroid', plugins_dir, {});
             expect(spy).toHaveBeenCalledWith('3.1.0','>=3.1.0');
         });
+        it('should check platform sdk version if specified', function() {
+            var spy = spyOn(semver, 'satisfies').andReturn(true);
+            exec.andReturn({code:0,output:"4.3"});
+            install('android', temp, 'enginepluginAndroid', plugins_dir, {});
+            expect(spy).toHaveBeenCalledWith('4.3','>=4.3');
+        });
         it('should check plugmans version', function() {
             var spy = spyOn(semver, 'satisfies').andReturn(true);
             install('android', temp, 'engineplugin', plugins_dir, {});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d1db04ae/spec/plugins/EnginePluginAndroid/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePluginAndroid/plugin.xml b/spec/plugins/EnginePluginAndroid/plugin.xml
index 894bd02..7ada4ae 100644
--- a/spec/plugins/EnginePluginAndroid/plugin.xml
+++ b/spec/plugins/EnginePluginAndroid/plugin.xml
@@ -26,6 +26,7 @@
     <engines>
         <engine name="cordova" version=">=3.0.0"/>
         <engine name="cordova-android" version=">=3.1.0"/>
+        <engine name="android-sdk" version=">=4.3"/>
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d1db04ae/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index cfaead9..bb3a2e2 100644
--- a/src/install.js
+++ b/src/install.js
@@ -65,7 +65,7 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options,
     }
 }
 
-function checkMinimumReq(engines, callback) {
+function checkEngines(engines, callback) {
     engines.forEach(function(engine){    
         if(semver.satisfies(engine.currentVersion, engine.minVersion || engine.currentVersion == null)){
             // engine ok!
@@ -123,7 +123,7 @@ function callEngineScripts(engines) {
 // return only the engines we care about/need
 function getEngines(pluginElement, platform, project_dir){
     var engines = pluginElement.findall('engines/engine');
-    var defaultEngines = require('./util/default-engines');
+    var defaultEngines = require('./util/default-engines')(project_dir);
     var uncheckedEngines = [];
     var tempEngine, cordovaEngineIndex, cordovaPlatformEngineIndex, theName;
     // load in known defaults and update when necessary
@@ -132,7 +132,7 @@ function getEngines(pluginElement, platform, project_dir){
         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;
-            defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? path.join(project_dir, defaultEngines[theName].scriptSrc) : null;
+            defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
             defaultEngines[theName].name = theName;
             
             // set the indices so we can pop the cordova engine when needed
@@ -186,7 +186,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
     
     var theEngines = getEngines(plugin_et, platform, project_dir);
     theEngines = callEngineScripts(theEngines);
-    checkMinimumReq(theEngines, callback);
+    checkEngines(theEngines, callback);
     
     // checking preferences, if certain variables are not provided, we should throw.
     prefs = plugin_et.findall('./preference') || [];

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d1db04ae/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index 0ab9b4f..cdfdfde 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -4,40 +4,42 @@ var path = require('path');
 // it'd be nice to just point to this file and get the correct path
 // since these scripts should ideally be accessed from the cordova project folder
 
-module.exports = {
-    'cordova': 
-        { 'platform':'*', 'scriptSrc': path.join('cordova','version') },   
-    // no location needed for plugman as this should be the calling process
-    'cordova-plugman': 
-        { 'platform':'*', 'currentVersion': process.version },
-    'cordova-android': 
-        { 'platform':'android', 'scriptSrc': path.join('cordova','version') },
-    'cordova-ios': 
-        { 'platform':'ios', 'scriptSrc': path.join('cordova','version') },
-    'cordova-blackberry10': 
-        { 'platform':'blackberry10', 'scriptSrc': path.join('cordova','version') },
-    'cordova-wp7': 
-        { 'platform':'wp7', 'scriptSrc': path.join('cordova','version') },
-    'cordova-wp8': 
-        { 'platform':'wp8', 'scriptSrc': path.join('cordova','version') },
-    'cordova-windows8': 
-        { 'platform':'windows8', 'scriptSrc': path.join('cordova','version') },
-    
-    // ideally these sdk versions will be known via a script
-    // that calls the sdk's version command - the idea would be that
-    // these version scripts output all in the same way and parse
-    // the appropriate blob of info returned from the sdk version command
-    'apple-xcode' : 
-        { 'platform':'ios', 'scriptSrc': '' },
-    'apple-ios' : 
-        { 'platform':'ios', 'scriptSrc': '' },
-    'blackberry-webworks' : 
-        // use path to sdk/Framework/lib/webworks-info.js 
-        // will export as version number
-        // currently though, all versions of webworks sdk should be good to go 
-        // so this is technically *not* needed right now
-        { 'platform':'blackberry10', 'scriptSrc': '' },
-    'android-sdk' : 
-        // will have to parse string output from android list targets
-        { 'platform':'android', 'scriptSrc': '' }
+module.exports = function(project_dir){
+    return {
+        'cordova': 
+            { 'platform':'*', 'scriptSrc': path.join(project_dir,'cordova','version') },   
+        // no location needed for plugman as this should be the calling process
+        'cordova-plugman': 
+            { 'platform':'*', 'currentVersion': process.version },
+        'cordova-android': 
+            { 'platform':'android', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        'cordova-ios': 
+            { 'platform':'ios', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        'cordova-blackberry10': 
+            { 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        'cordova-wp7': 
+            { 'platform':'wp7', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        'cordova-wp8': 
+            { 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        'cordova-windows8': 
+            { 'platform':'windows8', 'scriptSrc': path.join(project_dir,'cordova','version') },
+        
+        // ideally these sdk versions will be known via a script
+        // that calls the sdk's version command - the idea would be that
+        // these version scripts output all in the same way and parse
+        // the appropriate blob of info returned from the sdk version command
+        'apple-xcode' : 
+            { 'platform':'ios', 'scriptSrc': '' },
+        'apple-ios' : 
+            { 'platform':'ios', 'scriptSrc': '' },
+        'blackberry-webworks' : 
+            // use path to sdk/Framework/lib/webworks-info.js 
+            // will export as version number
+            // currently though, all versions of webworks sdk should be good to go 
+            // so this is technically *not* needed right now
+            { 'platform':'blackberry10', 'scriptSrc': '' },
+        'android-sdk' : 
+            // will have to parse string output from android list targets
+            { 'platform':'android', 'scriptSrc': '' }
+    }
 };


[06/40] git commit: [CB-4036] - synching up with master and fixed failing tests

Posted by st...@apache.org.
[CB-4036] - synching up with master and fixed 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/eadd4ce0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/eadd4ce0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/eadd4ce0

Branch: refs/heads/ffos
Commit: eadd4ce05f86c05be001e95385a05238e0b5a37d
Parents: 5504bc2
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Aug 1 15:08:41 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 src/install.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/eadd4ce0/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 7ef27ad..d54ed1d 100644
--- a/src/install.js
+++ b/src/install.js
@@ -103,11 +103,9 @@ function getCurrentProjectVersion(versionPath, platformPath) {
     // setting version/platform to null if they do fail or do not exist and then just continuing
     
     var cordovaVersion, platformInfo;
-    
-    fs.chmodSync(versionPath, '755');
-    fs.chmodSync(platformPath, '755');
 
     if (fs.existsSync(versionPath)) {   
+        fs.chmodSync(versionPath, '755');
         var versionScript = shell.exec(versionPath, {silent: true});
         if (versionScript.code === 0) {
             cordovaVersion = versionScript.output.trim();
@@ -125,6 +123,7 @@ function getCurrentProjectVersion(versionPath, platformPath) {
     }  
     
     if (fs.existsSync(platformPath)) {   
+        fs.chmodSync(platformPath, '755');
         var platformScript = shell.exec(platformPath, {silent: true});
         if (platformScript.code === 0) {
             // thinking platformScript.output would be a JSON string like:
@@ -156,6 +155,7 @@ function getMinReq(pluginElement, platform){
             });
     
     
+    // these elements are still in flux - most likely to change when the platforms start implementing these scripts
     platformMinOS = pluginElement.findall('./platform[@name="'+platform+'"][@min-os-version]');
     platformMinOS = platformMinOS[0] ? platformMinOS[0].attrib["min-os-version"] : null
 


[40/40] git commit: Merge branch 'ffos' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into ffos

Posted by st...@apache.org.
Merge branch 'ffos' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into ffos


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

Branch: refs/heads/ffos
Commit: 6980f182cb7d444527144b7c1a1522d984aab634
Parents: 5f98a82 6825c2b
Author: Steven Gill <st...@gmail.com>
Authored: Thu Sep 12 11:13:58 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Sep 12 11:13:58 2013 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------



[11/40] git commit: [CB-4036] - added more tests and fixed up some logic

Posted by st...@apache.org.
[CB-4036] - added more tests and fixed up some logic


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

Branch: refs/heads/ffos
Commit: 9d6b99ea3512b6cb326ecd3e7365750e0407eb23
Parents: 0414fe4
Author: Tim Kim <ti...@adobe.com>
Authored: Wed Aug 21 15:10:18 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:17 2013 -0700

----------------------------------------------------------------------
 spec/install.spec.js                        | 18 ++++++++
 spec/plugins/EnginePlugin/plugin.xml        |  5 +--
 spec/plugins/EnginePluginAndroid/plugin.xml | 31 +++++++++++++
 src/install.js                              | 56 +++++++++++-------------
 src/util/default-engines.js                 | 22 +++++-----
 5 files changed, 87 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9d6b99ea/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index f3f2e51..22740ef 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -74,6 +74,17 @@ describe('install', function() {
             install('android', temp, 'engineplugin', plugins_dir, {});
             expect(spy).toHaveBeenCalledWith('3.0.0-rc1','>=2.3.0');
         });
+        it('should check specific platform version if specified', function() {
+            var spy = spyOn(semver, 'satisfies').andReturn(true);
+            exec.andReturn({code:0,output:"3.1.0"});
+            install('android', temp, 'enginepluginAndroid', plugins_dir, {});
+            expect(spy).toHaveBeenCalledWith('3.1.0','>=3.1.0');
+        });
+        it('should check plugmans version', function() {
+            var spy = spyOn(semver, 'satisfies').andReturn(true);
+            install('android', temp, 'engineplugin', plugins_dir, {});
+            expect(spy).toHaveBeenCalledWith(null,'>=0.10.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, {});
             expect(actions_push.calls.length).toEqual(3);
@@ -135,5 +146,12 @@ describe('install', function() {
                 install('android', temp, 'https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git', plugins_dir, {});
             }).toThrow('"git" command line tool is not installed: make sure it is accessible on your PATH.');
         });
+        it('should throw if plugin version is less than the minimum requirement', function(){
+            var spy = spyOn(semver, 'satisfies').andReturn(false);
+            exec.andReturn({code:0,output:"0.0.1"});
+            expect(function() {
+                install('android', temp, 'engineplugin', plugins_dir, {});
+             }).toThrow('Plugin doesn\'t support this project\'s cordova version. cordova: 0.0.1, failed version requirement: >=2.3.0');        
+        });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9d6b99ea/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 72bf190..4d9332f 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -24,9 +24,8 @@
     <name>Engine Choo Choo</name>
 
     <engines>
-        <engine name="cordova" version=">=2.3.0" platform="*" />
-        <engine name="cordova-plugman" version=">=0.10.0" platform="*" />
-        <engine name="cordova-android" version=">=3.1.0" platform="*" />
+        <engine name="cordova" version=">=2.3.0"/>
+        <engine name="cordova-plugman" version=">=0.10.0" />
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9d6b99ea/spec/plugins/EnginePluginAndroid/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePluginAndroid/plugin.xml b/spec/plugins/EnginePluginAndroid/plugin.xml
new file mode 100644
index 0000000..894bd02
--- /dev/null
+++ b/spec/plugins/EnginePluginAndroid/plugin.xml
@@ -0,0 +1,31 @@
+<?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=">=3.0.0"/>
+        <engine name="cordova-android" version=">=3.1.0"/>
+    </engines>
+    
+</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9d6b99ea/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 59334dc..cfaead9 100644
--- a/src/install.js
+++ b/src/install.js
@@ -99,20 +99,20 @@ function callEngineScripts(engines) {
     var engineScriptVersion;
     
     engines.forEach(function(engine){
-        if(fs.existsSync(engine.scriptTarget)){
-            fs.chmodSync(engine.scriptTarget, '755');
-            engineScript = shell.exec(engine.scriptTarget, {silent: true});
+        if(fs.existsSync(engine.scriptSrc)){
+            fs.chmodSync(engine.scriptSrc, '755');
+            engineScript = shell.exec(engine.scriptSrc, {silent: true});
             if (engineScript.code === 0) {
                 engineScriptVersion = cleanVersionOutput(engineScript.output, engine.platform)
             }else{
                 engineScriptVersion = null;
-                require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' script failed (has a '+ engine.scriptTarget +' script, but something went wrong executing it), continuing anyways.');
+                require('../plugman').emit('log', 'Cordova project '+ engine.scriptSrc +' script failed (has a '+ engine.scriptSrc +' script, but something went wrong executing it), continuing anyways.');
             }  
         }else if(engine.currentVersion){
             engineScriptVersion = cleanVersionOutput(engine.currentVersion, engine.platform)           
         }else{
             engineScriptVersion = null;
-            require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' not detected (lacks a '+ engine.scriptTarget +' script), continuing.');
+            require('../plugman').emit('log', 'Cordova project '+ engine.scriptSrc +' not detected (lacks a '+ engine.scriptSrc +' script), continuing.');
         } 
         engine.currentVersion = engineScriptVersion;
     });
@@ -125,34 +125,28 @@ function getEngines(pluginElement, platform, project_dir){
     var engines = pluginElement.findall('engines/engine');
     var defaultEngines = require('./util/default-engines');
     var uncheckedEngines = [];
-    var tempEngine;
-    var cordovaEngineIndex;
-    var cordovaPlatformEngineIndex;
-    
-    var theName;
+    var tempEngine, cordovaEngineIndex, cordovaPlatformEngineIndex, theName;
     // load in known defaults and update when necessary
     engines.forEach(function(engine){   
-        if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
-            theName = engine.attrib["name"];
-            if(defaultEngines[theName]){
-                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib["version"];
-                defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
-                defaultEngines[theName].scriptTarget = defaultEngines[theName].scriptTarget ? path.join(project_dir, defaultEngines[theName].scriptTarget) : null;
-                defaultEngines[theName].name = theName;
-                
-                // set the indices so we can pop the cordova engine when needed
-                if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
-                if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
-                
-                uncheckedEngines.push(defaultEngines[theName]);
-                
-            }else{
-                // check for other engines
-                tempEngine = {};
-                tempEngine[theName] = { 'platform': engine.attrib["platform"], 'scriptTarget':path.join(project_dir,engine.attrib["scriptTarget"]), 'minVersion' :  engine.attrib["version"]};
-                uncheckedEngines.push(tempEngine);
-            }
-        }    
+        theName = engine.attrib["name"];
+        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;
+            defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? path.join(project_dir, defaultEngines[theName].scriptSrc) : null;
+            defaultEngines[theName].name = theName;
+            
+            // set the indices so we can pop the cordova engine when needed
+            if(theName==='cordova') cordovaEngineIndex = uncheckedEngines.length;
+            if(theName==='cordova-'+platform) cordovaPlatformEngineIndex = uncheckedEngines.length;
+            
+            uncheckedEngines.push(defaultEngines[theName]);
+            
+        }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);
+        }
     });
     
     // make sure we check for platform req's and not just cordova reqs

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9d6b99ea/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index b041951..0ab9b4f 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -6,38 +6,38 @@ var path = require('path');
 
 module.exports = {
     'cordova': 
-        { 'platform':'*', 'scriptTarget': path.join('cordova','version') },   
+        { 'platform':'*', 'scriptSrc': path.join('cordova','version') },   
     // no location needed for plugman as this should be the calling process
     'cordova-plugman': 
         { 'platform':'*', 'currentVersion': process.version },
     'cordova-android': 
-        { 'platform':'android', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'android', 'scriptSrc': path.join('cordova','version') },
     'cordova-ios': 
-        { 'platform':'ios', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'ios', 'scriptSrc': path.join('cordova','version') },
     'cordova-blackberry10': 
-        { 'platform':'blackberry10', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'blackberry10', 'scriptSrc': path.join('cordova','version') },
     'cordova-wp7': 
-        { 'platform':'wp7', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'wp7', 'scriptSrc': path.join('cordova','version') },
     'cordova-wp8': 
-        { 'platform':'wp8', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'wp8', 'scriptSrc': path.join('cordova','version') },
     'cordova-windows8': 
-        { 'platform':'windows8', 'scriptTarget': path.join('cordova','version') },
+        { 'platform':'windows8', 'scriptSrc': path.join('cordova','version') },
     
     // ideally these sdk versions will be known via a script
     // that calls the sdk's version command - the idea would be that
     // these version scripts output all in the same way and parse
     // the appropriate blob of info returned from the sdk version command
     'apple-xcode' : 
-        { 'platform':'ios', 'scriptTarget': '' },
+        { 'platform':'ios', 'scriptSrc': '' },
     'apple-ios' : 
-        { 'platform':'ios', 'scriptTarget': '' },
+        { 'platform':'ios', 'scriptSrc': '' },
     'blackberry-webworks' : 
         // use path to sdk/Framework/lib/webworks-info.js 
         // will export as version number
         // currently though, all versions of webworks sdk should be good to go 
         // so this is technically *not* needed right now
-        { 'platform':'blackberry10', 'scriptTarget': '' },
+        { 'platform':'blackberry10', 'scriptSrc': '' },
     'android-sdk' : 
         // will have to parse string output from android list targets
-        { 'platform':'android', 'scriptTarget': '' }
+        { 'platform':'android', 'scriptSrc': '' }
 };


[20/40] git commit: Fix use for path.join etc. for web paths as opposed to platform paths.

Posted by st...@apache.org.
Fix use for path.join etc. for web paths as opposed to platform paths.


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

Branch: refs/heads/ffos
Commit: f276c21dc1e550316d9728361c2202c5a3338610
Parents: 479d339
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Sep 3 14:41:46 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue Sep 3 14:41:46 2013 -0400

----------------------------------------------------------------------
 src/prepare.js | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f276c21d/src/prepare.js
----------------------------------------------------------------------
diff --git a/src/prepare.js b/src/prepare.js
index aed3f48..7ccb3d0 100644
--- a/src/prepare.js
+++ b/src/prepare.js
@@ -140,10 +140,13 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir) {
     
             allModules.forEach(function(module) {
                 // Copy the plugin's files into the www directory.
-                var dirname = path.dirname(module.attrib.src);
-    
-                var dir = path.join(platformPluginsDir, plugin_id, dirname);
-                shell.mkdir('-p', dir);
+                // NB: We can't always use path.* functions here, because they will use platform slashes.
+                // But the path in the plugin.xml and in the cordova_plugins.js should be always forward slashes.
+                var pathParts = module.attrib.src.split('/');
+
+                var fsDirname = path.join.apply(path, pathParts.slice(0, -1));
+                var fsDir = path.join(platformPluginsDir, plugin_id, fsDirname);
+                shell.mkdir('-p', fsDir);
     
                 // Read in the file, prepend the cordova.define, and write it back out.
                 var moduleName = plugin_id + '.';
@@ -154,16 +157,17 @@ module.exports = function handlePrepare(project_dir, platform, plugins_dir) {
                     moduleName += result[1];
                 }
     
-                var scriptContent = fs.readFileSync(path.join(pluginDir, module.attrib.src), 'utf-8');
+                var fsPath = path.join.apply(path, pathParts);
+                var scriptContent = fs.readFileSync(path.join(pluginDir, fsPath), 'utf-8');
                 scriptContent = 'cordova.define("' + moduleName + '", function(require, exports, module) {' + scriptContent + '});\n';
-                fs.writeFileSync(path.join(platformPluginsDir, plugin_id, module.attrib.src), scriptContent, 'utf-8');
+                fs.writeFileSync(path.join(platformPluginsDir, plugin_id, fsPath), scriptContent, 'utf-8');
                 if(platform == 'wp7' || platform == 'wp8' || platform == "windows8") {
-                    wp_csproj.addSourceFile(path.join('www', 'plugins', plugin_id, module.attrib.src));
+                    wp_csproj.addSourceFile(path.join('www', 'plugins', plugin_id, fsPath));
                 }
     
                 // Prepare the object for cordova_plugins.json.
                 var obj = {
-                    file: path.join('plugins', plugin_id, module.attrib.src),
+                    file: ['plugins', plugin_id, module.attrib.src].join('/'),
                     id: moduleName
                 };
     


[08/40] git commit: [CB-4036] - fixed up some failing tests

Posted by st...@apache.org.
[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 <ti...@adobe.com>
Authored: Thu Aug 1 14:18:59 2013 -0700
Committer: Tim Kim <ti...@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);
     


[03/40] git commit: [CB-4490 & CB-4036] - added check for cordova-plugman and made a util function

Posted by st...@apache.org.
[CB-4490 & CB-4036] - added check for cordova-plugman and made a util function


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

Branch: refs/heads/ffos
Commit: c06a07ef550e845bdbf396714357d0fcf312c19a
Parents: faccfd5
Author: Tim Kim <ti...@adobe.com>
Authored: Tue Aug 13 15:11:50 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/plugin.xml |  1 +
 src/install.js                       | 26 +++++++++++++++-----------
 src/util/default-engines.js          | 13 ++++++++++++-
 3 files changed, 28 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c06a07ef/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index fe875a3..169e8d1 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -25,6 +25,7 @@
 
     <engines>
         <engine name="cordova" version=">=2.3.0" platform="*" />
+        <engine name="cordova-plugman" version=">=0.10.0" platform="*" />
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c06a07ef/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index accc25a..4e88b80 100644
--- a/src/install.js
+++ b/src/install.js
@@ -77,6 +77,15 @@ function checkMinimumReq(engines, callback) {
     });
 }
 
+function cleanVersionRC(version){
+    var out = version.trim();
+    var rc_index = out.indexOf('rc');
+    if (rc_index > -1) {
+        out = out.substr(0, rc_index) + '-' + out.substr(rc_index);
+    }    
+    return out;
+}
+
 // exec engine scripts in order to get the current engine version
 function callEngineScripts(engines) {
     var engineScript;
@@ -86,18 +95,14 @@ function callEngineScripts(engines) {
         if(fs.existsSync(engine.scriptTarget)){
             fs.chmodSync(engine.scriptTarget, '755');
             engineScript = shell.exec(engine.scriptTarget, {silent: true});
-            
             if (engineScript.code === 0) {
-                engineScriptVersion = engineScript.output.trim();
-                var rc_index = engineScriptVersion.indexOf('rc');
-                if (rc_index > -1) {
-                    engineScriptVersion = engineScriptVersion.substr(0, rc_index) + '-' + engineScriptVersion.substr(rc_index);
-                }
-                
+                engineScriptVersion = cleanVersionRC(engineScript.output)
             }else{
                 engineScriptVersion = null;
                 require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' script failed (has a '+ engine.scriptTarget +' script, but something went wrong executing it), continuing anyways.');
-            }            
+            }  
+        }else if(engine.minVersion){
+            engineScriptVersion = cleanVersionRC(engine.minVersion)           
         }else{
             engineScriptVersion = null;
             require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' not detected (lacks a '+ engine.scriptTarget +' script), continuing.');
@@ -114,14 +119,13 @@ function getEngines(pluginElement, platform, project_dir){
     var defaultEngines = require('./util/default-engines');
     var uncheckedEngines = [];
     var tempEngine;
-
     // load in all known defaults and compare
     engines.forEach(function(engine){   
         // this may need some changes - what to do for default platforms - why need to specify platforms?
         if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
             if(defaultEngines[engine.attrib["name"]]){
-                defaultEngines[engine.attrib["name"]].minVersion = engine.attrib["version"];
-                defaultEngines[engine.attrib["name"]].scriptTarget = path.join(project_dir, defaultEngines[engine.attrib["name"]].scriptTarget);
+                defaultEngines[engine.attrib["name"]].minVersion = defaultEngines[engine.attrib["name"]].minVersion ? defaultEngines[engine.attrib["name"]].minVersion : engine.attrib["version"];
+                defaultEngines[engine.attrib["name"]].scriptTarget = defaultEngines[engine.attrib["name"]].scriptTarget ? path.join(project_dir, defaultEngines[engine.attrib["name"]].scriptTarget) : null;
                 uncheckedEngines.push(defaultEngines[engine.attrib["name"]]);
             }else{
                 // check for other engines

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c06a07ef/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index 4499df6..e1a26d1 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -7,8 +7,9 @@ var path = require('path');
 module.exports = {
     'cordova': 
         { 'platform':'*', 'scriptTarget': path.join('cordova','version') },   
+    // no location needed for plugman as this should be the calling process
     'cordova-plugman': 
-        { 'platform':'*', 'scriptTarget': '' },
+        { 'platform':'*', 'minVersion': process.version },
     'cordova-android': 
         { 'platform':'android', 'scriptTarget': '' },
     'cordova-ios': 
@@ -21,12 +22,22 @@ module.exports = {
         { 'platform':'wp8', 'scriptTarget': '' },
     'cordova-windows8': 
         { 'platform':'windows8', 'scriptTarget': '' },
+    
+    // ideally these sdk versions will be known via a script
+    // that calls the sdk's version command - the idea would be that
+    // these version scripts output all in the same way and parse
+    // the appropriate blob of info returned from the sdk version command
     'apple-xcode' : 
         { 'platform':'ios', 'scriptTarget': '' },
     'apple-ios' : 
         { 'platform':'ios', 'scriptTarget': '' },
     'blackberry-webworks' : 
+        // use path to sdk/Framework/lib/webworks-info.js 
+        // will export as version number
+        // currently though, all versions of webworks sdk should be good to go 
+        // so this is technically *not* needed right now
         { 'platform':'blackberry10', 'scriptTarget': '' },
     'android-sdk' : 
+        // will have to parse string output from android list targets
         { 'platform':'android', 'scriptTarget': '' }
 };


[26/40] git commit: [CB-4714] Add -f option to 'plugin rm' to forcefully remove a plugin.

Posted by st...@apache.org.
[CB-4714] Add -f option to 'plugin rm' to forcefully remove a plugin.


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

Branch: refs/heads/ffos
Commit: c2461bc946555a3f43928d35ba1768c3cdcff03a
Parents: d9ee339
Author: jbondc <jb...@openmv.com>
Authored: Mon Sep 2 09:53:40 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 4 13:58:51 2013 -0400

----------------------------------------------------------------------
 src/uninstall.js         | 28 ++++++++++++++++++++--------
 src/util/dependencies.js | 10 ++++++++--
 2 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c2461bc9/src/uninstall.js
----------------------------------------------------------------------
diff --git a/src/uninstall.js b/src/uninstall.js
index c0cddf5..f87ec20 100644
--- a/src/uninstall.js
+++ b/src/uninstall.js
@@ -44,8 +44,10 @@ module.exports.uninstallPlatform = function(platform, project_dir, id, plugins_d
 
 module.exports.uninstallPlugin = function(id, plugins_dir, callback) {
     var plugin_dir = path.join(plugins_dir, id);
-    // If already removed, skip.
+    
+    // If already removed, skip.    
     if (!fs.existsSync(plugin_dir)) {
+        // console.log("Skipped " + plugin_dir + " (not found)");
         if (callback) callback();
         return;
     }
@@ -75,24 +77,34 @@ module.exports.uninstallPlugin = function(id, plugins_dir, callback) {
 
 // possible options: cli_variables, www_dir, is_top_level
 function runUninstall(actions, platform, project_dir, plugin_dir, plugins_dir, options, callback) {
-    var xml_path     = path.join(plugin_dir, 'plugin.xml')
-      , plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
+    var xml_path     = path.join(plugin_dir, 'plugin.xml');
+    if (!fs.existsSync(xml_path)) {
+        // log warning?
+        return;
+    }
+    
+    var plugin_et    = xml_helpers.parseElementtreeSync(xml_path);
     var plugin_id    = plugin_et._root.attrib['id'];
     options = options || {};
 
-    var dependency_info = dependencies.generate_dependency_info(plugins_dir, platform);
+    var dependency_info = dependencies.generate_dependency_info(plugins_dir, platform, 'remove');
     var graph = dependency_info.graph;
     var dependents = graph.getChain(plugin_id);
 
+    var forced = options.cmd && (options.cmd.indexOf('-f') + options.cmd.indexOf('-force') > -2);   
     var tlps = dependency_info.top_level_plugins;
     var diff_arr = [];
     tlps.forEach(function(tlp) {
         if (tlp != plugin_id) {
             var ds = graph.getChain(tlp);
             if (options.is_top_level && ds.indexOf(plugin_id) > -1) {
-                var err = new Error('Another top-level plugin (' + tlp + ') relies on plugin ' + plugin_id + ', therefore aborting uninstallation.');
-                if (callback) return callback(err);
-                else throw err;
+                if(forced) {
+                    require('../plugman').emit('log', tlp + ' depends on '+ plugin_id + ', but forcing removal...');
+                } else {
+                    var err = new Error('Another top-level plugin (' + tlp + ') relies on plugin ' + plugin_id + ', therefore aborting uninstallation.');
+                    if (callback) return callback(err);
+                    else throw err;
+                }
             }
             diff_arr.push(ds);
         }
@@ -171,7 +183,7 @@ function handleUninstall(actions, platform, plugin_id, plugin_et, project_dir, w
             // queue up the plugin so prepare can remove the config changes
             config_changes.add_uninstalled_plugin_to_prepare_queue(plugins_dir, path.basename(plugin_dir), platform, is_top_level);
             // call prepare after a successful uninstall
-            require('./../plugman').prepare(project_dir, platform, plugins_dir);
+            require('../plugman').prepare(project_dir, platform, plugins_dir);
             if (callback) callback();
         }
     });

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c2461bc9/src/util/dependencies.js
----------------------------------------------------------------------
diff --git a/src/util/dependencies.js b/src/util/dependencies.js
index 32e07eb..bf40eb1 100644
--- a/src/util/dependencies.js
+++ b/src/util/dependencies.js
@@ -1,10 +1,11 @@
 var dep_graph = require('dep-graph'),
     path = require('path'),
+    fs = require('fs'),
     config_changes = require('./config-changes'),
     xml_helpers = require('./xml-helpers');
 
 module.exports = {
-    generate_dependency_info:function(plugins_dir, platform) {
+    generate_dependency_info:function(plugins_dir, platform, context) {
         var json = config_changes.get_platform_json(plugins_dir, platform);
         var tlps = [];
         var graph = new dep_graph();
@@ -18,7 +19,12 @@ module.exports = {
             });
         });
         Object.keys(json.dependent_plugins).forEach(function(plug) {
-            var xml = xml_helpers.parseElementtreeSync(path.join(plugins_dir, plug, 'plugin.xml'));
+            var xmlPath = path.join(plugins_dir, plug, 'plugin.xml');
+            if (context == 'remove' && !fs.existsSync(xmlPath)) {
+                return; // dependency may have been forcefully removed
+            }
+
+            var xml = xml_helpers.parseElementtreeSync(xmlPath);
             var deps = xml.findall('dependency');
             deps && deps.forEach(function(dep) {
                 var id = dep.attrib.id;


[28/40] git commit: [CB-4036] - forgot to add .bat to windows version paths

Posted by st...@apache.org.
[CB-4036] - forgot to add .bat to windows version paths


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

Branch: refs/heads/ffos
Commit: 83bc35e3241585f78bc14ffb8743c136c2c84fcf
Parents: db43ef2
Author: Tim Kim <ti...@adobe.com>
Authored: Wed Sep 4 11:31:59 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Wed Sep 4 11:31:59 2013 -0700

----------------------------------------------------------------------
 src/util/default-engines.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/83bc35e3/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
index ce5f454..4fd4a65 100644
--- a/src/util/default-engines.js
+++ b/src/util/default-engines.js
@@ -14,11 +14,11 @@ module.exports = function(project_dir){
         'cordova-blackberry10': 
             { 'platform':'blackberry10', 'scriptSrc': path.join(project_dir,'cordova','version') },
         'cordova-wp7': 
-            { 'platform':'wp7', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform':'wp7', 'scriptSrc': path.join(project_dir,'cordova','version.bat') },
         'cordova-wp8': 
-            { 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform':'wp8', 'scriptSrc': path.join(project_dir,'cordova','version.bat') },
         'cordova-windows8': 
-            { 'platform':'windows8', 'scriptSrc': path.join(project_dir,'cordova','version') },
+            { 'platform':'windows8', 'scriptSrc': path.join(project_dir,'cordova','version.bat') },
         
         // TODO: these scripts have not been made!
         'apple-xcode' : 


[37/40] git commit: add full ff support to plugman

Posted by st...@apache.org.
add full ff support to plugman


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

Branch: refs/heads/ffos
Commit: 5d2cb2119e3da9480882a29075788d49191c8190
Parents: f7cf860
Author: Steven Gill <st...@gmail.com>
Authored: Fri Aug 23 18:43:54 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Sep 12 11:13:07 2013 -0700

----------------------------------------------------------------------
 main.js                       |  2 +-
 plugman.js                    |  2 +-
 src/install.js                |  5 +----
 src/platforms/blackberry10.js |  2 ++
 src/platforms/firefoxos.js    | 18 +++++++++++++++++-
 src/util/config-changes.js    |  3 +--
 6 files changed, 23 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 88fd7f2..47e63c6 100755
--- a/main.js
+++ b/main.js
@@ -26,7 +26,7 @@ var path = require('path')
     , plugins = require('./src/util/plugins')
     , plugman = require('./plugman');
 
-var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' , 'windows8' ]
+var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' , 'windows8', 'firefoxos' ]
         , 'project' : path
         , 'plugin' : [String, path, url]
         , 'version' : Boolean

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 625933d..e1f7745 100755
--- a/plugman.js
+++ b/plugman.js
@@ -58,7 +58,7 @@ plugman.commands =  {
     },
     'install'  : function(cli_opts) {
         if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
-            return console.log(plugman.help());
+            return //console.log(plugman.help());
         }
         var cli_variables = {}
         if (cli_opts.variable) {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index d94f367..1915f85 100644
--- a/src/install.js
+++ b/src/install.js
@@ -37,9 +37,7 @@ module.exports = function installPlugin(platform, project_dir, id, plugins_dir,
         if (callback) return callback(err);
         else throw err;
     }
-
     var current_stack = new action_stack();
-
     options.is_top_level = true;
     possiblyFetch(current_stack, platform, project_dir, id, plugins_dir, options, callback);
 };
@@ -326,7 +324,7 @@ function handleInstall(actions, plugin_id, plugin_et, platform, project_dir, plu
             resourceFiles = platformTag.findall('./resource-file'),
             libFiles = platformTag.findall('./lib-file');
         assets = assets.concat(platformTag.findall('./asset'));
-
+        
         // queue up native stuff
         sourceFiles && sourceFiles.forEach(function(source) {
             actions.push(actions.createAction(handler["source-file"].install, [source, plugin_dir, project_dir, plugin_id], handler["source-file"].uninstall, [source, project_dir, plugin_id]));
@@ -357,7 +355,6 @@ function handleInstall(actions, plugin_id, plugin_et, platform, project_dir, plu
             if (callback) callback(err);
             else throw err;
         } else {
-
             // queue up the plugin so prepare knows what to do.
             config_changes.add_installed_plugin_to_prepare_queue(plugins_dir, plugin_basename, platform, filtered_variables, is_top_level);
             // call prepare after a successful install

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/src/platforms/blackberry10.js
----------------------------------------------------------------------
diff --git a/src/platforms/blackberry10.js b/src/platforms/blackberry10.js
index c3d1ce9..bb9f2e1 100644
--- a/src/platforms/blackberry10.js
+++ b/src/platforms/blackberry10.js
@@ -37,8 +37,10 @@ module.exports = {
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
             var src = source_el.attrib['src'];
             var target = source_el.attrib['target-dir'] || plugin_id;
+            console.log(target);
             TARGETS.forEach(function(arch) {
                 var dest = path.join("native", arch, "chrome", "plugin", target, path.basename(src));
+                console.log(dest);
                 common.copyFile(plugin_dir, src, project_dir, dest);
             });
         },

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/src/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/src/platforms/firefoxos.js b/src/platforms/firefoxos.js
index d177318..db325d3 100644
--- a/src/platforms/firefoxos.js
+++ b/src/platforms/firefoxos.js
@@ -1,7 +1,23 @@
-var path = require('path');
+var path = require('path')
+    , common = require('./common');
 
 module.exports = {
     www_dir: function(project_dir) {
         return path.join(project_dir, 'www');
+    },
+    package_name:function(project_dir) {
+        var config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+        var widget_doc = xml_helpers.parseElementtreeSync(config_path);
+        return widget_doc._root.attrib['id'];
+    },
+    "source-file":{
+        install:function(source_el, plugin_dir, project_dir, plugin_id) {
+            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+            common.copyFile(plugin_dir, source_el.attrib['src'], project_dir, dest);
+        },
+        uninstall:function(source_el, project_dir, plugin_id) {
+            var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
+            common.removeFile(project_dir, dest);
+        }
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5d2cb211/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
index 3c79bde..7ebd8b8 100644
--- a/src/util/config-changes.js
+++ b/src/util/config-changes.js
@@ -55,7 +55,6 @@ var keep_these_frameworks = [
 module.exports = {
     add_installed_plugin_to_prepare_queue:function(plugins_dir, plugin, platform, vars, is_top_level) {
         checkPlatform(platform);
-
         var config = module.exports.get_platform_json(plugins_dir, platform);
         config.prepare_queue.installed.push({'plugin':plugin, 'vars':vars, 'topLevel':is_top_level});
         module.exports.save_platform_json(config, plugins_dir, platform);
@@ -284,6 +283,7 @@ module.exports = {
     add_plugin_changes:function(platform, project_dir, plugins_dir, plugin_id, plugin_vars, is_top_level, should_increment) {
         var platform_config = module.exports.get_platform_json(plugins_dir, platform);
         var plugin_dir = path.join(plugins_dir, plugin_id);
+        
         plugin_id = xml_helpers.parseElementtreeSync(path.join(plugin_dir, 'plugin.xml'), 'utf-8')._root.attrib['id'];
 
         // get config munge, aka how should this plugin change various config files
@@ -409,7 +409,6 @@ module.exports = {
         checkPlatform(platform);
 
         var platform_config = module.exports.get_platform_json(plugins_dir, platform);
-
         // Uninstallation first
         platform_config.prepare_queue.uninstalled.forEach(function(u) {
             module.exports.remove_plugin_changes(platform, project_dir, plugins_dir, u.plugin, u.id, u.topLevel, true);


[23/40] git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman

Posted by st...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-plugman


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

Branch: refs/heads/ffos
Commit: c97c4cbe1744c38e5577f1e2f7406bf59e2dc84b
Parents: 07d2a49 73c3aa7
Author: Anis Kadri <an...@apache.org>
Authored: Tue Sep 3 15:49:02 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Tue Sep 3 15:49:02 2013 -0700

----------------------------------------------------------------------
 spec/fetch.spec.js | 18 ++++++++++++++++++
 src/fetch.js       | 18 ++++++++++++++++++
 src/prepare.js     | 20 ++++++++++++--------
 3 files changed, 48 insertions(+), 8 deletions(-)
----------------------------------------------------------------------



[19/40] git commit: CB-4492 updated download tracking

Posted by st...@apache.org.
CB-4492 updated download tracking


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

Branch: refs/heads/ffos
Commit: 479d339d28941ec0faa47c02170ea46e66e072a7
Parents: cfa431b
Author: Anis Kadri <an...@apache.org>
Authored: Thu Aug 29 16:19:47 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Aug 29 16:19:47 2013 -0700

----------------------------------------------------------------------
 src/registry/registry.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/479d339d/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index 1ab5de1..ba22520 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -34,7 +34,7 @@ function getPackageInfo(args, cb) {
     
     http.get(settings.registry + '/' + name + '/' + version, function(res) {
          if(res.statusCode != 200) {
-                 var err = new Error('Error');
+                 var err = new Error('error: Could not fetch package information for '+name);
                  if (cb) cb(err);
                  else throw err;
          } else {
@@ -80,13 +80,14 @@ function fetchPackage(info, cb) {
                 // (for lacking a _rev), and dropped a download count is not important.
                 var now = new Date();
                 var pkgId = info._id.substring(0, info._id.indexOf('@'));
-                var id = pkgId + '_' + now.toISOString();
                 var uri = url.parse(module.exports.settings.registry);
                 // Overriding the path to point at /downloads.
-                uri.path = '/downloads/' + id;
-                uri.method = 'PUT';
+                uri.path = '/downloads';
+                uri.method = 'POST';
                 var dlcReq = http.request(uri);
 
+                dlcReq.setHeader('Content-Type', 'application/json');
+
                 dlcReq.write(JSON.stringify({
                     day: now.getUTCFullYear() + '-' + (now.getUTCMonth()+1) + '-' + now.getUTCDate(),
                     pkg: pkgId


[24/40] git commit: [CB-4502] Ignore www/config.xml, projects in ^[xyz].* now work

Posted by st...@apache.org.
[CB-4502] Ignore www/config.xml, projects in ^[xyz].* now work


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

Branch: refs/heads/ffos
Commit: d9ee339d34b8934fa4f657eeaf5fca40ea4f9aa0
Parents: c97c4cb
Author: Braden Shepherdson <br...@gmail.com>
Authored: Wed Sep 4 11:03:06 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Wed Sep 4 11:04:07 2013 -0400

----------------------------------------------------------------------
 src/platforms/ios.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d9ee339d/src/platforms/ios.js
----------------------------------------------------------------------
diff --git a/src/platforms/ios.js b/src/platforms/ios.js
index 278746f..bb5c597 100644
--- a/src/platforms/ios.js
+++ b/src/platforms/ios.js
@@ -134,7 +134,7 @@ module.exports = {
                            );
 
         config_files = config_files.filter(function (val) {
-            return !(/^build\//.test(val));
+            return !(/^build\//.test(val)) && !(/\/www\/config.xml$/.test(val));
         });
 
         if (config_files.length === 0) {


[18/40] git commit: Add download count pushing to the registry fetching.

Posted by st...@apache.org.
Add download count pushing to the registry fetching.


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

Branch: refs/heads/ffos
Commit: cfa431bc0eca19398a3ca5e3ba79029e42d85104
Parents: 6e76e3a
Author: Braden Shepherdson <br...@gmail.com>
Authored: Wed Aug 28 16:23:54 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Wed Aug 28 16:23:54 2013 -0400

----------------------------------------------------------------------
 src/registry/registry.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/cfa431bc/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index 34e566c..1ab5de1 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -1,6 +1,7 @@
 var npm = require('npm'),
     path = require('path'),
     http = require('http'),
+    url = require('url'),
     targz = require('tar.gz'),
     fs = require('fs'),
     manifest = require('./manifest'),
@@ -71,6 +72,27 @@ function fetchPackage(info, cb) {
                 if (cb) cb(err);
                 else throw err;
             } else {
+                // Update the download count for this plugin.
+                // Fingers crossed that the timestamps are unique, and that no plugin is downloaded
+                // twice in a single millisecond.
+                //
+                // This is acceptable, because the failure mode is Couch gracefully rejecting the second one
+                // (for lacking a _rev), and dropped a download count is not important.
+                var now = new Date();
+                var pkgId = info._id.substring(0, info._id.indexOf('@'));
+                var id = pkgId + '_' + now.toISOString();
+                var uri = url.parse(module.exports.settings.registry);
+                // Overriding the path to point at /downloads.
+                uri.path = '/downloads/' + id;
+                uri.method = 'PUT';
+                var dlcReq = http.request(uri);
+
+                dlcReq.write(JSON.stringify({
+                    day: now.getUTCFullYear() + '-' + (now.getUTCMonth()+1) + '-' + now.getUTCDate(),
+                    pkg: pkgId
+                }));
+                dlcReq.end();
+
                 res.pipe(filestream);
                 filestream.on('finish', function() {
                     var decompress = new targz().extract(filename, target, function(err) {


[38/40] git commit: add firefoxos

Posted by st...@apache.org.
add firefoxos


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

Branch: refs/heads/ffos
Commit: f7cf8604f60efec6de8ad9ab4e5d362133ae9e29
Parents: 7bd0266
Author: James Long <lo...@gmail.com>
Authored: Wed Aug 14 15:38:09 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Sep 12 11:13:07 2013 -0700

----------------------------------------------------------------------
 src/platforms.js           | 3 ++-
 src/platforms/firefoxos.js | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f7cf8604/src/platforms.js
----------------------------------------------------------------------
diff --git a/src/platforms.js b/src/platforms.js
index 5d879b7..bcd2613 100644
--- a/src/platforms.js
+++ b/src/platforms.js
@@ -4,5 +4,6 @@ module.exports = {
     'blackberry10': require('./platforms/blackberry10'),
     'wp7': require('./platforms/wp7'),
     'wp8': require('./platforms/wp8'),
-    'windows8' : require('./platforms/windows8')
+    'windows8' : require('./platforms/windows8'),
+    'firefoxos': require('./platforms/firefoxos')
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f7cf8604/src/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/src/platforms/firefoxos.js b/src/platforms/firefoxos.js
new file mode 100644
index 0000000..d177318
--- /dev/null
+++ b/src/platforms/firefoxos.js
@@ -0,0 +1,7 @@
+var path = require('path');
+
+module.exports = {
+    www_dir: function(project_dir) {
+        return path.join(project_dir, 'www');
+    }
+};


[32/40] git commit: CB-4770 dependent plugins can be fetched from registry

Posted by st...@apache.org.
CB-4770 dependent plugins can be fetched from registry


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

Branch: refs/heads/ffos
Commit: 6486e7fda601b8ba427f0f16df59c3193f90389b
Parents: b05729a
Author: Anis Kadri <an...@apache.org>
Authored: Mon Sep 9 15:53:00 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Sep 9 15:53:00 2013 -0700

----------------------------------------------------------------------
 spec/install.spec.js | 11 +++++++++++
 src/install.js       |  5 +++++
 2 files changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/6486e7fd/spec/install.spec.js
----------------------------------------------------------------------
diff --git a/spec/install.spec.js b/spec/install.spec.js
index 1639fce..c1cbdf9 100644
--- a/spec/install.spec.js
+++ b/spec/install.spec.js
@@ -146,6 +146,17 @@ describe('install', function() {
                 expect(s).toHaveBeenCalledWith('C', deps_dir, { link: false, subdir: undefined, git_ref: undefined}, jasmine.any(Function));
                 expect(s.calls.length).toEqual(3);
             });
+            it('should try to fetch any dependent plugins from registry when url is not defined', function() {
+                var deps_dir = path.join(plugins_dir, 'dependencies'),
+                    s = spyOn(plugman, 'fetch').andCallFake(function(id, dir, opts, cb) {
+                    cb(false, path.join(dir, id));
+                });
+                exists.andReturn(false);
+                // Plugin A depends on C & D
+                install('android', temp, 'E', deps_dir, {});
+                expect(s).toHaveBeenCalledWith('D', deps_dir, { link: false, subdir: undefined, git_ref: undefined}, jasmine.any(Function));
+                expect(s.calls.length).toEqual(2);
+            });
         });
     });
 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/6486e7fd/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index 1959f07..d94f367 100644
--- a/src/install.js
+++ b/src/install.js
@@ -295,6 +295,11 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
                     git_ref: dep_git_ref
                 };
 
+                // CB-4770: registry fetching
+                if(dep_url === undefined) {
+                    dep_url = dep_plugin_id;
+                }
+
                 possiblyFetch(actions, platform, project_dir, dep_url, plugins_dir, opts, function(err) {
                     if (err) {
                         if (callback) callback(err);


[31/40] git commit: Updated version to 0.11.1-dev

Posted by st...@apache.org.
Updated version to 0.11.1-dev


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

Branch: refs/heads/ffos
Commit: b05729ae4585dabaa7ba54e8417ae7893fe83d5b
Parents: dcc6fe2
Author: Braden Shepherdson <br...@gmail.com>
Authored: Thu Sep 5 15:34:03 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Thu Sep 5 15:34:03 2013 -0400

----------------------------------------------------------------------
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b05729ae/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 0e31cdf..82a1762 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Andrew Lunny <al...@gmail.com>",
   "name": "plugman",
   "description": "install/uninstall Cordova plugins",
-  "version": "0.11.0",
+  "version": "0.11.1-dev",
   "repository": {
     "type": "git",
     "url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"


[05/40] git commit: [CB-4036] - another pass at the engine/platform check problem

Posted by st...@apache.org.
[CB-4036] - another pass at the engine/platform check problem


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

Branch: refs/heads/ffos
Commit: 078f9bfb01e5bec8b6c1a7bf5076918e5f6b3cfd
Parents: eadd4ce
Author: Tim Kim <ti...@adobe.com>
Authored: Wed Aug 7 15:03:54 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 spec/plugins/EnginePlugin/plugin.xml |   2 +-
 src/install.js                       | 159 ++++++++++++------------------
 src/util/default-engines.js          |  32 ++++++
 3 files changed, 97 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/078f9bfb/spec/plugins/EnginePlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/EnginePlugin/plugin.xml b/spec/plugins/EnginePlugin/plugin.xml
index 62233e3..fe875a3 100644
--- a/spec/plugins/EnginePlugin/plugin.xml
+++ b/spec/plugins/EnginePlugin/plugin.xml
@@ -24,7 +24,7 @@
     <name>Engine Choo Choo</name>
 
     <engines>
-        <engine name="cordova" version=">=2.3.0" />
+        <engine name="cordova" version=">=2.3.0" platform="*" />
     </engines>
     
 </plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/078f9bfb/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index d54ed1d..fee217e 100644
--- a/src/install.js
+++ b/src/install.js
@@ -65,104 +65,74 @@ function possiblyFetch(actions, platform, project_dir, id, plugins_dir, options,
     }
 }
 
-function checkMinimumReq(currentProjectInfo, minRequirements, platform, callback) {
-    if(currentProjectInfo.cordovaVersion) {
-        if(currentProjectInfo.cordovaVersion == 'dev' || semver.satisfies(currentProjectInfo.cordovaVersion, minRequirements.cordovaMinVersion)){
+function checkMinimumReq(engines, callback) {
+    engines.forEach(function(engine){
+        if(engine.currentVersion == 'dev' || semver.satisfies(engine.currentVersion, engine.minVersion || engine.currentVersion == null)){
             // engine ok!
-        } else {
-            var err = new Error('Plugin doesn\'t support this project\'s Cordova version. Project version: ' + currentProjectInfo.cordovaVersion + ', failed version requirement: ' + minRequirements.cordovaMinVersion);
-            if (callback) return callback(err);
-            else throw err;
-        }   
-    }
-    
-    if(currentProjectInfo.min_os_version) {
-        if(semver.satisfies(currentProjectInfo.min_os_version, minRequirements.platformMinOS)) {
-            // min-os version ok
-        } else {
-            var err = new Error('Plugin doesn\'t support ' + platform + '  minimum os version.  ' + platform + '  minimum os version: ' + currentProjectInfo.min_os_version + ', failed version requirement: ' + minRequirements.platformMinOS);
-            if (callback) return callback(err);
-            else throw err;
-        }            
-    }
-
-    if(currentProjectInfo.min_sdk_version) {
-        if(semver.satisfies(currentProjectInfo.min_sdk_version, minRequirements.platformMinSDK)) {
-            // min-sdk version ok
-        } else {
-            var err = new Error('Plugin doesn\'t support ' + platform + '  minimum sdk version.  ' + platform + '  minimum sdk version: ' + currentProjectInfo.min_sdk_version + ', failed version requirement: ' + minRequirements.platformMinSDK);
+        }else{
+            var err = new Error('Plugin doesn\'t support this project\'s '+engine.name+' version. '+engine.name+': ' + engine.currentVersion + ', failed version requirement: ' + engine.minVersion);
             if (callback) return callback(err);
             else throw err;
-        }                        
-    }     
+        }  
+    });
 }
 
-// use the project level cordova scripts to get the current cordova version and platform information
-function getCurrentProjectVersion(versionPath, platformPath) {
-    // need to think about a more graceful way of handling when these scripts break or when they are not detected
-    // setting version/platform to null if they do fail or do not exist and then just continuing
-    
-    var cordovaVersion, platformInfo;
-
-    if (fs.existsSync(versionPath)) {   
-        fs.chmodSync(versionPath, '755');
-        var versionScript = shell.exec(versionPath, {silent: true});
-        if (versionScript.code === 0) {
-            cordovaVersion = versionScript.output.trim();
-            var rc_index = cordovaVersion.indexOf('rc');
-            if (rc_index > -1) {
-                cordovaVersion = cordovaVersion.substr(0, rc_index) + '-' + cordovaVersion.substr(rc_index);
-            }
-        }else{
-            cordovaVersion = null;
-            require('../plugman').emit('log', 'Cordova project version script failed (has a ./cordova/version script, but something went wrong executing it), continuing anyways.');
-        }
-    }else{
-        cordovaVersion = null;
-        require('../plugman').emit('log', 'Cordova project version not detected (lacks a ./cordova/version script), continuing.');
-    }  
+// exec engine scripts in order to get the current engine version
+function callEngineScripts(engines) {
+    var engineScript;
+    var engineScriptVersion;
     
-    if (fs.existsSync(platformPath)) {   
-        fs.chmodSync(platformPath, '755');
-        var platformScript = shell.exec(platformPath, {silent: true});
-        if (platformScript.code === 0) {
-            // thinking platformScript.output would be a JSON string like:
-            // { min_os_version: "5.0.0" , min_sdk_version: "1.0.0" }
-            platformInfo = platformScript.output;
+    engines.forEach(function(engine){
+        if(fs.exists(engine.scriptTarget)){
+            fs.chmodSync(engine.scriptTarget, '755');
+            engineScript = shell.exec(versionPath, {silent: true});
+            
+            if (engineScript.code === 0) {
+                engineScriptVersion = engineScript.output.trim();
+                var rc_index = engineScriptVersion.indexOf('rc');
+                if (rc_index > -1) {
+                    engineScriptVersion = engineScriptVersion.substr(0, rc_index) + '-' + engineScriptVersion.substr(rc_index);
+                }
+                
+            }else{
+                engineScriptVersion = null;
+                require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' script failed (has a '+ engine.scriptTarget +' script, but something went wrong executing it), continuing anyways.');
+            }            
         }else{
-            platformInfo =  null;
-            require('../plugman').emit('log', 'Cordova project platformReq script failed (has a ./cordova/platformReq script, but something went wrong executing it), continuing anyways.');
-        }
-    }else{  
-        platformInfo =  null;
-        require('../plugman').emit('log', 'Cordova project version not detected (lacks a ./cordova/version script), continuing.');
-    }     
+            engineScriptVersion = null;
+            require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' not detected (lacks a '+ engine.scriptTarget +' script), continuing.');
+        } 
+        engine.currentVersion = engineScriptVersion;
+        
+    });
     
-    return { 'cordovaVersion' : cordovaVersion, 'platformInfo' : platformInfo };
+    return engines;
 }
 
-function getMinReq(pluginElement, platform){
-
-    var cordovaMinVersion, platformMinOS, platformMinSDK;
-    
+// return only the engines we care about/need
+function getEngines(pluginElement, platform, project_dir){
     var engines = pluginElement.findall('engines/engine');
-    engines.forEach(function(engine){
-                if(engine.attrib["name"].toLowerCase() === "cordova"){
-                    cordovaMinVersion = engine.attrib["version"];
-                }else{
-                    // check for other engines - if found, shove the info into return statement 
-                }
-            });
-    
-    
-    // these elements are still in flux - most likely to change when the platforms start implementing these scripts
-    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 };
+    var defaultEngines = require('./util/default-engines');
+    var uncheckedEngines = [];
+    var tempEngine;
+
+    // load in all known defaults and compare
+    engines.forEach(function(engine){   
+        // this may need some changes - what to do for default platforms - why need to specify platforms?
+        if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
+            if(defaultEngines[engine.attrib["name"]]){
+                defaultEngines[engine.attrib["name"]].minVersion = defaultEngines[engine.attrib["version"]];
+                defaultEngines[engine.attrib["name"]].scriptTarget = path.join(project_dir, defaultEngines[engine.attrib["name"]].scriptTarget);
+                uncheckedEngines.push(defaultEngines[engine.attrib["name"]]);
+            }else{
+                // check for other engines
+                tempEngine = {};
+                tempEngine[engine.attrib["name"]] = { 'platform': engine.attrib["platform"], 'scriptTarget':path.join(project_dir,engine.attrib["scriptTarget"]), 'minVersion' :  engine.attrib["version"]};
+                uncheckedEngines.push(tempEngine);
+            }
+        }    
+    });
+    return uncheckedEngines;
 }
 
 
@@ -194,19 +164,18 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         if (callback) callback();
         return;
     }
-    
-    var versionPath = path.join(project_dir, 'cordova', 'version');
+
+    //var versionPath = path.join(project_dir, 'cordova', 'version');
     // windows8, wp7, wp8 all use a .bat file
+    /*
     if (platform === "windows8" || platform === "wp7" || platform === "wp8") {
         versionPath += ".bat";
     }
-
-    var platformPath = path.join(project_dir, 'cordova', 'platformReq');
-    
-    var currentProjectInfo = getCurrentProjectVersion(versionPath, platformPath);
-    var minRequirements = getMinReq(plugin_et, platform);
+    */
     
-    checkMinimumReq(currentProjectInfo, minRequirements, platform, callback);
+    var theEngines = getEngines(plugin_et, platform, project_dir);
+    theEngines = callEngineScripts(theEngines);
+    checkMinimumReq(theEngines, callback);
     
     // checking preferences, if certain variables are not provided, we should throw.
     prefs = plugin_et.findall('./preference') || [];

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/078f9bfb/src/util/default-engines.js
----------------------------------------------------------------------
diff --git a/src/util/default-engines.js b/src/util/default-engines.js
new file mode 100644
index 0000000..4499df6
--- /dev/null
+++ b/src/util/default-engines.js
@@ -0,0 +1,32 @@
+var path = require('path');
+
+// wondering how to nicely store paths here...
+// it'd be nice to just point to this file and get the correct path
+// since these scripts should ideally be accessed from the cordova project folder
+
+module.exports = {
+    'cordova': 
+        { 'platform':'*', 'scriptTarget': path.join('cordova','version') },   
+    'cordova-plugman': 
+        { 'platform':'*', 'scriptTarget': '' },
+    'cordova-android': 
+        { 'platform':'android', 'scriptTarget': '' },
+    'cordova-ios': 
+        { 'platform':'ios', 'scriptTarget': '' },
+    'cordova-blackberry10': 
+        { 'platform':'blackberry10', 'scriptTarget': '' },
+    'cordova-wp7': 
+        { 'platform':'wp7', 'scriptTarget': '' },
+    'cordova-wp8': 
+        { 'platform':'wp8', 'scriptTarget': '' },
+    'cordova-windows8': 
+        { 'platform':'windows8', 'scriptTarget': '' },
+    'apple-xcode' : 
+        { 'platform':'ios', 'scriptTarget': '' },
+    'apple-ios' : 
+        { 'platform':'ios', 'scriptTarget': '' },
+    'blackberry-webworks' : 
+        { 'platform':'blackberry10', 'scriptTarget': '' },
+    'android-sdk' : 
+        { 'platform':'android', 'scriptTarget': '' }
+};


[34/40] git commit: CB-4786 adding owner and checking in some spec requirements

Posted by st...@apache.org.
CB-4786 adding owner and checking in some spec requirements


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

Branch: refs/heads/ffos
Commit: 95745c2510e7e3890ad26b57820766d5cd3eb898
Parents: 6486e7f
Author: Anis Kadri <an...@apache.org>
Authored: Wed Sep 11 16:25:53 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Sep 11 16:25:53 2013 -0700

----------------------------------------------------------------------
 plugman.js                                      |  4 ++
 spec/owner.spec.js                              | 11 ++++
 spec/plugins/dependencies/E/plugin.xml          | 59 ++++++++++++++++++++
 spec/plugins/dependencies/E/src/android/E.java  |  0
 .../dependencies/E/src/ios/EPluginCommand.h     |  0
 .../dependencies/E/src/ios/EPluginCommand.m     |  0
 spec/plugins/dependencies/E/www/plugin-d.js     |  0
 src/owner.js                                    | 15 +++++
 src/registry/registry.js                        | 14 +++++
 9 files changed, 103 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 4ca7846..bcd0044 100755
--- a/plugman.js
+++ b/plugman.js
@@ -33,6 +33,7 @@ plugman = {
     unpublish:          require('./src/unpublish'),
     search:             require('./src/search'),
     info:               require('./src/info'),
+    owner:              require('./src/owner'),
     config_changes:     require('./src/util/config-changes'),
     on:                 emitter.addListener,
     off:                emitter.removeListener,
@@ -44,6 +45,9 @@ plugman.commands =  {
     'config'   : function(cli_opts) {
         plugman.config(cli_opts.argv.remain);
     },
+    'owner'   : function(cli_opts) {
+        plugman.owner(cli_opts.argv.remain);
+    },
     'install'  : function(cli_opts) {
         if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
             return console.log(plugman.help());

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/owner.spec.js
----------------------------------------------------------------------
diff --git a/spec/owner.spec.js b/spec/owner.spec.js
new file mode 100644
index 0000000..3cc3c0a
--- /dev/null
+++ b/spec/owner.spec.js
@@ -0,0 +1,11 @@
+var owner = require('../src/owner'),
+    registry = require('../src/registry/registry');
+
+describe('owner', function() {
+    it('should run owner', function() {
+        var sOwner = spyOn(registry, 'owner');
+        var params = ['add', 'anis', 'com.phonegap.plugins.dummyplugin'];
+        owner(params, function(err, result) { });
+        expect(sOwner).toHaveBeenCalledWith(params, jasmine.any(Function));
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/dependencies/E/plugin.xml b/spec/plugins/dependencies/E/plugin.xml
new file mode 100644
index 0000000..586c74e
--- /dev/null
+++ b/spec/plugins/dependencies/E/plugin.xml
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Copyright 2013 Anis Kadri
+
+ 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://cordova.apache.org/ns/plugins/1.0"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    id="E"
+    version="0.6.0">
+
+    <name>Plugin E</name>
+
+    <asset src="www/plugin-e.js" target="plugin-e.js" />
+
+    <dependency id="D" />
+
+    <config-file target="config.xml" parent="/*">
+        <access origin="build.phonegap.com" />
+    </config-file>
+	
+    <!-- android -->
+    <platform name="android">
+        <config-file target="res/xml/config.xml" parent="plugins">
+            <plugin name="E"
+                value="com.phonegap.E.E"/>
+        </config-file>
+
+        <source-file src="src/android/E.java"
+                target-dir="src/com/phonegap/E" />
+    </platform>
+
+        
+    <!-- ios -->
+    <platform name="ios">
+        <!-- CDV 2.5+ -->
+        <config-file target="config.xml" parent="plugins">
+            <plugin name="E"
+                value="EPluginCommand"/>
+        </config-file>
+
+        <header-file src="src/ios/EPluginCommand.h" />
+        <source-file src="src/ios/EPluginCommand.m"/>
+    </platform>
+</plugin>

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/android/E.java
----------------------------------------------------------------------
diff --git a/spec/plugins/dependencies/E/src/android/E.java b/spec/plugins/dependencies/E/src/android/E.java
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/ios/EPluginCommand.h
----------------------------------------------------------------------
diff --git a/spec/plugins/dependencies/E/src/ios/EPluginCommand.h b/spec/plugins/dependencies/E/src/ios/EPluginCommand.h
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/src/ios/EPluginCommand.m
----------------------------------------------------------------------
diff --git a/spec/plugins/dependencies/E/src/ios/EPluginCommand.m b/spec/plugins/dependencies/E/src/ios/EPluginCommand.m
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/spec/plugins/dependencies/E/www/plugin-d.js
----------------------------------------------------------------------
diff --git a/spec/plugins/dependencies/E/www/plugin-d.js b/spec/plugins/dependencies/E/www/plugin-d.js
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/src/owner.js
----------------------------------------------------------------------
diff --git a/src/owner.js b/src/owner.js
new file mode 100644
index 0000000..f80f4e6
--- /dev/null
+++ b/src/owner.js
@@ -0,0 +1,15 @@
+var registry = require('./registry/registry')
+
+module.exports = function(params, callback) {
+    registry.owner(params, function(err) {
+        if(callback && typeof callback === 'function') {
+            err ? callback(err) : callback(null);
+        } else {
+            if(err) {
+                throw err;
+            } else {
+                console.log('done');
+            }
+        }
+    });
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/95745c25/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index ec662ad..15d8b84 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -122,6 +122,20 @@ module.exports = {
         });
     },
     /**
+     * @method owner
+     * @param {Array} args Command argument
+     * @param {Function} cb Command callback
+     */
+    owner: function(args, cb) {
+        initSettings(function(err, settings) {
+            if(err) return handleError(err, cb);
+            npm.load(settings, function(er) {
+                if (er) return handleError(er);
+                npm.commands.owner(args, cb);
+            });
+        });
+    },
+    /**
      * @method adduser
      * @param {Array} args Command argument
      * @param {Function} cb Command callback


[22/40] git commit: CB-4494 adding info command and storing engine data in registry

Posted by st...@apache.org.
CB-4494 adding info command and storing engine data in registry


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

Branch: refs/heads/ffos
Commit: 07d2a49edb26e7e91ec30e6681218e476bb31068
Parents: 479d339
Author: Anis Kadri <an...@apache.org>
Authored: Tue Sep 3 15:48:58 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Tue Sep 3 15:48:58 2013 -0700

----------------------------------------------------------------------
 doc/help.txt                   |  5 +++
 plugman.js                     |  4 ++
 spec/info.spec.js              | 10 +++++
 spec/registry/registry.spec.js |  9 ++--
 src/info.js                    | 19 +++++++++
 src/registry/manifest.js       | 83 ++++++++++++++++++++-----------------
 src/registry/registry.js       | 20 ++++++++-
 7 files changed, 109 insertions(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index 00ce7fb..51eb43d 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -61,6 +61,11 @@ Search for a plugin
 
     $ plugman search plugin,keywords
 
+Display plugin information
+-----------------------
+
+    $ plugman info plugin
+
 Manage registry configuration
 -----------------------------
 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index b921f4d..4ca7846 100755
--- a/plugman.js
+++ b/plugman.js
@@ -32,6 +32,7 @@ plugman = {
     publish:            require('./src/publish'),
     unpublish:          require('./src/unpublish'),
     search:             require('./src/search'),
+    info:               require('./src/info'),
     config_changes:     require('./src/util/config-changes'),
     on:                 emitter.addListener,
     off:                emitter.removeListener,
@@ -75,6 +76,9 @@ plugman.commands =  {
     'search'   : function(cli_opts) {
         plugman.search(cli_opts.argv.remain);
     },
+    'info'     : function(cli_opts) {
+        plugman.info(cli_opts.argv.remain);
+    },
 
     'publish'  : function(cli_opts) {
         var plugin_path = cli_opts.argv.remain; 

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/spec/info.spec.js
----------------------------------------------------------------------
diff --git a/spec/info.spec.js b/spec/info.spec.js
new file mode 100644
index 0000000..1327c65
--- /dev/null
+++ b/spec/info.spec.js
@@ -0,0 +1,10 @@
+var search = require('../src/info'),
+    registry = require('../src/registry/registry');
+
+describe('info', function() {
+    it('should show plugin info', function() {
+        var sSearch = spyOn(registry, 'info');
+        search(new Array('myplugin'));
+        expect(sSearch).toHaveBeenCalledWith(['myplugin'], jasmine.any(Function));
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/spec/registry/registry.spec.js
----------------------------------------------------------------------
diff --git a/spec/registry/registry.spec.js b/spec/registry/registry.spec.js
index 68c930b..a4f0688 100644
--- a/spec/registry/registry.spec.js
+++ b/spec/registry/registry.spec.js
@@ -8,7 +8,7 @@ describe('registry', function() {
     describe('manifest', function() {
         var pluginDir, packageJson;
         beforeEach(function() {
-            pluginDir = __dirname + '/../plugins/DummyPlugin';
+            pluginDir = __dirname + '/../plugins/EnginePlugin';
             packageJson = path.resolve(pluginDir, 'package.json');
         });
         afterEach(function() {
@@ -18,8 +18,11 @@ describe('registry', function() {
         it('should generate a package.json from a plugin.xml', function() {
             manifest.generatePackageJsonFromPluginXml(pluginDir);
             expect(fs.existsSync(packageJson));
-            expect(JSON.parse(fs.readFileSync(packageJson)).name).toEqual('com.phonegap.plugins.dummyplugin');
-            expect(JSON.parse(fs.readFileSync(packageJson)).version).toEqual('0.6.0');
+            expect(JSON.parse(fs.readFileSync(packageJson)).name).toEqual('com.cordova.engine');
+            expect(JSON.parse(fs.readFileSync(packageJson)).version).toEqual('1.0.0');
+            expect(JSON.parse(fs.readFileSync(packageJson)).engines).toEqual(
+            [ { name : 'cordova', version : '>=2.3.0' }, { name : 'cordova-plugman', version : '>=0.10.0' }, { name : 'mega-fun-plugin', version : '>=1.0.0' }, { name : 'mega-boring-plugin', version : '>=3.0.0' } ]
+            );
         });
     });
     describe('actions', function() {

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/src/info.js
----------------------------------------------------------------------
diff --git a/src/info.js b/src/info.js
new file mode 100644
index 0000000..b8fecb7
--- /dev/null
+++ b/src/info.js
@@ -0,0 +1,19 @@
+var registry = require('./registry/registry')
+
+module.exports = function(plugin, callback) {
+    registry.info(plugin, function(err, plugin_info) {
+        if(callback) {
+            if(err) return callback(err);
+            callback(null, plugins);
+        } else {
+            if(err) return console.log(err);
+            console.log('name:', plugin_info.name);
+            console.log('version:', plugin_info.version);
+            if(plugin_info.engines) {
+                for(var i = 0, j = plugin_info.engines.length ; i < j ; i++) {
+                    console.log(plugin_info.engines[i].name, 'version:', plugin_info.engines[i].version);
+                }
+            }
+        }
+    });
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/src/registry/manifest.js
----------------------------------------------------------------------
diff --git a/src/registry/manifest.js b/src/registry/manifest.js
index 0aa70e3..61f1bb1 100644
--- a/src/registry/manifest.js
+++ b/src/registry/manifest.js
@@ -11,43 +11,52 @@ function handleError(err, cb) {
 
 // Java world big-up!
 function generatePackageJsonFromPluginXml(plugin_path, cb) {
-  var package_json = {};
-  var pluginXml = xml_helpers.parseElementtreeSync(path.join(plugin_path, 'plugin.xml'));
-  
-  if(!pluginXml) return handleError(new Error('invalid plugin.xml document'), cb);
-
-  var pluginElm = pluginXml.getroot();
-  
-  if(!pluginElm) return handleError(new Error('invalid plugin.xml document'), cb);
-  
-  // REQUIRED: name, version REQUIRED
-  // OPTIONAL: description, license, keywords
-  var name = pluginElm.attrib.id,
-      version = pluginElm.attrib.version,
-      cordova_name = pluginElm.findtext('name'),
-      description = pluginElm.findtext('description'),
-      license = pluginElm.findtext('license'),
-      keywords = pluginElm.findtext('keywords');
-
-  if(!version) return handleError(new Error('`version` required'), cb)
-  package_json.version = version;
-
-  if(!name) return handleError(new Error('`name` is required'), cb)
-  if(!name.match(/^\w+|-*$/)) {
-      var e = new Error('`name` can only contain alphanumberic characters and -')
-      return handleError(e, cb);
-  }
-  package_json.name = name.toLowerCase();
-
-  if(cordova_name) package_json.cordova_name = cordova_name;
-  if(description)  package_json.description  = description;
-  if(license)      package_json.license      = license;
-  if(keywords)     package_json.keywords     = keywords.split(',');
-
-  // write package.json
-  var package_json_path = path.resolve(plugin_path, 'package.json');
-  fs.writeFileSync(package_json_path, JSON.stringify(package_json, null, 4), 'utf8');
-  return package_json;
+    var package_json = {};
+    var pluginXml = xml_helpers.parseElementtreeSync(path.join(plugin_path, 'plugin.xml'));
+
+    if(!pluginXml) return handleError(new Error('invalid plugin.xml document'), cb);
+
+    var pluginElm = pluginXml.getroot();
+
+    if(!pluginElm) return handleError(new Error('invalid plugin.xml document'), cb);
+
+    // REQUIRED: name, version REQUIRED
+    // OPTIONAL: description, license, keywords, engine
+    var name = pluginElm.attrib.id,
+        version = pluginElm.attrib.version,
+        cordova_name = pluginElm.findtext('name'),
+        description = pluginElm.findtext('description'),
+        license = pluginElm.findtext('license'),
+        keywords = pluginElm.findtext('keywords'),
+        engines = pluginElm.findall('engines/engine');
+
+    if(!version) return handleError(new Error('`version` required'), cb)
+        package_json.version = version;
+
+    if(!name) return handleError(new Error('`name` is required'), cb)
+        if(!name.match(/^\w+|-*$/)) {
+            var e = new Error('`name` can only contain alphanumberic characters and -')
+                return handleError(e, cb);
+        }
+    package_json.name = name.toLowerCase();
+
+    if(cordova_name) package_json.cordova_name = cordova_name;
+    if(description)  package_json.description  = description;
+    if(license)      package_json.license      = license;
+    if(keywords)     package_json.keywords     = keywords.split(',');
+
+    // adding engines
+    if(engines) {
+        package_json.engines = [];
+        for(var i = 0, j = engines.length ; i < j ; i++) {
+            package_json.engines.push({name: engines[i].attrib.name, version: engines[i].attrib.version});
+        }
+    }
+
+    // write package.json
+    var package_json_path = path.resolve(plugin_path, 'package.json');
+    fs.writeFileSync(package_json_path, JSON.stringify(package_json, null, 4), 'utf8');
+    return package_json;
 }
 
 module.exports.generatePackageJsonFromPluginXml = generatePackageJsonFromPluginXml;

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/07d2a49e/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index ba22520..ec662ad 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -193,10 +193,28 @@ module.exports = {
         initSettings(function(err, settings) {
             if(err) return handleError(err, cb);
             getPackageInfo(args, function(err, info) {
-                if(err) return handleError(err, cb)
+                if(err) return handleError(err, cb);
                 fetchPackage(info, cb);
             });
         });
+    },
+    /**
+     * @method info
+     * @param {String} name Plugin name
+     * @param {Function} cb Command callback
+     */
+    info: function(args, cb) {
+        initSettings(function(err, settings) {
+            if(err) return handleError(err, cb);
+            getPackageInfo(args, function(err, info) {
+                if(err) return handleError(err, cb);
+                if(cb) {
+                    cb(null, info);
+                } else {
+                    console.log(info);
+                }
+            });
+        });
     }
 }
 


[25/40] git commit: [CB-4430] Add lib-file support to Android

Posted by st...@apache.org.
[CB-4430] Add lib-file support to Android


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

Branch: refs/heads/ffos
Commit: c5bdcf0eb3b1484973a79fc071fecbf873ae9865
Parents: c2461bc
Author: ignisvulpis <ax...@nennker.de>
Authored: Tue Aug 20 16:09:48 2013 +0200
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Sep 4 13:58:51 2013 -0400

----------------------------------------------------------------------
 src/platforms/android.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c5bdcf0e/src/platforms/android.js
----------------------------------------------------------------------
diff --git a/src/platforms/android.js b/src/platforms/android.js
index 7e64d9f..83b2d02 100644
--- a/src/platforms/android.js
+++ b/src/platforms/android.js
@@ -43,5 +43,17 @@ module.exports = {
             var dest = path.join(source_el.attrib['target-dir'], path.basename(source_el.attrib['src']));
             common.deleteJava(project_dir, dest);
         }
+    },
+    "lib-file":{
+        install:function(lib_el, plugin_dir, project_dir) {
+            var src = lib_el.attrib.src;
+            var dest = path.join("libs", path.basename(src));
+            common.copyFile(plugin_dir, src, project_dir, dest);
+        },
+        uninstall:function(lib_el, project_dir) {
+            var src = lib_el.attrib.src;
+            var dest = path.join("libs", path.basename(src));
+            common.removeFile(project_dir, dest);
+        }
     }
 };


[21/40] git commit: [CB-4622]: Allow git URLs with a hash specifying git ref and subdir

Posted by st...@apache.org.
[CB-4622]: Allow git URLs with a hash specifying git ref and subdir

Format is https://github.com/foo/bar.git#gitref:subdir. Subdir is
optional, so #gitref is valid, and git refs can be omitted to use HEAD
with some subdir (#:subdir).


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

Branch: refs/heads/ffos
Commit: 73c3aa72046dd649d4dca6660c983ff540f1d01d
Parents: f276c21
Author: Braden Shepherdson <br...@gmail.com>
Authored: Tue Sep 3 15:56:19 2013 -0400
Committer: Braden Shepherdson <br...@gmail.com>
Committed: Tue Sep 3 15:56:19 2013 -0400

----------------------------------------------------------------------
 spec/fetch.spec.js | 18 ++++++++++++++++++
 src/fetch.js       | 18 ++++++++++++++++++
 2 files changed, 36 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/73c3aa72/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 3213ad4..a52228f 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -61,6 +61,24 @@ describe('fetch', function() {
             fetch(url, temp, { subdir: dir, git_ref: ref });
             expect(clone).toHaveBeenCalledWith(url, temp, dir, ref, jasmine.any(Function));
         });
+        it('should extract the git ref from the URL hash, if provided', function() {
+            var url = "https://github.com/bobeast/GAPlugin.git#fakeGitRef";
+            var baseURL = "https://github.com/bobeast/GAPlugin.git";
+            fetch(url, temp, {});
+            expect(clone).toHaveBeenCalledWith(baseURL, temp, '.', 'fakeGitRef', jasmine.any(Function));
+        });
+        it('should extract the subdir from the URL hash, if provided', function() {
+            var url = "https://github.com/bobeast/GAPlugin.git#:fakeSubDir";
+            var baseURL = "https://github.com/bobeast/GAPlugin.git";
+            fetch(url, temp, {});
+            expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fakeSubDir', undefined, jasmine.any(Function));
+        });
+        it('should extract the git ref and subdir from the URL hash, if provided', function() {
+            var url = "https://github.com/bobeast/GAPlugin.git#fakeGitRef:/fake/Sub/Dir/";
+            var baseURL = "https://github.com/bobeast/GAPlugin.git";
+            fetch(url, temp, {});
+            expect(clone).toHaveBeenCalledWith(baseURL, temp, 'fake/Sub/Dir', 'fakeGitRef', jasmine.any(Function));
+        });
         it('should throw if used with url and `link` param', function() {
             expect(function() {
                 fetch("https://github.com/bobeast/GAPlugin.git", temp, {link:true});

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/73c3aa72/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 59b95cf..5d36b3f 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -18,6 +18,24 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
 
     // clone from git repository
     var uri = url.parse(plugin_dir);
+
+    // If the hash exists, it has the form from npm: http://foo.com/bar#git-ref[:subdir]
+    // NB: No leading or trailing slash on the subdir.
+    if (uri.hash) {
+        var result = uri.hash.match(/^#([^:]*)(?::\/?(.*?)\/?)?$/);
+        if (result) {
+            if (result[1])
+                options.git_ref = result[1];
+            if(result[2])
+                options.subdir = result[2];
+
+            // Recurse and exit with the new options and truncated URL.
+            var new_dir = plugin_dir.substring(0, plugin_dir.indexOf('#'));
+            module.exports(new_dir, plugins_dir, options, callback);
+            return;
+        }
+    }
+
     if ( uri.protocol && uri.protocol != 'file:' && !plugin_dir.match(/^\w+:\\/)) {
         if (options.link) {
             var err = new Error('--link is not supported for git URLs');


[04/40] git commit: [CB-4036] - fixed up some small errors

Posted by st...@apache.org.
[CB-4036] - fixed up some small errors


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

Branch: refs/heads/ffos
Commit: faccfd55009b98306fb1ff63678817088849a8b3
Parents: 078f9bf
Author: Tim Kim <ti...@adobe.com>
Authored: Thu Aug 8 13:50:18 2013 -0700
Committer: Tim Kim <ti...@adobe.com>
Committed: Mon Aug 26 16:47:16 2013 -0700

----------------------------------------------------------------------
 src/install.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/faccfd55/src/install.js
----------------------------------------------------------------------
diff --git a/src/install.js b/src/install.js
index fee217e..accc25a 100644
--- a/src/install.js
+++ b/src/install.js
@@ -83,9 +83,9 @@ function callEngineScripts(engines) {
     var engineScriptVersion;
     
     engines.forEach(function(engine){
-        if(fs.exists(engine.scriptTarget)){
+        if(fs.existsSync(engine.scriptTarget)){
             fs.chmodSync(engine.scriptTarget, '755');
-            engineScript = shell.exec(versionPath, {silent: true});
+            engineScript = shell.exec(engine.scriptTarget, {silent: true});
             
             if (engineScript.code === 0) {
                 engineScriptVersion = engineScript.output.trim();
@@ -103,7 +103,6 @@ function callEngineScripts(engines) {
             require('../plugman').emit('log', 'Cordova project '+ engine.scriptTarget +' not detected (lacks a '+ engine.scriptTarget +' script), continuing.');
         } 
         engine.currentVersion = engineScriptVersion;
-        
     });
     
     return engines;
@@ -121,7 +120,7 @@ function getEngines(pluginElement, platform, project_dir){
         // this may need some changes - what to do for default platforms - why need to specify platforms?
         if(engine.attrib["platform"] === platform || engine.attrib["platform"] === '*'){
             if(defaultEngines[engine.attrib["name"]]){
-                defaultEngines[engine.attrib["name"]].minVersion = defaultEngines[engine.attrib["version"]];
+                defaultEngines[engine.attrib["name"]].minVersion = engine.attrib["version"];
                 defaultEngines[engine.attrib["name"]].scriptTarget = path.join(project_dir, defaultEngines[engine.attrib["name"]].scriptTarget);
                 uncheckedEngines.push(defaultEngines[engine.attrib["name"]]);
             }else{