You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/06/20 22:43:06 UTC
git commit: 0.7.15. Made help output more.. helpful. Factored out
into own module.
Updated Branches:
refs/heads/master 79d1cf652 -> e911da27d
0.7.15. Made help output more.. helpful. Factored out into own module.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/e911da27
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/e911da27
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/e911da27
Branch: refs/heads/master
Commit: e911da27d14b16af1094069caf206bc008f0b3e7
Parents: 79d1cf6
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Jun 20 13:43:00 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Jun 20 13:43:00 2013 -0700
----------------------------------------------------------------------
doc/help.txt | 30 ++++++++++++++++++++++++++++++
main.js | 17 ++++++-----------
package.json | 2 +-
plugman.js | 1 +
src/help.js | 7 +++++++
5 files changed, 45 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e911da27/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
new file mode 100644
index 0000000..3a45a73
--- /dev/null
+++ b/doc/help.txt
@@ -0,0 +1,30 @@
+plugman installs and uninstalls plugin.xml-compatible cordova plugins into cordova-generated projects.
+
+Usage
+=====
+
+Install a plugin
+----------------
+
+ $ plugman --platform <platform> --project <directory> --plugin <plugin> [--variable NAME=VALUE]
+
+Parameters:
+
+ - <platform>: One of android, ios, blackberry10, wp7 or wp8
+ - project <directory>: Path reference to a cordova-generated project of the platform you specify
+ - plugin <plugin>: One of a path reference to a local copy of a plugin, or a remote https: or git: URL pointing to a cordova plugin
+ - variable NAME=VALUE: Some plugins require install-time variables to be defined. These could be things like API keys/tokens or other app-specific variables.
+
+Uninstall a plugin
+------------------
+
+ $ plugman --uninstall --platform <platform> --project <directory> --plugin <plugin-id>
+
+Parameters:
+ - plugin <plugin-id>: The plugin to remove, identified by its id (see the plugin.xml's <plugin id> attribute)
+
+Optional parameters
+-------------------
+
+ - www <directory>: www assets for the plugin will be installed into this directory. Default is to install into the standard www directory for the platform specified
+ - plugins_dir <directory>: a copy of the plugin will be stored in this directory. Default is to install into the <project directory>/plugins folder
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e911da27/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 3589496..28a3358 100755
--- a/main.js
+++ b/main.js
@@ -52,7 +52,11 @@ if (cli_opts.plugins_dir || cli_opts.project) {
}
process.on('uncaughtException', function(error){
- console.error(error.stack);
+ if (cli_opts.debug) {
+ console.error(error.stack);
+ } else {
+ console.error(error.message);
+ }
process.exit(1);
});
@@ -60,7 +64,7 @@ if (cli_opts.v) {
console.log(package.name + ' version ' + package.version);
}
else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
- printUsage();
+ plugman.help();
}
else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
@@ -81,12 +85,3 @@ else {
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
}
-
-function printUsage() {
- platforms = known_opts.platform.join('|');
- console.log('Usage\n---------');
- console.log('Install a plugin (will fetch if cannot be found):\n\t' + package.name + ' --platform <'+ platforms +'> --project <directory> --plugin <name|path|url> [--www <directory>] [--plugins_dir <directory>] [--variable <name>=<value>]\n');
- console.log('Uninstall a plugin:\n\t' + package.name + ' --uninstall --platform <'+ platforms +'> --project <directory> --plugin <id> [--www <directory>] [--plugins_dir <directory>]\n');
- console.log('\n\t--plugins_dir defaults to <project>/cordova/plugins, but can be any directory containing a subdirectory for each plugin');
- console.log('\n\t--www defaults to the project\'s www folder, but can be any directory where web assets should be installed into');
-}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e911da27/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index fe62338..937da53 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.7.14",
+ "version": "0.7.15",
"repository": {
"type": "git",
"url": "git://git-wip-us.apache.org/repos/asf/cordova-plugman.git"
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e911da27/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 755204f..23128ed 100755
--- a/plugman.js
+++ b/plugman.js
@@ -19,6 +19,7 @@
// copyright (c) 2013 Andrew Lunny, Adobe Systems
module.exports = {
+ help: require('./src/help'),
install: require('./src/install'),
uninstall:require('./src/uninstall'),
fetch: require('./src/fetch'),
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e911da27/src/help.js
----------------------------------------------------------------------
diff --git a/src/help.js b/src/help.js
new file mode 100644
index 0000000..210cc48
--- /dev/null
+++ b/src/help.js
@@ -0,0 +1,7 @@
+var fs = require('fs'),
+ path = require('path');
+var doc_txt = path.join(__dirname, '..', 'doc', 'help.txt');
+
+module.exports = function help() {
+ console.log(fs.readFileSync(doc_txt, 'utf-8'));
+};