You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2013/08/09 15:58:23 UTC

webworks commit: [CB-4259] Removing plugman and cordova/plugin script

Updated Branches:
  refs/heads/master f102d3f0d -> cfee530f6


[CB-4259] Removing plugman and cordova/plugin script

Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>


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

Branch: refs/heads/master
Commit: cfee530f6acfde9e69885ca6e8c1fc7ba8a8b7d3
Parents: f102d3f
Author: Jeffrey Heifetz <jh...@blackberry.com>
Authored: Fri Aug 2 11:33:32 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Aug 9 09:58:14 2013 -0400

----------------------------------------------------------------------
 blackberry10/README.md                          |   8 +-
 .../project/cordova/lib/plugin-wrapper.js       |  21 --
 .../bin/templates/project/cordova/lib/plugin.js | 192 -------------------
 .../bin/templates/project/cordova/plugin        |   4 -
 .../bin/templates/project/cordova/plugin.bat    |  21 --
 blackberry10/package.json                       |   3 +-
 6 files changed, 6 insertions(+), 243 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/README.md
----------------------------------------------------------------------
diff --git a/blackberry10/README.md b/blackberry10/README.md
index 8091adf..8df980c 100644
--- a/blackberry10/README.md
+++ b/blackberry10/README.md
@@ -139,20 +139,22 @@ To add additional functionality that is outside of the core features of Cordova,
 
 In order to use a plugin, you must first add it into your project. Once added into your project, the plugin will be bundled with your project during the build process, to ensure that your app has access to all the APIs it needs.
 
+To add and manage plugins you can use the plugman tool. It is available via npm (ie npm install -g plugman)
+
 ###Add a plugin
 
 To add a plugin, on the command line, type the following command:
 
-        <path-to-project>/cordova/plugin add <path to plugin>
+        plugman install --platform blackberry10 --project . --plugin <id|path|url> [--variable NAME=name]
 
 ###Remove a plugin
 
 To remove a plugin, on the command line, type the following command:
 
-        <path-to-project>/cordova/plugin rm <name>
+        plugman uninstall --platform blackberry10 --project . --plugin <id>
 
 ###View a list of installed plugins
 
 To view a list of installed plugins, on the command line, type the following command:
 
-        <path-to-project>/cordova/plugin ls
+        plugman ls

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/bin/templates/project/cordova/lib/plugin-wrapper.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/plugin-wrapper.js b/blackberry10/bin/templates/project/cordova/lib/plugin-wrapper.js
deleted file mode 100755
index d14f0ae..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/plugin-wrapper.js
+++ /dev/null
@@ -1,21 +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.
- */
-
-require(require("path").join(__dirname, "plugin.js")).cli();
-

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/bin/templates/project/cordova/lib/plugin.js
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/lib/plugin.js b/blackberry10/bin/templates/project/cordova/lib/plugin.js
deleted file mode 100644
index 13c547b..0000000
--- a/blackberry10/bin/templates/project/cordova/lib/plugin.js
+++ /dev/null
@@ -1,192 +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"),
-    wrench = require("wrench"),
-    fs = require('fs'),
-    et   = require('elementtree'),
-    plugman = require('plugman'),
-    PROJECT_ROOT = path.join(__dirname, "..", ".."),
-    PLUGMAN = path.join(PROJECT_ROOT, "cordova", "node_modules", "plugman", "main.js"),
-    GLOBAL_PLUGIN_PATH = require(path.join(PROJECT_ROOT, "project.json")).globalFetchDir,
-    LOCAL_PLUGIN_PATH = path.join(PROJECT_ROOT, "plugins"),
-    argumentor = {
-        action : process.argv[2],
-        plugin: process.argv[3],
-        args: [],
-        reset: function () {
-            this.args = [];
-            return argumentor;
-        },
-        setAction: function () {
-            this.args.action = this.action;
-            return argumentor;
-        },
-        setPlatform: function () {
-            this.args.platform = "blackberry10";
-            return argumentor;
-        },
-        setProject: function () {
-            this.args.project = PROJECT_ROOT;
-            return argumentor;
-        },
-        setPlugin: function () {
-            var pluginWithoutTrailingSlash = this.plugin.charAt(this.plugin.length - 1) === "/" ? this.plugin.slice(0, -1) : this.plugin;
-            this.args.plugin = pluginWithoutTrailingSlash;
-            return argumentor;
-        },
-        setPluginsDir: function (isGlobal) {
-            if (isGlobal) {
-                this.args.pluginDir = GLOBAL_PLUGIN_PATH;
-            } else {
-                this.args.pluginDir = LOCAL_PLUGIN_PATH;
-            }
-            return argumentor;
-        },
-        run: function () {
-            plugman.install(this.args.platform, this.args.project, this.args.plugin, this.args.pluginDir, {});
-        }
-    },
-    plugmanInterface= {
-        "uninstall": function (plugin) {
-                if (plugin) {
-                    argumentor.plugin = plugin;
-                }
-                argumentor.action = "uninstall";
-                argumentor.reset().setAction().setPlatform().setProject().setPlugin().setPluginsDir().run();
-            },
-        "install": function (plugin) {
-                if (plugin) {
-                    argumentor.plugin = plugin;
-                }
-                argumentor.reset().setPlatform().setProject().setPlugin().setPluginsDir().run();
-            }
-    };
-
-function getPluginId(pluginXMLPath) {
-    var pluginEt = new et.ElementTree(et.XML(fs.readFileSync(pluginXMLPath, "utf-8")));
-    return pluginEt._root.attrib.id;
-}
-
-function addPlugin (pluginPath) {
-    var plugin = pluginPath || argumentor.plugin,
-        pluginDirs = [],
-        allFiles;
-
-
-    //Check if the path they sent in exists
-    if (!fs.existsSync(plugin) ) {
-        //Check if the plugin has been fetched globally
-        plugin = path.resolve(GLOBAL_PLUGIN_PATH, plugin);
-    }
-
-    //Check if the new global path is good, if not just pass through
-    if (!fs.existsSync(plugin)) {
-        plugmanInterface.install(pluginPath || argumentor.plugin);
-    } else {
-
-        allFiles = wrench.readdirSyncRecursive(plugin);
-        allFiles.forEach(function (file) {
-            var fullPath = path.resolve(plugin, file);
-
-            if (path.basename(file) === "plugin.xml") {
-                pluginDirs.push(path.dirname(fullPath));
-            }
-        });
-
-        if (!pluginDirs.length) {
-            console.log("No plugins could be found given the input " + pluginPath || argumentor.plugin);
-            listHelp();
-            process.exit(1);
-        } else {
-            pluginDirs.forEach(function (pluginDir) {
-                plugmanInterface.install(pluginDir);
-            });
-        }
-    }
-}
-
-function removePlugin (pluginPath) {
-    var plugin = pluginPath || argumentor.plugin,
-        pluginIds = [],
-        allFiles;
-
-    //Check if the path they send in exists
-    if (!fs.existsSync(plugin) ) {
-        //Check if it is the folder name of an installed plugin
-        plugin = path.resolve(LOCAL_PLUGIN_PATH, plugin);
-        if (!fs.existsSync(plugin)) {
-            //Assume that this is a plugin id and continue
-            plugin = pluginPath || argumentor.plugin;
-        }
-    }
-
-    allFiles = wrench.readdirSyncRecursive(plugin);
-    allFiles.forEach(function (file) {
-        var fullPath = path.resolve(plugin, file),
-            pluginEt;
-
-        if (path.basename(file) === "plugin.xml") {
-            pluginIds.push(getPluginId(fullPath));
-        }
-    });
-
-    pluginIds.forEach(function (pluginId) {
-        plugmanInterface.uninstall(pluginId);
-    });
-
-}
-
-function listPlugins () {
-    fs.readdirSync(LOCAL_PLUGIN_PATH).forEach(function (pluginName) {
-        //TODO: Parse the plugin.xml and get any extra information ie description
-        console.log(pluginName);
-    });
-}
-
-function listHelp () {
-    console.log("\nUsage:");
-    console.log("add <plugin_dir> Adds all plugins contained in the given directory");
-    console.log("rm <plugin_name> [<plugin_name>] Removes all of the listed plugins");
-    console.log("ls Lists all of the currently installed plugins");
-}
-
-function cliEntry () {
-    switch (argumentor.action) {
-        case "add":
-            addPlugin();
-            break;
-        case "rm":
-            removePlugin();
-            break;
-        case "ls":
-            listPlugins();
-            break;
-        default:
-            listHelp();
-    }
-}
-
-module.exports = {
-    add: addPlugin,
-    rm: removePlugin,
-    ls: listPlugins,
-    help: listHelp,
-    cli: cliEntry
-};

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/bin/templates/project/cordova/plugin
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/plugin b/blackberry10/bin/templates/project/cordova/plugin
deleted file mode 100755
index bbecb55..0000000
--- a/blackberry10/bin/templates/project/cordova/plugin
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-source $(dirname "$0")/init
-"$CORDOVA_NODE/node" "$(dirname "$0")/lib/plugin-wrapper" "$@"
-

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/bin/templates/project/cordova/plugin.bat
----------------------------------------------------------------------
diff --git a/blackberry10/bin/templates/project/cordova/plugin.bat b/blackberry10/bin/templates/project/cordova/plugin.bat
deleted file mode 100755
index 3080228..0000000
--- a/blackberry10/bin/templates/project/cordova/plugin.bat
+++ /dev/null
@@ -1,21 +0,0 @@
-@ECHO OFF
-goto comment
-       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.
-:comment
-call "%~dp0init"
-"%CORDOVA_NODE%\node.exe" "%~dps0\lib\plugin-wrapper" %*

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/cfee530f/blackberry10/package.json
----------------------------------------------------------------------
diff --git a/blackberry10/package.json b/blackberry10/package.json
index b89748e..166c66a 100644
--- a/blackberry10/package.json
+++ b/blackberry10/package.json
@@ -26,8 +26,7 @@
     "validator": "0.4.1",
     "wrench": "1.3.9",
     "shelljs":"0.1.3",
-    "elementtree": "0.1.5",
-    "plugman": "0.10.0"
+    "elementtree": "0.1.5"
   },
   "devDependencies": {
     "jake":"*",