http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/config-changes.js
----------------------------------------------------------------------
diff --git a/src/util/config-changes.js b/src/util/config-changes.js
new file mode 100644
index 0000000..d931039
--- /dev/null
+++ b/src/util/config-changes.js
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+// takes an xml list of config-file tags
+// returns a JS object with an easy to use structure
+
+module.exports = function configChanges(baseTag) {
+    var tags = baseTag.findall('./config-file'),
+        files = {};
+
+    tags.forEach(function (tag) {
+        var target = tag.attrib['target'];
+
+        if (files[target]) {
+            files[target].push(tag);
+        } else {
+            files[target] = [tag];
+        }
+    });
+
+    return files;
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/fs.js
----------------------------------------------------------------------
diff --git a/src/util/fs.js b/src/util/fs.js
new file mode 100644
index 0000000..3d9f374
--- /dev/null
+++ b/src/util/fs.js
@@ -0,0 +1,34 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+var fs = require('fs');
+
+// polyfill for Node 0.6.x
+if (!fs.existsSync) {
+    fs.existsSync = function (path) {
+        try {
+            fs.statSync(path);
+            return true;
+        } catch (e) {
+            return false;
+        }
+    }
+}
+
+module.exports = fs;

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/plugins.js
----------------------------------------------------------------------
diff --git a/src/util/plugins.js b/src/util/plugins.js
new file mode 100644
index 0000000..847f427
--- /dev/null
+++ b/src/util/plugins.js
@@ -0,0 +1,119 @@
+#!/usr/bin/env node
+/*
+ *
+ * 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.
+ *
+*/
+
+var http = require('http'),
+    osenv = require('osenv'),
+    path = require('path'),
+    fs = require('fs'),
+    util = require('util'),
+    shell = require('shelljs'),
+    remote = require(path.join(__dirname, '..', '..', 'config', 'remote'));
+
+// Fetches plugin information from remote server
+exports.getPluginInfo = function(plugin_name, callback) {
+    var responded = false;
+    http.get(remote.url + util.format(remote.query_path, plugin_name), 
function(res) {
+        var str = '';
+        res.on('data', function (chunk) {
+            str += chunk;
+        });
+        res.on('end', function () {
+            responded = true;
+            var response, plugin_info;
+            if((response = JSON.parse(str)).rows.length == 1) {
+                plugin_info = response.rows[0].value;
+                callback(null, plugin_info);
+            } else {
+                callback("Could not find information on "+plugin_name+" 
plugin");
+            }
+        });
+
+    }).on('error', function(e) {
+        callback(e);
+    });
+
+    setTimeout(function() {
+        if (!responded) {
+            console.log('timed out');
+            error('timed out')
+        }
+    }, 3000);
+}
+
+exports.listAllPlugins = function(success, error) {
+    http.get(remote.url + remote.list_path, function(res) {
+      var str = '';
+      res.on('data', function (chunk) {
+        str += chunk;
+      });
+      res.on('end', function () {
+          var plugins = (JSON.parse(str)).rows;
+          success(plugins);
+      });
+      
+    }).on('error', function(e) {
+      console.log("Got error: " + e.message);
+      error(e.message);
+    });
+}
+
+exports.clonePluginGitRepo = function(plugin_git_url, plugins_dir, callback) {
+    if(!shell.which('git')) {
+        var err = new Error('git command line is not installed');
+        if (callback) callback(err);
+        else throw err;
+    }
+    // use osenv to get a temp directory in a portable way
+    var lastSlash = plugin_git_url.lastIndexOf('/');
+    var basename = plugin_git_url.substring(lastSlash+1);
+    var dotGitIndex = basename.lastIndexOf('.git');
+    if (dotGitIndex >= 0) {
+        basename = basename.substring(0, dotGitIndex);
+    }
+
+    var plugin_dir = path.join(plugins_dir, basename);
+
+    // trash it if it already exists (something went wrong before probably)
+    if(fs.existsSync(plugin_dir)) {
+        shell.rm('-rf', plugin_dir);
+    }
+
+    shell.exec('git clone ' + plugin_git_url + ' ' + plugin_dir + ' 2>&1 
1>/dev/null', {silent: true, async:true}, function(code, output) {
+        if (code > 0) {
+            var err = new Error('failed to get the plugin via git from URL '+ 
plugin_git_url);
+            if (callback) callback(err)
+            else throw err;
+        } else {
+            if (callback) callback(null);
+        }
+    });
+}
+
+// TODO add method for archives and other formats
+// exports.extractArchive = function(plugin_dir) {
+// }
+
+// TODO add method to publish plugin from cli 
+// exports.publishPlugin = function(plugin_dir) {
+// }
+
+// TODO add method to unpublish plugin from cli 
+// exports.unpublishPlugin = function(plugin_dir) {
+// }

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/search-and-replace.js
----------------------------------------------------------------------
diff --git a/src/util/search-and-replace.js b/src/util/search-and-replace.js
new file mode 100644
index 0000000..dc1f931
--- /dev/null
+++ b/src/util/search-and-replace.js
@@ -0,0 +1,37 @@
+#!/usr/bin/env node
+/*
+ *
+ * Copyright 2013 Brett Rudd
+ *
+ * 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.
+ *
+*/
+
+var glob = require('glob'),
+    fs = require('fs');
+
+module.exports = function searchAndReplace(srcGlob, variables) {
+  var files = glob.sync(srcGlob);
+  for (var i in files) {
+    var file = files[i];
+    if (fs.lstatSync(file).isFile()) {
+      var contents = fs.readFileSync(file, "utf-8");
+      for (var key in variables) {
+          var regExp = new RegExp("\\$" + key, "g");
+          contents = contents.replace(regExp, variables[key]);
+      }
+      fs.writeFileSync(file, contents);
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/test-helpers.js
----------------------------------------------------------------------
diff --git a/src/util/test-helpers.js b/src/util/test-helpers.js
new file mode 100644
index 0000000..d83f56a
--- /dev/null
+++ b/src/util/test-helpers.js
@@ -0,0 +1,26 @@
+/**
+    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.
+*/
+
+exports.suppressOutput = function(f) {
+    var backupLog = console.log;
+    console.log = function() { }
+    f();
+    console.log = backupLog;
+};
+

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/src/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/src/util/xml-helpers.js b/src/util/xml-helpers.js
new file mode 100644
index 0000000..1197604
--- /dev/null
+++ b/src/util/xml-helpers.js
@@ -0,0 +1,175 @@
+/*
+ *
+ * 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.
+ *
+*/
+
+/**
+ * contains XML utility functions, some of which are specific to elementtree
+ */
+
+var fs = require('fs')
+  , path = require('path')
+  , et = require('elementtree');
+
+exports.moveProjFile = function(origFile, projPath, callback) {
+    var src = path.resolve(projPath, origFile)
+      , dest = src.replace('.orig', '');
+
+    fs.createReadStream(src)
+        .pipe(fs.createWriteStream(dest))
+        .on('close', callback);
+}
+
+// compare two et.XML nodes, see if they match
+// compares tagName, text, attributes and children (recursively)
+exports.equalNodes = function(one, two) {
+    if (one.tag != two.tag) {
+        return false;
+    } else if (one.text.trim() != two.text.trim()) {
+        return false;
+    } else if (one._children.length != two._children.length) {
+        return false;
+    }
+
+    var oneAttribKeys = Object.keys(one.attrib),
+        twoAttribKeys = Object.keys(two.attrib),
+        i = 0, attribName;
+
+    if (oneAttribKeys.length != twoAttribKeys.length) {
+        return false;
+    }
+
+    for (i; i < oneAttribKeys.length; i++) {
+        attribName = oneAttribKeys[i];
+
+        if (one.attrib[attribName] != two.attrib[attribName]) {
+            return false;
+        }
+    }
+
+    for (i; i < one._children.length; i++) {
+        if (!exports.equalNodes(one._children[i], two._children[i])) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+// adds node to doc at selector
+exports.graftXML = function (doc, nodes, selector) {
+    var ROOT = /^\/([^\/]*)/
+      , ABSOLUTE = /^\/([^\/]*)\/(.*)/
+      , parent, tagName, subSelector;
+
+    // handle absolute selector (which elementtree doesn't like)
+    if (ROOT.test(selector)) {
+        tagName = selector.match(ROOT)[1];
+        if (tagName === doc._root.tag) {
+            parent = doc._root;
+
+            // could be an absolute path, but not selecting the root
+            if (ABSOLUTE.test(selector)) {
+                subSelector = selector.match(ABSOLUTE)[2];
+                parent = parent.find(subSelector)
+            }
+        } else {
+            return false;
+        }
+    } else {
+        parent = doc.find(selector)
+    }
+
+    nodes.forEach(function (node) {
+        // check if child is unique first
+        if (uniqueChild(node, parent)) {
+            parent.append(node);
+        }
+    });
+
+    return true;
+}
+
+// removes node from doc at selector
+exports.pruneXML = function(doc, nodes, selector) {
+    var ROOT = /^\/([^\/]*)/
+      , ABSOLUTE = /^\/([^\/]*)\/(.*)/
+      , parent, tagName, subSelector;
+
+    // handle absolute selector (which elementtree doesn't like)
+    if (ROOT.test(selector)) {
+        tagName = selector.match(ROOT)[1];
+        if (tagName === doc._root.tag) {
+            parent = doc._root;
+
+            // could be an absolute path, but not selecting the root
+            if (ABSOLUTE.test(selector)) {
+                subSelector = selector.match(ABSOLUTE)[2];
+                parent = parent.find(subSelector)
+            }
+        } else {
+            return false;
+        }
+    } else {
+        parent = doc.find(selector)
+    }
+    nodes.forEach(function (node) {
+        var matchingKid = null;
+        if ((matchingKid = findChild(node, parent)) != null) {
+            // stupid elementtree takes an index argument it doesn't use
+            // and does not conform to the python lib
+            parent.remove(0, matchingKid);
+        }
+    });
+
+    return true;
+}
+
+exports.parseElementtreeSync = function (filename) {
+    var contents = fs.readFileSync(filename, 'utf-8');
+    return new et.ElementTree(et.XML(contents));
+}
+
+
+function findChild(node, parent) {
+    var matchingKids = parent.findall(node.tag)
+      , i, j;
+
+    for (i = 0, j = matchingKids.length ; i < j ; i++) {
+        if (exports.equalNodes(node, matchingKids[i])) {
+            return matchingKids[i];
+        }
+    }
+    return null;
+}
+
+function uniqueChild(node, parent) {
+    var matchingKids = parent.findall(node.tag)
+      , i = 0;
+
+    if (matchingKids.length == 0) {
+        return true;
+    } else  {
+        for (i; i < matchingKids.length; i++) {
+            if (exports.equalNodes(node, matchingKids[i])) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/test/android-one-install.js
----------------------------------------------------------------------
diff --git a/test/android-one-install.js b/test/android-one-install.js
index d9167cc..0ae8f45 100644
--- a/test/android-one-install.js
+++ b/test/android-one-install.js
@@ -54,60 +54,54 @@ describe('Installation on Cordova-Android 1.x projects', 
function() {
         shell.rm('-rf', test_dir);
     });
 
-    it('should install webless plugin', function () {
+    it('should install webless plugin\'s native code', function () {
         // setting up a DummyPlugin
         silent(function() {
             plugman.handlePlugin('install', 'android', test_project_dir, 
'WeblessPlugin', plugins_dir);
         });
+        expect(fs.existsSync(path.join(test_project_dir, 'src', 'com', 
'phonegap', 'plugins', 'weblessplugin', 'WeblessPlugin.java'))).toBe(true);
     });
 
-    exports['should move the js file'] = function (test) {
+    it('should copy the js file', function () {
         var pluginsPath = path.join(test_dir, 'plugins');
-        var wwwPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www');
-        var jsPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www', 'plugins', 'com.phonegap.plugins.childbrowser', 'www', 
'childbrowser.js');
+        var wwwPath = path.join(test_project_dir, 'assets', 'www');
+        var jsPath = path.join(wwwPath, 'plugins', 
'com.phonegap.plugins.childbrowser', 'www', 'childbrowser.js');
 
         silent(function() {
             plugman.handlePlugin('install', 'android', test_project_dir, 
'ChildBrowser', plugins_dir);
         });
 
-        var stats = fs.statSync(jsPath);
-        test.ok(stats);
-        test.ok(stats.isFile());
-        test.done();
-    }
+        expect(fs.existsSync(jsPath)).toBe(true);
+    });
 
-    exports['should move the asset file'] = function(test) {
-        var wwwPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www');
+    it('should move asset files', function() {
+        var wwwPath = path.join(test_project_dir, 'assets', 'www');
 
         silent(function() {
             plugman.handlePlugin('install', 'android', test_project_dir, 
'ChildBrowser', plugins_dir);
         });
 
-        var assetPath = path.join(test_dir, 'projects', 'android_one', 
'assets', 'www', 'childbrowser_file.html');
-        var assets = fs.statSync(assetPath);
+        var assetPath = path.join(wwwPath, 'childbrowser_file.html');
 
-        test.ok(assets);
-        test.ok(assets.isFile());
-        test.done();
-    }
+        expect(fs.existsSync(assetPath)).toBe(true);
+    });
 
-    exports['should move the asset directory'] = function (test) {
-        var wwwPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www');
+    it('should move asset directories', function () {
+        var wwwPath = path.join(test_project_dir, 'assets', 'www');
 
         silent(function() {
             plugman.handlePlugin('install', 'android', test_project_dir, 
'ChildBrowser', plugins_dir);
         });
 
-        var assetPath = path.join(test_dir, 'projects', 'android_one', 
'assets', 'www', 'childbrowser');
+        var assetPath = path.join(wwwPath, 'childbrowser');
         var assets = fs.statSync(assetPath);
 
-        test.ok(assets.isDirectory());
-        test.ok(fs.statSync(assetPath + '/image.jpg'))
-        test.done();
-    }
+        expect(assets.isDirectory()).toBe(true);
+        expect(fs.existsSync(path.join(assetPath, 'image.jpg'))).toBe(true);
+    });
 
-    exports['should add entries to the cordova_plugins.json file'] = 
function(test) {
-        var wwwPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www');
+    it('should add entries to the cordova_plugins.json file', function() {
+        var wwwPath = path.join(test_project_dir, 'assets', 'www');
 
         silent(function() {
             plugman.handlePlugin('install', 'android', test_project_dir, 
'ChildBrowser', plugins_dir);
@@ -116,11 +110,7 @@ describe('Installation on Cordova-Android 1.x projects', 
function() {
         var jsonPath = path.join(wwwPath, 'cordova_plugins.json');
         var content = JSON.parse(fs.readFileSync(jsonPath, 'utf-8'));
 
-        test.ok(content);
-        test.ok(content.length > 0);
-        test.ok(content[0].file);
-        test.done();
-    };
+    });
 
     exports['should move the src file'] = function (test) {
         var wwwPath = path.join(test_dir, 'projects', 'android_one', 'assets', 
'www');

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/config-changes.js
----------------------------------------------------------------------
diff --git a/util/config-changes.js b/util/config-changes.js
deleted file mode 100644
index d931039..0000000
--- a/util/config-changes.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-// takes an xml list of config-file tags
-// returns a JS object with an easy to use structure
-
-module.exports = function configChanges(baseTag) {
-    var tags = baseTag.findall('./config-file'),
-        files = {};
-
-    tags.forEach(function (tag) {
-        var target = tag.attrib['target'];
-
-        if (files[target]) {
-            files[target].push(tag);
-        } else {
-            files[target] = [tag];
-        }
-    });
-
-    return files;
-}

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/fs.js
----------------------------------------------------------------------
diff --git a/util/fs.js b/util/fs.js
deleted file mode 100644
index 3d9f374..0000000
--- a/util/fs.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-var fs = require('fs');
-
-// polyfill for Node 0.6.x
-if (!fs.existsSync) {
-    fs.existsSync = function (path) {
-        try {
-            fs.statSync(path);
-            return true;
-        } catch (e) {
-            return false;
-        }
-    }
-}
-
-module.exports = fs;

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/plugin_loader.js
----------------------------------------------------------------------
diff --git a/util/plugin_loader.js b/util/plugin_loader.js
deleted file mode 100644
index e16b863..0000000
--- a/util/plugin_loader.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/**
-    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.
-*/
-
-var path            = require('path'),
-    fs              = require('fs'),
-    shell           = require('shelljs'),
-    ls              = fs.readdirSync,
-    util            = require('util'),
-    exec            = require('child_process').exec,
-    et              = require('elementtree');
-
-
-// Called on --prepare.
-// Sets up each plugin's Javascript code to be loaded properly.
-// Expects a path to the project (platforms/android in CLI, . in plugman-only),
-// a path to where the plugins are downloaded, the www dir, and the platform 
('android', 'ios', etc.).
-exports.handlePrepare = function(projectRoot, plugins_dir, wwwDir, platform) {
-    // Process:
-    // - List all plugins in plugins_dir
-    // - Load and parse their plugin.xml files.
-    // - Skip those without support for this platform. (No <platform> tags 
means JS-only!)
-    // - Build a list of all their js-modules, including platform-specific 
js-modules.
-    // - For each js-module (general first, then platform) build up an object 
storing the path and any clobbers, merges and runs for it.
-    // - Write this object into www/plugins.json.
-    // - Cordova.js contains code to load them at runtime from that file.
-
-    var plugins = ls(plugins_dir);
-
-    // This array holds all the metadata for each module and ends up in 
cordova_plugins.json
-    var moduleObjects = [];
-
-    plugins && plugins.forEach(function(plugin) {
-        var pluginDir = path.join(plugins_dir, plugin);
-        if(fs.statSync(pluginDir).isDirectory()){
-            var xml = new 
et.ElementTree(et.XML(fs.readFileSync(path.join(pluginDir, 'plugin.xml'), 
'utf-8')));
-    
-            var plugin_id = xml.getroot().attrib.id;
-    
-            // Copy all the <asset>s into the platform's www/
-            var assets = xml.findall('./asset');
-            assets && assets.forEach(function(asset) {
-                var target = asset.attrib.target;
-               
-                var lastSlash = target.lastIndexOf('/');
-                var dirname  = lastSlash < 0 ? ''     : target.substring(0, 
lastSlash);
-                var basename = lastSlash < 0 ? target : 
target.substring(lastSlash + 1);
-    
-                var targetDir = path.join(wwwDir, dirname);
-                 
-                shell.mkdir('-p', targetDir);
-    
-                var srcFile = path.join(pluginDir, asset.attrib.src);
-                var targetFile = path.join(targetDir, basename);
-    
-                var cpOptions = '-f';
-                
-                if(fs.statSync(srcFile).isDirectory()){
-                    shell.mkdir('-p',targetFile);
-                    srcFile = srcFile+'/*';
-                    cpOptions = '-Rf';
-                }
-    
-                shell.cp(cpOptions, [srcFile], targetFile);
-                
-            });
-    
-            // And then add the plugins dir to the platform's www.
-            var platformPluginsDir = path.join(wwwDir, 'plugins');
-            shell.mkdir('-p', platformPluginsDir);
-    
-            var generalModules = xml.findall('./js-module');
-            var platformTag = xml.find(util.format('./platform[@name="%s"]', 
platform));
-    
-            generalModules = generalModules || [];
-            var platformModules = platformTag ? 
platformTag.findall('./js-module') : [];
-            var allModules = generalModules.concat(platformModules);
-    
-            allModules.forEach(function(module) {
-                // Copy the plugin's files into the www directory.
-                var dirname = module.attrib.src;
-                var lastSlash = dirname.lastIndexOf('/');
-                if (lastSlash >= 0) {
-                    dirname = dirname.substring(0, lastSlash);
-                } else {
-                    dirname = ''; // Just the file, no subdir.
-                }
-    
-                var dir = path.join(platformPluginsDir, plugin_id, dirname);
-                shell.mkdir('-p', dir);
-    
-                // Read in the file, prepend the cordova.define, and write it 
back out.
-                var moduleName = plugin_id + '.';
-                if (module.attrib.name) {
-                    moduleName += module.attrib.name;
-                } else {
-                    var result = module.attrib.src.match(/([^\/]+)\.js/);
-                    moduleName += result[1];
-                }
-    
-                var scriptContent = fs.readFileSync(path.join(pluginDir, 
module.attrib.src), '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');
-    
-                // Prepare the object for cordova_plugins.json.
-                var obj = {
-                    file: path.join('plugins', plugin_id, module.attrib.src),
-                    id: moduleName
-                };
-    
-                // Loop over the children of the js-module tag, collecting 
clobbers, merges and runs.
-                module.getchildren().forEach(function(child) {
-                    if (child.tag.toLowerCase() == 'clobbers') {
-                        if (!obj.clobbers) {
-                            obj.clobbers = [];
-                        }
-                        obj.clobbers.push(child.attrib.target);
-                    } else if (child.tag.toLowerCase() == 'merges') {
-                        if (!obj.merges) {
-                            obj.merges = [];
-                        }
-                        obj.merges.push(child.attrib.target);
-                    } else if (child.tag.toLowerCase() == 'runs') {
-                        obj.runs = true;
-                    }
-                });
-    
-                // Add it to the list of module objects bound for 
cordova_plugins.json
-                moduleObjects.push(obj);
-            });
-        }
-    });
-
-    // Write out moduleObjects as JSON to cordova_plugins.json
-    fs.writeFileSync(path.join(wwwDir, 'cordova_plugins.json'), 
JSON.stringify(moduleObjects), 'utf-8');
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/plugins.js
----------------------------------------------------------------------
diff --git a/util/plugins.js b/util/plugins.js
deleted file mode 100644
index 7c8dbb6..0000000
--- a/util/plugins.js
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/env node
-/*
- *
- * 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.
- *
-*/
-
-var http = require('http'),
-    osenv = require('osenv'),
-    path = require('path'),
-    fs = require('fs'),
-    util = require('util'),
-    shell = require('shelljs'),
-    remote = require(path.join(__dirname, '..', 'config', 'remote'));
-
-// Fetches plugin information from remote server
-exports.getPluginInfo = function(plugin_name, success, error) {
-    var responded = false;
-    http.get(remote.url + util.format(remote.query_path, plugin_name), 
function(res) {
-        var str = '';
-        res.on('data', function (chunk) {
-            str += chunk;
-        });
-        res.on('end', function () {
-            responded = true;
-            var response, plugin_info;
-            if((response = JSON.parse(str)).rows.length == 1) {
-                plugin_info = response.rows[0].value;
-                success(plugin_info);
-            } else {
-                error("Could not find information on "+plugin_name+" plugin");
-            }
-        });
-
-    }).on('error', function(e) {
-        console.log("Got error: " + e.message);
-        error(e.message);
-    });
-
-    setTimeout(function() {
-        if (!responded) {
-            console.log('timed out');
-            error('timed out')
-        }
-    }, 3000);
-}
-
-exports.listAllPlugins = function(success, error) {
-    http.get(remote.url + remote.list_path, function(res) {
-      var str = '';
-      res.on('data', function (chunk) {
-        str += chunk;
-      });
-      res.on('end', function () {
-          var plugins = (JSON.parse(str)).rows;
-          success(plugins);
-      });
-      
-    }).on('error', function(e) {
-      console.log("Got error: " + e.message);
-      error(e.message);
-    });
-}
-
-exports.clonePluginGitRepo = function(plugin_git_url, plugins_dir) {
-    if(!shell.which('git')) {
-        throw new Error('git command line is not installed');
-    }
-    // use osenv to get a temp directory in a portable way
-    var lastSlash = plugin_git_url.lastIndexOf('/');
-    var basename = plugin_git_url.substring(lastSlash+1);
-    var dotGitIndex = basename.lastIndexOf('.git');
-    if (dotGitIndex >= 0) {
-      basename = basename.substring(0, dotGitIndex);
-    }
-
-    var plugin_dir = path.join(plugins_dir, basename);
-
-    // trash it if it already exists (something went wrong before probably)
-    if(fs.existsSync(plugin_dir)) {
-        shell.rm('-rf', plugin_dir);
-    }
-
-    if(shell.exec('git clone ' + plugin_git_url + ' ' + plugin_dir + ' 2>&1 
1>/dev/null', {silent: true}).code != 0) {
-        throw new Error('failed to get the plugin via git URL '+ 
plugin_git_url);
-    }
-    
-    return plugin_dir;
-}
-
-// TODO add method for archives and other formats
-// exports.extractArchive = function(plugin_dir) {
-// }
-
-// TODO add method to publish plugin from cli 
-// exports.publishPlugin = function(plugin_dir) {
-// }
-
-// TODO add method to unpublish plugin from cli 
-// exports.unpublishPlugin = function(plugin_dir) {
-// }

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/search-and-replace.js
----------------------------------------------------------------------
diff --git a/util/search-and-replace.js b/util/search-and-replace.js
deleted file mode 100644
index dc1f931..0000000
--- a/util/search-and-replace.js
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env node
-/*
- *
- * Copyright 2013 Brett Rudd
- *
- * 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.
- *
-*/
-
-var glob = require('glob'),
-    fs = require('fs');
-
-module.exports = function searchAndReplace(srcGlob, variables) {
-  var files = glob.sync(srcGlob);
-  for (var i in files) {
-    var file = files[i];
-    if (fs.lstatSync(file).isFile()) {
-      var contents = fs.readFileSync(file, "utf-8");
-      for (var key in variables) {
-          var regExp = new RegExp("\\$" + key, "g");
-          contents = contents.replace(regExp, variables[key]);
-      }
-      fs.writeFileSync(file, contents);
-    }
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/test-helpers.js
----------------------------------------------------------------------
diff --git a/util/test-helpers.js b/util/test-helpers.js
deleted file mode 100644
index d83f56a..0000000
--- a/util/test-helpers.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
-    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.
-*/
-
-exports.suppressOutput = function(f) {
-    var backupLog = console.log;
-    console.log = function() { }
-    f();
-    console.log = backupLog;
-};
-

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5f4bb9d5/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/util/xml-helpers.js b/util/xml-helpers.js
deleted file mode 100644
index 1197604..0000000
--- a/util/xml-helpers.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- *
- * 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.
- *
-*/
-
-/**
- * contains XML utility functions, some of which are specific to elementtree
- */
-
-var fs = require('fs')
-  , path = require('path')
-  , et = require('elementtree');
-
-exports.moveProjFile = function(origFile, projPath, callback) {
-    var src = path.resolve(projPath, origFile)
-      , dest = src.replace('.orig', '');
-
-    fs.createReadStream(src)
-        .pipe(fs.createWriteStream(dest))
-        .on('close', callback);
-}
-
-// compare two et.XML nodes, see if they match
-// compares tagName, text, attributes and children (recursively)
-exports.equalNodes = function(one, two) {
-    if (one.tag != two.tag) {
-        return false;
-    } else if (one.text.trim() != two.text.trim()) {
-        return false;
-    } else if (one._children.length != two._children.length) {
-        return false;
-    }
-
-    var oneAttribKeys = Object.keys(one.attrib),
-        twoAttribKeys = Object.keys(two.attrib),
-        i = 0, attribName;
-
-    if (oneAttribKeys.length != twoAttribKeys.length) {
-        return false;
-    }
-
-    for (i; i < oneAttribKeys.length; i++) {
-        attribName = oneAttribKeys[i];
-
-        if (one.attrib[attribName] != two.attrib[attribName]) {
-            return false;
-        }
-    }
-
-    for (i; i < one._children.length; i++) {
-        if (!exports.equalNodes(one._children[i], two._children[i])) {
-            return false;
-        }
-    }
-
-    return true;
-}
-
-// adds node to doc at selector
-exports.graftXML = function (doc, nodes, selector) {
-    var ROOT = /^\/([^\/]*)/
-      , ABSOLUTE = /^\/([^\/]*)\/(.*)/
-      , parent, tagName, subSelector;
-
-    // handle absolute selector (which elementtree doesn't like)
-    if (ROOT.test(selector)) {
-        tagName = selector.match(ROOT)[1];
-        if (tagName === doc._root.tag) {
-            parent = doc._root;
-
-            // could be an absolute path, but not selecting the root
-            if (ABSOLUTE.test(selector)) {
-                subSelector = selector.match(ABSOLUTE)[2];
-                parent = parent.find(subSelector)
-            }
-        } else {
-            return false;
-        }
-    } else {
-        parent = doc.find(selector)
-    }
-
-    nodes.forEach(function (node) {
-        // check if child is unique first
-        if (uniqueChild(node, parent)) {
-            parent.append(node);
-        }
-    });
-
-    return true;
-}
-
-// removes node from doc at selector
-exports.pruneXML = function(doc, nodes, selector) {
-    var ROOT = /^\/([^\/]*)/
-      , ABSOLUTE = /^\/([^\/]*)\/(.*)/
-      , parent, tagName, subSelector;
-
-    // handle absolute selector (which elementtree doesn't like)
-    if (ROOT.test(selector)) {
-        tagName = selector.match(ROOT)[1];
-        if (tagName === doc._root.tag) {
-            parent = doc._root;
-
-            // could be an absolute path, but not selecting the root
-            if (ABSOLUTE.test(selector)) {
-                subSelector = selector.match(ABSOLUTE)[2];
-                parent = parent.find(subSelector)
-            }
-        } else {
-            return false;
-        }
-    } else {
-        parent = doc.find(selector)
-    }
-    nodes.forEach(function (node) {
-        var matchingKid = null;
-        if ((matchingKid = findChild(node, parent)) != null) {
-            // stupid elementtree takes an index argument it doesn't use
-            // and does not conform to the python lib
-            parent.remove(0, matchingKid);
-        }
-    });
-
-    return true;
-}
-
-exports.parseElementtreeSync = function (filename) {
-    var contents = fs.readFileSync(filename, 'utf-8');
-    return new et.ElementTree(et.XML(contents));
-}
-
-
-function findChild(node, parent) {
-    var matchingKids = parent.findall(node.tag)
-      , i, j;
-
-    for (i = 0, j = matchingKids.length ; i < j ; i++) {
-        if (exports.equalNodes(node, matchingKids[i])) {
-            return matchingKids[i];
-        }
-    }
-    return null;
-}
-
-function uniqueChild(node, parent) {
-    var matchingKids = parent.findall(node.tag)
-      , i = 0;
-
-    if (matchingKids.length == 0) {
-        return true;
-    } else  {
-        for (i; i < matchingKids.length; i++) {
-            if (exports.equalNodes(node, matchingKids[i])) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
-

Reply via email to