You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2013/07/28 02:55:23 UTC
[01/50] git commit: adding actions
Updated Branches:
refs/heads/master 4cf02436a -> 76119e190
adding actions
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/272c7c52
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/272c7c52
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/272c7c52
Branch: refs/heads/master
Commit: 272c7c52c5cbc12b60fd508299d64ff034f743e8
Parents: 59c684a
Author: Anis Kadri <an...@gmail.com>
Authored: Tue Jun 11 18:07:56 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:08:48 2013 -0700
----------------------------------------------------------------------
main.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/272c7c52/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 28a3358..3af9d98 100755
--- a/main.js
+++ b/main.js
@@ -24,6 +24,7 @@ var path = require('path')
, package = require(path.join(__dirname, 'package'))
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
+ , registry = require('plugman-registry')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
@@ -31,6 +32,10 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'plugin' : [String, path, url]
, 'install' : Boolean
, 'uninstall' : Boolean
+ , 'adduser' : Boolean
+ , 'publish' : path
+ , 'unpublish' : path
+ , 'search' : String
, 'v' : Boolean
, 'debug' : Boolean
, 'plugins': path
@@ -69,6 +74,18 @@ else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
+else if (cli_opts.adduser) {
+ // TODO adduser
+}
+else if (cli_opts.publish) {
+ // TODO publish
+}
+else if (cli_opts.unpublish) {
+ // TODO unpublish
+}
+else if (cli_opts.search) {
+ // TODO search
+}
else {
var cli_variables = {}
if (cli_opts.variable) {
[26/50] git commit: minor refactor, added specs
Posted by an...@apache.org.
minor refactor, added specs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/3a76a367
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/3a76a367
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/3a76a367
Branch: refs/heads/master
Commit: 3a76a3675f57b1f2473e4723a9282ef1ee36c47f
Parents: 14aa254
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:08:23 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:16:44 2013 -0700
----------------------------------------------------------------------
main.js | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/3a76a367/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index daf5942..a0aca4d 100755
--- a/main.js
+++ b/main.js
@@ -24,8 +24,6 @@ var path = require('path')
, package = require(path.join(__dirname, 'package'))
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
- , registry = require('plugman-registry')
- , config = require('./config')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
[18/50] git commit: updating plugin spec
Posted by an...@apache.org.
updating plugin spec
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/db03ca7d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/db03ca7d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/db03ca7d
Branch: refs/heads/master
Commit: db03ca7d24689e129ec8c268f0f9c4fc2eeb0b22
Parents: 4d4a474
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:08:32 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:54:18 2013 -0700
----------------------------------------------------------------------
plugin_spec.md | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/db03ca7d/plugin_spec.md
----------------------------------------------------------------------
diff --git a/plugin_spec.md b/plugin_spec.md
index a58198e..f5d26a7 100644
--- a/plugin_spec.md
+++ b/plugin_spec.md
@@ -70,12 +70,46 @@ If no `<engine>` tags are specified, plugman will attempt to install into the sp
## <name> element
A human-readable name for the plugin. The text content of the element contains
-the name of the plugin. An example:
+the name of the plugin. Has to be lower case and cannot contain spaces or special characters. An example:
- <name>Foo</name>
+ <name>foo</name>
This element does not (yet) handle localization.
+## <description> element
+
+A human-readable description for the plugin. The text content of the element contains
+the description of the plugin. An example:
+
+ <description>foo plugin description</description>
+
+This element does not (yet) handle localization.
+
+## <author> element
+
+Plugin author name. The text content of the element contains
+the name of the plugin author. An example:
+
+ <author>foo plugin description</author>
+
+## <keywords> element
+
+Plugin keywords. The text content of the element contains comma separated keywords to describe the plugin. An example:
+
+ <keywords>foo,bar</keywords>
+
+## <license> element
+
+Plugin license. The text content of the element contains the plugin license. An example:
+
+ <keywords>foo,bar</keywords>
+
+## <license> element
+
+Plugin license. The text content of the element contains the plugin license. An example:
+
+ <license>Apache</license>
+
## <asset> element
One or more elements listing the files or directories to be copied into a
[29/50] git commit: fixing help
Posted by an...@apache.org.
fixing help
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/93acf395
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/93acf395
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/93acf395
Branch: refs/heads/master
Commit: 93acf395f85f892e3e394884ff69a6e14bd2e264
Parents: 330baef
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 14:34:16 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:34:16 2013 -0700
----------------------------------------------------------------------
main.js | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/93acf395/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 1f7bea5..cd16733 100755
--- a/main.js
+++ b/main.js
@@ -42,7 +42,7 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'link': Boolean
, 'variable' : Array
, 'www': path
-}, shortHands = { 'var' : 'variable', 'v': 'version', 'h': 'help' };
+}, shortHands = { 'var' : ['--variable'], 'v': ['--version'], 'h': ['--help'] };
var cli_opts = nopt(known_opts, shortHands);
@@ -71,15 +71,14 @@ if (cli_opts.debug) {
}
plugman.on('warn', console.warn);
plugman.on('error', console.error);
-
if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
}
else if (cli_opts.help) {
- plugman.help();
+ console.log(plugman.help());
}
else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
- plugman.help();
+ console.log(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 });
@@ -112,5 +111,5 @@ subdir: '.',
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
} else {
- plugman.help();
+ console.log(plugman.help());
}
[47/50] git commit: license appeared twice in the spec
Posted by an...@apache.org.
license appeared twice in the spec
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/453553d5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/453553d5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/453553d5
Branch: refs/heads/master
Commit: 453553d5c9ab2b1a21e788d4eba8c4da64c7db1f
Parents: 2cbb682
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 25 09:19:02 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 25 09:19:02 2013 -0700
----------------------------------------------------------------------
plugin_spec.md | 6 ------
1 file changed, 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/453553d5/plugin_spec.md
----------------------------------------------------------------------
diff --git a/plugin_spec.md b/plugin_spec.md
index f5d26a7..de6d23a 100644
--- a/plugin_spec.md
+++ b/plugin_spec.md
@@ -102,12 +102,6 @@ Plugin keywords. The text content of the element contains comma separated keywor
Plugin license. The text content of the element contains the plugin license. An example:
- <keywords>foo,bar</keywords>
-
-## <license> element
-
-Plugin license. The text content of the element contains the plugin license. An example:
-
<license>Apache</license>
## <asset> element
[31/50] git commit: merging latest master
Posted by an...@apache.org.
merging latest master
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/1dbf5ae8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/1dbf5ae8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/1dbf5ae8
Branch: refs/heads/master
Commit: 1dbf5ae8c0965351a92b659d90b2f36c89887901
Parents: 5a22d2a b340813
Author: Anis Kadri <an...@apache.org>
Authored: Sun Jul 14 15:08:55 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Sun Jul 14 15:08:55 2013 -0700
----------------------------------------------------------------------
README.md | 2 +-
main.js | 1 +
package.json | 5 ++++-
spec/install.spec.js | 18 +++++++++++++++++-
spec/plugins/ChildBrowser/plugin.xml | 6 +++---
spec/plugins/VariablePlugin/plugin.xml | 2 ++
spec/prepare.spec.js | 4 ----
src/install.js | 28 ++++++++++++++++++++--------
src/prepare.js | 7 +------
src/uninstall.js | 8 +++++++-
10 files changed, 56 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/1dbf5ae8/main.js
----------------------------------------------------------------------
diff --cc main.js
index cd16733,4361aba..003ddbc
--- a/main.js
+++ b/main.js
@@@ -71,13 -66,12 +71,14 @@@ if (cli_opts.debug)
}
plugman.on('warn', console.warn);
plugman.on('error', console.error);
+ plugman.on('results', console.log);
-
-if (cli_opts.v) {
+if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
+}
+else if (cli_opts.help) {
+ console.log(plugman.help());
}
-else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
console.log(plugman.help());
}
else if (cli_opts.uninstall) {
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/1dbf5ae8/package.json
----------------------------------------------------------------------
[28/50] git commit: forgot comma
Posted by an...@apache.org.
forgot comma
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/330baef4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/330baef4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/330baef4
Branch: refs/heads/master
Commit: 330baef48baed535660bea3efed08e570024e823
Parents: 5dca7c9
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 14:18:07 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:18:07 2013 -0700
----------------------------------------------------------------------
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/330baef4/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1eeeeb2..2838fca 100644
--- a/package.json
+++ b/package.json
@@ -28,7 +28,7 @@
"ncallbacks":"1.1.0",
"underscore":"1.4.4",
"dep-graph":"1.1.0",
- "semver": "2.0.x"
+ "semver": "2.0.x",
"plugman-registry": "0.0.2"
},
"devDependencies": {
[14/50] git commit: adding registry dependency and wiring up commands
Posted by an...@apache.org.
adding registry dependency and wiring up commands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/ccee1ac6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/ccee1ac6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/ccee1ac6
Branch: refs/heads/master
Commit: ccee1ac6a72e5751ea2c70cf3e2e28f80f42f1ff
Parents: c1ac946
Author: Anis Kadri <an...@gmail.com>
Authored: Thu Jun 13 18:21:27 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:34:49 2013 -0700
----------------------------------------------------------------------
main.js | 34 +++++++++++++++++++++++++++-------
package.json | 1 +
2 files changed, 28 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ccee1ac6/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 2c2dd92..fa08057 100755
--- a/main.js
+++ b/main.js
@@ -33,8 +33,8 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'install' : Boolean
, 'uninstall' : Boolean
, 'adduser' : Boolean
- , 'publish' : path
- , 'unpublish' : path
+ , 'publish' : Boolean
+ , 'unpublish' : Boolean
, 'search' : String
, 'v' : Boolean
, 'debug' : Boolean
@@ -75,23 +75,43 @@ plugman.on('error', console.error);
if (cli_opts.v) {
console.log(package.name + ' version ' + package.version);
}
-else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+else if ((cli_opts.install || cli_opts.uninstall) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
console.log(plugman.help());
+ printUsage();
}
else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
else if (cli_opts.adduser) {
- // TODO adduser
+ registry.use(null, function(err) {
+ registry.adduser(null, function(err) {
+ if(err) return console.log(err);
+ console.log('user added');
+ });
+ });
}
else if (cli_opts.publish) {
- // TODO publish
+ registry.use(null, function(err) {
+ registry.publish([cli_opts.plugin], function(err, d) {
+ if(err) return console.log('Error publishing plugin');
+ console.log('plugin published');
+ });
+ });
}
else if (cli_opts.unpublish) {
- // TODO unpublish
+ registry.use(null, function(err) {
+ registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
+ if(err) return console.log('Error unpublishing plugin');
+ console.log('plugin unpublished');
+ });
+ });
}
else if (cli_opts.search) {
- // TODO search
+ registry.use(null, function(err) {
+ registry.search(cli_opts.search.split(','), function(err, d) {
+ if(err) return console.log(err);
+ });
+ });
}
else {
var cli_variables = {}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ccee1ac6/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1c0f0d6..5fef741 100644
--- a/package.json
+++ b/package.json
@@ -29,6 +29,7 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "2.0.x"
+ "plugman-registry": "0.0.1"
},
"devDependencies": {
"jasmine-node": "1.7.0"
[41/50] git commit: Merge branch 'master' into plugman-registry
Posted by an...@apache.org.
Merge branch 'master' into plugman-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/9dab6808
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/9dab6808
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/9dab6808
Branch: refs/heads/master
Commit: 9dab6808961aa6e6d7f145b6065f6560055ecd70
Parents: 73f5ef2 58be145
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jul 17 17:22:57 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Jul 17 17:22:57 2013 -0700
----------------------------------------------------------------------
package.json | 2 +-
spec/install.spec.js | 6 ++++++
src/install.js | 4 ++++
3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9dab6808/package.json
----------------------------------------------------------------------
[13/50] git commit: adding actions
Posted by an...@apache.org.
adding actions
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/c1ac946b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/c1ac946b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/c1ac946b
Branch: refs/heads/master
Commit: c1ac946bd8045b0d9e6ea743c6c93bdbd8d1e170
Parents: b421b7b
Author: Anis Kadri <an...@gmail.com>
Authored: Tue Jun 11 18:07:56 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:33:03 2013 -0700
----------------------------------------------------------------------
main.js | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c1ac946b/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 262c264..2c2dd92 100755
--- a/main.js
+++ b/main.js
@@ -24,6 +24,7 @@ var path = require('path')
, package = require(path.join(__dirname, 'package'))
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
+ , registry = require('plugman-registry')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
@@ -31,6 +32,10 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'plugin' : [String, path, url]
, 'install' : Boolean
, 'uninstall' : Boolean
+ , 'adduser' : Boolean
+ , 'publish' : path
+ , 'unpublish' : path
+ , 'search' : String
, 'v' : Boolean
, 'debug' : Boolean
, 'plugins': path
@@ -76,6 +81,18 @@ else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
+else if (cli_opts.adduser) {
+ // TODO adduser
+}
+else if (cli_opts.publish) {
+ // TODO publish
+}
+else if (cli_opts.unpublish) {
+ // TODO unpublish
+}
+else if (cli_opts.search) {
+ // TODO search
+}
else {
var cli_variables = {}
if (cli_opts.variable) {
[25/50] git commit: updating cli options and adding short hands
Posted by an...@apache.org.
updating cli options and adding short hands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/14aa2540
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/14aa2540
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/14aa2540
Branch: refs/heads/master
Commit: 14aa2540c62fe2e3be9d5a1755067e0101930910
Parents: 4aa51bd
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:57:52 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:11:05 2013 -0700
----------------------------------------------------------------------
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/14aa2540/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index c570114..daf5942 100755
--- a/main.js
+++ b/main.js
@@ -78,7 +78,7 @@ if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
}
else if (cli_opts.help) {
- console.log(plugman.help());
+ plugman.help();
}
else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
plugman.help();
[43/50] git commit: updating dependencies
Posted by an...@apache.org.
updating dependencies
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/d8d3a6df
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d8d3a6df
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d8d3a6df
Branch: refs/heads/master
Commit: d8d3a6df687feb8975bc21ae8a92ae8ce3038f07
Parents: 1641fe8
Author: Anis Kadri <an...@apache.org>
Authored: Fri Jul 19 14:31:23 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Fri Jul 19 14:31:23 2013 -0700
----------------------------------------------------------------------
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/d8d3a6df/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 7393804..a2f0e86 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "2.0.x",
- "plugman-registry": "0.0.5"
+ "plugman-registry": "0.0.6"
},
"devDependencies": {
"jasmine-node": "1.7.0"
[12/50] git commit: added help
Posted by an...@apache.org.
added help
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/c9a42d68
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/c9a42d68
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/c9a42d68
Branch: refs/heads/master
Commit: c9a42d689e2394c344a3348db7777f0f916e5b54
Parents: 37cb50c bf97513
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:28:50 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:28:50 2013 -0700
----------------------------------------------------------------------
main.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c9a42d68/main.js
----------------------------------------------------------------------
diff --cc main.js
index 153bea8,a0cd602..702fde6
--- a/main.js
+++ b/main.js
@@@ -108,5 -104,18 +108,5 @@@ else if(cli_opts.install)
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
} else {
-- printUsage();
-}
-
-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 + ' --install --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('\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\n');
- console.log('Add a user account to the registry:\n\t' + package.name + ' --adduser\n');
- console.log('Publish a plugin:\n\t' + package.name + ' --publish --plugin plugin_directory\n');
- console.log('Unpublish a plugin:\n\t' + package.name + ' --unpublish --plugin plugin_name@version\n');
- console.log('Search for plugins:\n\t' + package.name + ' --search keyword1,keyword2,...\n');
++ plugman.help();
}
[11/50] git commit: typo
Posted by an...@apache.org.
typo
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/37cb50cc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/37cb50cc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/37cb50cc
Branch: refs/heads/master
Commit: 37cb50cc2683ef73dfd920edd004de9c3343ae63
Parents: 8da6b44
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:27:10 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:27:10 2013 -0700
----------------------------------------------------------------------
doc/help.txt | 24 ++++++++++++++++++++++++
main.js | 2 +-
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/37cb50cc/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index 3a45a73..a4f31cb 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -28,3 +28,27 @@ 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
+
+Interacting with the registry
+=============================
+
+Add a user account
+------------------
+
+ $ plugman --adduser
+
+Publish a plugin
+----------------
+
+ $ plugman --publish --plugin <directory>
+
+Unpublish a plugin
+------------------
+
+ $ plugman --unpublish <name>@<version>
+
+Search for a plugin
+-------------------
+
+ $ plugman --search plugin,keywords
+
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/37cb50cc/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 573765f..153bea8 100755
--- a/main.js
+++ b/main.js
@@ -90,7 +90,7 @@ else if (cli_opts.unpublish && cli_opts.plugin) {
plugman.unpublish(new Array(cli_opts.plugin));
}
else if (cli_opts.search) {
- plugman.search(cli_opts.search.split(',');
+ plugman.search(cli_opts.search.split(','));
}
else if(cli_opts.install) {
var cli_variables = {}
[27/50] git commit: typo
Posted by an...@apache.org.
typo
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/5dca7c94
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/5dca7c94
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/5dca7c94
Branch: refs/heads/master
Commit: 5dca7c94628d995c2bcd7da969de8728ef7c8651
Parents: 3a76a36
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:27:10 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:17:27 2013 -0700
----------------------------------------------------------------------
doc/help.txt | 24 ++++++++++++++++++++++++
main.js | 2 +-
2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5dca7c94/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index 412b3ba..e59d4fa 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -33,3 +33,27 @@ Optional flags
--------------
--debug : Verbose mode
+
+Interacting with the registry
+=============================
+
+Add a user account
+------------------
+
+ $ plugman --adduser
+
+Publish a plugin
+----------------
+
+ $ plugman --publish --plugin <directory>
+
+Unpublish a plugin
+------------------
+
+ $ plugman --unpublish <name>@<version>
+
+Search for a plugin
+-------------------
+
+ $ plugman --search plugin,keywords
+
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5dca7c94/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index a0aca4d..1f7bea5 100755
--- a/main.js
+++ b/main.js
@@ -94,7 +94,7 @@ else if (cli_opts.unpublish && cli_opts.plugin) {
plugman.unpublish(new Array(cli_opts.plugin));
}
else if (cli_opts.search) {
- plugman.search(cli_opts.search.split(',');
+ plugman.search(cli_opts.search.split(','));
}
else if(cli_opts.install) {
var cli_variables = {}
[40/50] git commit: bumping version of dependencies
Posted by an...@apache.org.
bumping version of dependencies
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/73f5ef2a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/73f5ef2a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/73f5ef2a
Branch: refs/heads/master
Commit: 73f5ef2a9d53d5c0078206f1b947b78568c2a2d1
Parents: 365ac3c
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jul 17 17:21:50 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Jul 17 17:21:50 2013 -0700
----------------------------------------------------------------------
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/73f5ef2a/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index e32f528..24c3289 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "2.0.x",
- "plugman-registry": "0.0.2"
+ "plugman-registry": "0.0.5"
},
"devDependencies": {
"jasmine-node": "1.7.0"
[04/50] git commit: adding fetch and fixing cli interface
Posted by an...@apache.org.
adding fetch and fixing cli interface
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/587808c2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/587808c2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/587808c2
Branch: refs/heads/master
Commit: 587808c24830b297216f4e093d0bfa8bc3a70ef2
Parents: 9beb41b
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:30:31 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700
----------------------------------------------------------------------
main.js | 11 ++++++-----
package.json | 2 +-
src/fetch.js | 52 ++++++++++++++++++++++++++++++++++------------------
3 files changed, 41 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/587808c2/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 4602711..a4bac95 100755
--- a/main.js
+++ b/main.js
@@ -25,6 +25,7 @@ var path = require('path')
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
, registry = require('plugman-registry')
+ , config = require('./config')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
@@ -68,14 +69,14 @@ process.on('uncaughtException', function(error){
if (cli_opts.v) {
console.log(package.name + ' version ' + package.version);
}
-else if ((cli_opts.install || cli_opts.uninstall) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
+else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
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 });
}
else if (cli_opts.adduser) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.adduser(null, function(err) {
if(err) return console.log(err);
console.log('user added');
@@ -83,7 +84,7 @@ else if (cli_opts.adduser) {
});
}
else if (cli_opts.publish) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.publish([cli_opts.plugin], function(err, d) {
if(err) return console.log('Error publishing plugin');
console.log('plugin published');
@@ -91,7 +92,7 @@ else if (cli_opts.publish) {
});
}
else if (cli_opts.unpublish) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
if(err) return console.log('Error unpublishing plugin');
console.log('plugin unpublished');
@@ -99,7 +100,7 @@ else if (cli_opts.unpublish) {
});
}
else if (cli_opts.search) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.search(cli_opts.search.split(','), function(err, d) {
if(err) return console.log(err);
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/587808c2/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index f78d2ee..9e8cac7 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "1.x.x",
- "plugman-registry": "0.0.1"
+ "plugman-registry": "0.0.2"
},
"devDependencies": {
"jasmine-node": "1.7.0"
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/587808c2/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 476d138..0589fb5 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -3,7 +3,8 @@ var shell = require('shelljs'),
plugins = require('./util/plugins'),
xml_helpers = require('./util/xml-helpers'),
metadata = require('./util/metadata'),
- path = require('path');
+ path = require('path'),
+ registry = require('plugman-registry');
// possible options: link, subdir, git_ref
module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback) {
@@ -44,27 +45,42 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
// Copy from the local filesystem.
// First, read the plugin.xml and grab the ID.
plugin_dir = path.join(plugin_dir, options.subdir);
- var xml = xml_helpers.parseElementtreeSync(path.join(plugin_dir, 'plugin.xml'));
- var plugin_id = xml.getroot().attrib.id;
- var dest = path.join(plugins_dir, plugin_id);
+ var movePlugin = function(plugin_dir, linkable) {
+ var xml = xml_helpers.parseElementtreeSync(path.join(plugin_dir, 'plugin.xml'));
+ var plugin_id = xml.getroot().attrib.id;
- shell.rm('-rf', dest);
- if (options.link) {
- fs.symlinkSync(plugin_dir, dest, 'dir');
- } else {
- shell.mkdir('-p', dest);
- shell.cp('-R', path.join(plugin_dir, '*') , dest);
- }
+ var dest = path.join(plugins_dir, plugin_id);
+
+ shell.rm('-rf', dest);
+ if (options.link && linkable) {
+ fs.symlinkSync(plugin_dir, dest, 'dir');
+ } else {
+ shell.mkdir('-p', dest);
+ shell.cp('-R', path.join(plugin_dir, '*') , dest);
+ }
+
+ var data = {
+ source: {
+ type: 'local',
+ path: plugin_dir
+ }
+ };
+ metadata.save_fetch_metadata(dest, data);
+
+ if (callback) callback(null, dest);
- var data = {
- source: {
- type: 'local',
- path: plugin_dir
- }
};
- metadata.save_fetch_metadata(dest, data);
- if (callback) callback(null, dest);
+
+ if(!fs.existsSync(plugin_dir)) {
+ registry.use(null, function() {
+ registry.fetch(plugin_dir, function(err, plugin_dir) {
+ movePlugin(plugin_dir, false);
+ });
+ })
+ } else {
+ movePlugin(plugin_dir, true);
+ }
}
};
[07/50] git commit: updating cli options and adding short hands
Posted by an...@apache.org.
updating cli options and adding short hands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/c7a0ff9a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/c7a0ff9a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/c7a0ff9a
Branch: refs/heads/master
Commit: c7a0ff9a88c50156be95d330e90f4e3922beb35d
Parents: 587808c
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:57:52 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700
----------------------------------------------------------------------
main.js | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/c7a0ff9a/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index a4bac95..7baebe6 100755
--- a/main.js
+++ b/main.js
@@ -37,15 +37,19 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'publish' : Boolean
, 'unpublish' : Boolean
, 'search' : String
- , 'v' : Boolean
+ , 'version' : Boolean
+ , 'help' : Boolean
, 'debug' : Boolean
, 'plugins': path
, 'link': Boolean
, 'variable' : Array
, 'www': path
}, shortHands = { 'var' : 'variable' };
-
-var cli_opts = nopt(known_opts);
+var short_hands = {
+ "v": ["--version"]
+ , "h": ["--help"]
+}
+var cli_opts = nopt(known_opts, short_hands);
// Default the plugins_dir to './cordova/plugins'.
var plugins_dir;
@@ -66,8 +70,11 @@ process.on('uncaughtException', function(error){
process.exit(1);
});
-if (cli_opts.v) {
+if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
+}
+else if (cli_opts.help) {
+ printUsage();
}
else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
plugman.help();
[08/50] git commit: minor refactor, added specs
Posted by an...@apache.org.
minor refactor, added specs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/8da6b449
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/8da6b449
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/8da6b449
Branch: refs/heads/master
Commit: 8da6b449d33a26c60b1a56efa641d18a478b0b0e
Parents: dc27fcd
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:08:23 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:13:29 2013 -0700
----------------------------------------------------------------------
config.js | 2 +-
main.js | 32 ++++----------------------------
plugman.js | 4 ++++
spec/adduser.spec.js | 13 +++++++++++++
spec/publish.spec.js | 13 +++++++++++++
spec/search.spec.js | 13 +++++++++++++
spec/unpublish.spec.js | 13 +++++++++++++
src/adduser.js | 11 +++++++++++
src/publish.js | 11 +++++++++++
src/search.js | 13 +++++++++++++
src/unpublish.js | 11 +++++++++++
11 files changed, 107 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
index 7056d93..244bf55 100644
--- a/config.js
+++ b/config.js
@@ -1,3 +1,3 @@
module.exports = {
- registry: "http://localhost:5984/registry/_design/scratch/_rewrite"
+ registry: "http://plugins.cordova.io"
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 99f53f8..573765f 100755
--- a/main.js
+++ b/main.js
@@ -24,8 +24,6 @@ var path = require('path')
, package = require(path.join(__dirname, 'package'))
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
- , registry = require('plugman-registry')
- , config = require('./config')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
@@ -83,38 +81,16 @@ else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
else if (cli_opts.adduser) {
- registry.use(config.registry, function(err) {
- registry.adduser(null, function(err) {
- if(err) return console.log(err);
- console.log('user added');
- });
- });
+ plugman.adduser();
}
else if (cli_opts.publish && cli_opts.plugin) {
- registry.use(config.registry, function(err) {
- registry.publish([cli_opts.plugin], function(err, d) {
- if(err) return console.log('Error publishing plugin', err);
- console.log('plugin published');
- });
- });
+ plugman.publish(new Array(cli_opts.plugin));
}
else if (cli_opts.unpublish && cli_opts.plugin) {
- registry.use(config.registry, function(err) {
- registry.unpublish([cli_opts.plugin], function(err, d) {
- if(err) return console.log('Error unpublishing plugin');
- console.log('plugin unpublished');
- });
- });
+ plugman.unpublish(new Array(cli_opts.plugin));
}
else if (cli_opts.search) {
- registry.use(config.registry, function(err) {
- registry.search(cli_opts.search.split(','), function(err, plugins) {
- if(err) return console.log(err);
- for(var plugin in plugins) {
- console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
- }
- });
- });
+ plugman.search(cli_opts.search.split(',');
}
else if(cli_opts.install) {
var cli_variables = {}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 23128ed..ecc5990 100755
--- a/plugman.js
+++ b/plugman.js
@@ -24,5 +24,9 @@ module.exports = {
uninstall:require('./src/uninstall'),
fetch: require('./src/fetch'),
prepare: require('./src/prepare'),
+ adduser: require('./src/adduser'),
+ publish: require('./src/publish'),
+ unpublish:require('./src/unpublish'),
+ search: require('./src/search'),
config_changes:require('./src/util/config-changes')
};
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/spec/adduser.spec.js
----------------------------------------------------------------------
diff --git a/spec/adduser.spec.js b/spec/adduser.spec.js
new file mode 100644
index 0000000..563592d
--- /dev/null
+++ b/spec/adduser.spec.js
@@ -0,0 +1,13 @@
+var adduser = require('../src/adduser'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('adduser', function() {
+ it('should add a user', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sAddUser = spyOn(registry, 'adduser');
+ adduser();
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sAddUser).toHaveBeenCalled();
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/spec/publish.spec.js
----------------------------------------------------------------------
diff --git a/spec/publish.spec.js b/spec/publish.spec.js
new file mode 100644
index 0000000..3a253e7
--- /dev/null
+++ b/spec/publish.spec.js
@@ -0,0 +1,13 @@
+var publish = require('../src/publish'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('publish', function() {
+ it('should publish a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sPublish = spyOn(registry, 'publish');
+ publish(new Array('/path/to/myplugin'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sPublish).toHaveBeenCalledWith(['/path/to/myplugin'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/spec/search.spec.js
----------------------------------------------------------------------
diff --git a/spec/search.spec.js b/spec/search.spec.js
new file mode 100644
index 0000000..f708854
--- /dev/null
+++ b/spec/search.spec.js
@@ -0,0 +1,13 @@
+var search = require('../src/search'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('search', function() {
+ it('should search a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sSearch = spyOn(registry, 'search');
+ search(new Array('myplugin', 'keyword'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sSearch).toHaveBeenCalledWith(['myplugin', 'keyword'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/spec/unpublish.spec.js
----------------------------------------------------------------------
diff --git a/spec/unpublish.spec.js b/spec/unpublish.spec.js
new file mode 100644
index 0000000..207804d
--- /dev/null
+++ b/spec/unpublish.spec.js
@@ -0,0 +1,13 @@
+var unpublish = require('../src/unpublish'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('unpublish', function() {
+ it('should unpublish a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sUnpublish = spyOn(registry, 'unpublish');
+ unpublish(new Array('myplugin@0.0.1'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sUnpublish).toHaveBeenCalledWith(['myplugin@0.0.1'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/src/adduser.js
----------------------------------------------------------------------
diff --git a/src/adduser.js b/src/adduser.js
new file mode 100644
index 0000000..da7cf4e
--- /dev/null
+++ b/src/adduser.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function() {
+ registry.use(config.registry, function(err) {
+ registry.adduser(null, function(err) {
+ if(err) return console.log(err);
+ console.log('user added');
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/src/publish.js
----------------------------------------------------------------------
diff --git a/src/publish.js b/src/publish.js
new file mode 100644
index 0000000..234de15
--- /dev/null
+++ b/src/publish.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(plugin) {
+ registry.use(config.registry, function(err) {
+ registry.publish(plugin, function(err, d) {
+ if(err) return console.log('Error publishing plugin', err);
+ console.log('plugin published');
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/src/search.js
----------------------------------------------------------------------
diff --git a/src/search.js b/src/search.js
new file mode 100644
index 0000000..2b244b3
--- /dev/null
+++ b/src/search.js
@@ -0,0 +1,13 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(search_opts) {
+ registry.use(config.registry, function(err) {
+ registry.search(search_opts, function(err, plugins) {
+ if(err) return console.log(err);
+ for(var plugin in plugins) {
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ }
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8da6b449/src/unpublish.js
----------------------------------------------------------------------
diff --git a/src/unpublish.js b/src/unpublish.js
new file mode 100644
index 0000000..072d740
--- /dev/null
+++ b/src/unpublish.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(plugin) {
+ registry.use(config.registry, function(err) {
+ registry.unpublish(plugin, function(err, d) {
+ if(err) return console.log('Error unpublishing plugin');
+ console.log('plugin unpublished');
+ });
+ });
+}
[33/50] git commit: adding callback to search
Posted by an...@apache.org.
adding callback to search
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/ae545bc8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/ae545bc8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/ae545bc8
Branch: refs/heads/master
Commit: ae545bc86310b1e355b5cc01b318145de5077cc3
Parents: f5aa406
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jul 15 14:44:46 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Jul 15 14:44:46 2013 -0700
----------------------------------------------------------------------
src/search.js | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ae545bc8/src/search.js
----------------------------------------------------------------------
diff --git a/src/search.js b/src/search.js
index 2b244b3..d70db06 100644
--- a/src/search.js
+++ b/src/search.js
@@ -1,13 +1,18 @@
var registry = require('plugman-registry')
, config = require('../config');
-module.exports = function(search_opts) {
+module.exports = function(search_opts, callback) {
registry.use(config.registry, function(err) {
registry.search(search_opts, function(err, plugins) {
- if(err) return console.log(err);
- for(var plugin in plugins) {
- console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
- }
+ if(callback) {
+ if(err) return callback(err);
+ callback(plugins);
+ } else {
+ if(err) return console.log(err);
+ for(var plugin in plugins) {
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ }
+ }
});
});
}
[20/50] git commit: adding search results
Posted by an...@apache.org.
adding search results
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/7772f2a7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/7772f2a7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/7772f2a7
Branch: refs/heads/master
Commit: 7772f2a786cb5ba9edf191583ad6bf7e1ed174a3
Parents: 97ea291
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jun 19 14:50:33 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:55:45 2013 -0700
----------------------------------------------------------------------
main.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7772f2a7/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index dc524f4..6f26d2a 100755
--- a/main.js
+++ b/main.js
@@ -120,7 +120,7 @@ else if (cli_opts.search) {
});
});
}
-else {
+else if(cli_opts.install) {
var cli_variables = {}
if (cli_opts.variable) {
cli_opts.variable.forEach(function (variable) {
@@ -135,4 +135,6 @@ subdir: '.',
www_dir: cli_opts.www
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
+} else {
+ console.log(plugman.help());
}
[23/50] git commit: adding registry dependency and wiring up commands
Posted by an...@apache.org.
adding registry dependency and wiring up commands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/67ab4d3e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/67ab4d3e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/67ab4d3e
Branch: refs/heads/master
Commit: 67ab4d3e790d032bc58f29a3e70aa97aa4de2b12
Parents: cd0a39e
Author: Anis Kadri <an...@gmail.com>
Authored: Thu Jun 13 18:21:27 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:07:52 2013 -0700
----------------------------------------------------------------------
main.js | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/67ab4d3e/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index b7c5d54..3db0f6a 100755
--- a/main.js
+++ b/main.js
@@ -43,12 +43,9 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'link': Boolean
, 'variable' : Array
, 'www': path
-}, shortHands = { 'var' : 'variable' };
-var short_hands = {
- "v": ["--version"]
- , "h": ["--help"]
-}
-var cli_opts = nopt(known_opts, short_hands);
+}, shortHands = { 'var' : 'variable', 'v': 'version', 'h': 'help' };
+
+var cli_opts = nopt(known_opts, shortHands);
// Default the plugins_dir to './cordova/plugins'.
var plugins_dir;
@@ -83,7 +80,7 @@ else if (cli_opts.help) {
console.log(plugman.help());
}
else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
- console.log(plugman.help());
+ 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 });
@@ -116,5 +113,5 @@ subdir: '.',
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
} else {
- console.log(plugman.help());
+ plugman.help();
}
[39/50] git commit: removing --plugin option
Posted by an...@apache.org.
removing --plugin option
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/365ac3ce
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/365ac3ce
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/365ac3ce
Branch: refs/heads/master
Commit: 365ac3ce7fd84ded738d825f24fc50981719495f
Parents: 241031d
Author: Anis Kadri <an...@apache.org>
Authored: Tue Jul 16 17:52:09 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Tue Jul 16 17:52:09 2013 -0700
----------------------------------------------------------------------
plugman.js | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/365ac3ce/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index b0dbe03..716c5ef 100755
--- a/plugman.js
+++ b/plugman.js
@@ -74,17 +74,19 @@ plugman.commands = {
},
'publish' : function(cli_opts) {
- if(!cli_opts.plugin) {
+ var plugin_path = cli_opts.argv.remain;
+ if(!plugin_path) {
return console.log(plugman.help());
}
- plugman.publish(new Array(cli_opts.plugin));
+ plugman.publish(plugin_path);
},
'unpublish': function(cli_opts) {
- if(!cli_opts.plugin) {
+ var plugin = cli_opts.argv.remain;
+ if(!plugin) {
return console.log(plugman.help());
}
- plugman.unpublish(new Array(cli_opts.plugin));
+ plugman.unpublish(plugin);
}
};
[22/50] git commit: adding actions
Posted by an...@apache.org.
adding actions
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/cd0a39ea
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/cd0a39ea
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/cd0a39ea
Branch: refs/heads/master
Commit: cd0a39eac3938b54f9a757708b3df404feec781d
Parents: 57246a2
Author: Anis Kadri <an...@gmail.com>
Authored: Tue Jun 11 18:07:56 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:03:40 2013 -0700
----------------------------------------------------------------------
main.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/cd0a39ea/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 7121a0e..b7c5d54 100755
--- a/main.js
+++ b/main.js
@@ -24,10 +24,11 @@ var path = require('path')
, package = require(path.join(__dirname, 'package'))
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
+ , registry = require('plugman-registry')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
- , 'project' : path
+ , 'project' : path
, 'plugin' : [String, path, url]
, 'install' : Boolean
, 'uninstall' : Boolean
[46/50] git commit: Merge branch 'master' into plugman-registry
Posted by an...@apache.org.
Merge branch 'master' into plugman-registry
Conflicts:
src/fetch.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/2cbb6825
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/2cbb6825
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/2cbb6825
Branch: refs/heads/master
Commit: 2cbb68250bdb8d84b7e7320614611f8e5175a417
Parents: e778e8a 4cf0243
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jul 24 15:39:35 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Jul 24 15:39:35 2013 -0700
----------------------------------------------------------------------
.gitignore | 2 +
README.md | 4 +
package.json | 4 +-
spec/fetch.spec.js | 5 +
spec/install.spec.js | 18 +-
spec/integration.spec.js | 85 +
spec/platforms/wp7.spec.js | 6 +-
spec/platforms/wp8.spec.js | 6 +-
spec/plugins/Contacts/plugin.xml | 143 ++
.../Contacts/src/android/ContactAccessor.java | 198 ++
.../src/android/ContactAccessorSdk5.java | 2183 ++++++++++++++++++
.../Contacts/src/android/ContactManager.java | 122 +
.../src/blackberry10/ContactActivity.js | 26 +
.../Contacts/src/blackberry10/ContactAddress.js | 30 +
.../Contacts/src/blackberry10/ContactError.js | 30 +
.../Contacts/src/blackberry10/ContactField.js | 27 +
.../src/blackberry10/ContactFindOptions.js | 50 +
.../Contacts/src/blackberry10/ContactName.js | 39 +
.../Contacts/src/blackberry10/ContactNews.js | 26 +
.../src/blackberry10/ContactOrganization.js | 22 +
.../Contacts/src/blackberry10/ContactPhoto.js | 23 +
.../Contacts/src/blackberry10/contactConsts.js | 225 ++
.../Contacts/src/blackberry10/contactUtils.js | 223 ++
spec/plugins/Contacts/src/blackberry10/index.js | 374 +++
.../Contacts/src/blackberry10/plugin.xml | 41 +
spec/plugins/Contacts/src/ios/CDVContact.h | 136 ++
spec/plugins/Contacts/src/ios/CDVContact.m | 1752 ++++++++++++++
spec/plugins/Contacts/src/ios/CDVContacts.h | 151 ++
spec/plugins/Contacts/src/ios/CDVContacts.m | 593 +++++
spec/plugins/Contacts/src/wp/Contacts.cs | 664 ++++++
spec/plugins/Contacts/www/Contact.js | 177 ++
spec/plugins/Contacts/www/ContactAddress.js | 46 +
spec/plugins/Contacts/www/ContactError.js | 42 +
spec/plugins/Contacts/www/ContactField.js | 37 +
spec/plugins/Contacts/www/ContactFindOptions.js | 34 +
spec/plugins/Contacts/www/ContactName.js | 41 +
.../plugins/Contacts/www/ContactOrganization.js | 44 +
spec/plugins/Contacts/www/contacts.js | 76 +
spec/plugins/Contacts/www/ios/Contact.js | 51 +
spec/plugins/Contacts/www/ios/contacts.js | 62 +
spec/plugins/dependencies/B/plugin.xml | 8 +-
spec/plugins/dependencies/E/plugin.xml | 57 -
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-e.js | 0
spec/plugins/dependencies/subdir/E/plugin.xml | 57 +
.../dependencies/subdir/E/src/android/E.java | 0
.../subdir/E/src/ios/EPluginCommand.h | 0
.../subdir/E/src/ios/EPluginCommand.m | 0
.../dependencies/subdir/E/www/plugin-e.js | 0
.../blackberry10/native/device/chrome/.gitkeep | 0
.../native/device/plugins/jnext/auth.txt | 3 +
.../native/simulator/chrome/.gitkeep | 0
.../native/simulator/plugins/jnext/auth.txt | 3 +
spec/projects/wp7/CordovaAppProj.csproj | 176 +-
spec/projects/wp8/An_App.csproj | 201 --
spec/projects/wp8/CordovaAppProj.csproj | 136 ++
spec/util/csproj.spec.js | 13 +-
src/fetch.js | 4 +-
src/install.js | 20 +-
src/platforms/wp7.js | 2 +-
src/platforms/wp8.js | 2 +-
src/prepare.js | 2 +-
src/util/action-stack.js | 4 +-
src/util/csproj.js | 13 +-
src/util/plugins.js | 2 +-
67 files changed, 8122 insertions(+), 399 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2cbb6825/README.md
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2cbb6825/package.json
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/2cbb6825/src/fetch.js
----------------------------------------------------------------------
diff --cc src/fetch.js
index d5e3e8c,e2b3d71..8f76bb5
--- a/src/fetch.js
+++ b/src/fetch.js
@@@ -47,53 -46,34 +47,55 @@@ module.exports = function fetchPlugin(p
// Copy from the local filesystem.
// First, read the plugin.xml and grab the ID.
- plugin_dir = path.join(uri.href, options.subdir);
+ // NOTE: Can't use uri.href here as it will convert spaces to %20 and make path invalid.
+ // Use original plugin_dir value instead.
+ plugin_dir = path.join(plugin_dir, options.subdir);
- var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
- require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...');
- var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);
- var plugin_id = xml.getroot().attrib.id;
- var dest = path.join(plugins_dir, plugin_id);
+ var movePlugin = function(plugin_dir, linkable) {
+ var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
+ require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...');
+ var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);
+ var plugin_id = xml.getroot().attrib.id;
- shell.rm('-rf', dest);
- if (options.link) {
- require('../plugman').emit('log', 'Symlinking from location "' + plugin_dir + '" to location "' + dest + '"');
- fs.symlinkSync(plugin_dir, dest, 'dir');
- } else {
- shell.mkdir('-p', dest);
- require('../plugman').emit('log', 'Copying from location "' + plugin_dir + '" to location "' + dest + '"');
- shell.cp('-R', path.join(plugin_dir, '*'), dest);
- }
+ var dest = path.join(plugins_dir, plugin_id);
- var data = {
- source: {
- type: 'local',
- path: plugin_dir
+ shell.rm('-rf', dest);
+ if (options.link && linkable) {
+ require('../plugman').emit('log', 'Symlinking from location "' + plugin_dir + '" to location "' + dest + '"');
+ fs.symlinkSync(plugin_dir, dest, 'dir');
+ } else {
+ shell.mkdir('-p', dest);
+ require('../plugman').emit('log', 'Copying from location "' + plugin_dir + '" to location "' + dest + '"');
+ shell.cp('-R', path.join(plugin_dir, '*') , dest);
}
+
+ var data = {
+ source: {
+ type: 'local',
+ path: plugin_dir
+ }
+ };
+ metadata.save_fetch_metadata(dest, data);
+
+ if (callback) callback(null, dest);
};
- metadata.save_fetch_metadata(dest, data);
- if (callback) callback(null, dest);
+
+ if(!fs.existsSync(plugin_dir)) {
+ registry.use(require('../plugman').config.registry, function() {
+ registry.fetch([plugin_dir], function(err, plugin_dir) {
+ if (err) {
+ if(callback) {
+ return callback(err);
+ } else {
+ throw err;
+ }
+ }
+ movePlugin(plugin_dir, false);
+ });
+ })
+ } else {
+ movePlugin(plugin_dir, true);
+ }
}
};
[17/50] git commit: adding config
Posted by an...@apache.org.
adding config
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/53bc4ae9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/53bc4ae9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/53bc4ae9
Branch: refs/heads/master
Commit: 53bc4ae9a63d7699860a40a8a7caac841598989e
Parents: db03ca7
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:08:45 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:54:18 2013 -0700
----------------------------------------------------------------------
config.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/53bc4ae9/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
new file mode 100644
index 0000000..7056d93
--- /dev/null
+++ b/config.js
@@ -0,0 +1,3 @@
+module.exports = {
+ registry: "http://localhost:5984/registry/_design/scratch/_rewrite"
+}
[50/50] git commit: adding help
Posted by an...@apache.org.
adding help
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/76119e19
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/76119e19
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/76119e19
Branch: refs/heads/master
Commit: 76119e1905c340f60f70b70fc15bb3e8cc4d7f5a
Parents: 582fdfa
Author: Anis Kadri <an...@apache.org>
Authored: Sat Jul 27 17:52:15 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Sat Jul 27 17:52:15 2013 -0700
----------------------------------------------------------------------
doc/help.txt | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/76119e19/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index ae90cd7..8f93ed5 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -61,3 +61,8 @@ Search for a plugin
$ plugman search plugin,keywords
+Manage registry configuration
+-----------------------------
+
+ $ plugman config registry set http://localhost:5984/registry/_design/app/_rewrite
+ $ plugman config get registry
[16/50] git commit: fixing issue with fetch
Posted by an...@apache.org.
fixing issue with fetch
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/97ea291c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/97ea291c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/97ea291c
Branch: refs/heads/master
Commit: 97ea291c4de24815bc0df798f171b98cd81d5c50
Parents: 53bc4ae
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:15:43 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:54:18 2013 -0700
----------------------------------------------------------------------
src/fetch.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/97ea291c/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 71f8785..c86c76d 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -81,7 +81,7 @@ type: 'local',
if(!fs.existsSync(plugin_dir)) {
registry.use(null, function() {
- registry.fetch(plugin_dir, function(err, plugin_dir) {
+ registry.fetch([plugin_dir], function(err, plugin_dir) {
movePlugin(plugin_dir, false);
});
})
[03/50] git commit: fixing issue with fetch
Posted by an...@apache.org.
fixing issue with fetch
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/5ec29247
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/5ec29247
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/5ec29247
Branch: refs/heads/master
Commit: 5ec29247881cbaecc3ab787dc61260b1ead3d43a
Parents: 671283e
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:15:43 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700
----------------------------------------------------------------------
src/fetch.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/5ec29247/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 0589fb5..c8cd653 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -75,7 +75,7 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
if(!fs.existsSync(plugin_dir)) {
registry.use(null, function() {
- registry.fetch(plugin_dir, function(err, plugin_dir) {
+ registry.fetch([plugin_dir], function(err, plugin_dir) {
movePlugin(plugin_dir, false);
});
})
[44/50] git commit: testing config.js
Posted by an...@apache.org.
testing config.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/7114350b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/7114350b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/7114350b
Branch: refs/heads/master
Commit: 7114350bd99b1c0c45c5d7b426dcb302df998fff
Parents: d8d3a6d
Author: Anis Kadri <an...@apache.org>
Authored: Fri Jul 19 14:32:26 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Fri Jul 19 14:32:26 2013 -0700
----------------------------------------------------------------------
config.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/7114350b/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
index 29ea6be..0c305b4 100644
--- a/config.js
+++ b/config.js
@@ -1,3 +1,4 @@
module.exports = {
- registry: "http://registry.cordova.io"
+ registry: "http://registry.cordova.io"
+// registry: "http://localhost:5984/registry/_design/app/_rewrite"
}
[09/50] git commit: adding argument check
Posted by an...@apache.org.
adding argument check
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/dc27fcdd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/dc27fcdd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/dc27fcdd
Branch: refs/heads/master
Commit: dc27fcdd0ec4fa83a56c04a1e5022e3c8412fd44
Parents: dc8caca
Author: Anis Kadri <an...@apache.org>
Authored: Fri Jun 21 14:17:43 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:13:29 2013 -0700
----------------------------------------------------------------------
main.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dc27fcdd/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index b695953..99f53f8 100755
--- a/main.js
+++ b/main.js
@@ -90,7 +90,7 @@ else if (cli_opts.adduser) {
});
});
}
-else if (cli_opts.publish) {
+else if (cli_opts.publish && cli_opts.plugin) {
registry.use(config.registry, function(err) {
registry.publish([cli_opts.plugin], function(err, d) {
if(err) return console.log('Error publishing plugin', err);
@@ -98,9 +98,9 @@ else if (cli_opts.publish) {
});
});
}
-else if (cli_opts.unpublish) {
+else if (cli_opts.unpublish && cli_opts.plugin) {
registry.use(config.registry, function(err) {
- registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
+ registry.unpublish([cli_opts.plugin], function(err, d) {
if(err) return console.log('Error unpublishing plugin');
console.log('plugin unpublished');
});
[37/50] git commit: Merge branch 'master' into plugman-registry
Posted by an...@apache.org.
Merge branch 'master' into plugman-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/8dd5a1b7
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/8dd5a1b7
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/8dd5a1b7
Branch: refs/heads/master
Commit: 8dd5a1b7c14774b939928f03f4875e24f7f26718
Parents: 8c0dbf7 9c0d637
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jul 15 17:33:30 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Jul 15 17:33:30 2013 -0700
----------------------------------------------------------------------
spec/util/csproj.spec.js | 9 +++++++++
src/util/csproj.js | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
[05/50] git commit: adding config
Posted by an...@apache.org.
adding config
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/671283ec
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/671283ec
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/671283ec
Branch: refs/heads/master
Commit: 671283ec0754e309316352d7885b6cfddc9527b8
Parents: b0fe1f4
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:08:45 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700
----------------------------------------------------------------------
config.js | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/671283ec/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
new file mode 100644
index 0000000..7056d93
--- /dev/null
+++ b/config.js
@@ -0,0 +1,3 @@
+module.exports = {
+ registry: "http://localhost:5984/registry/_design/scratch/_rewrite"
+}
[48/50] git commit: adding registry code in plugman and removing
dependencies. Updated configuration handling
Posted by an...@apache.org.
adding registry code in plugman and removing dependencies. Updated configuration handling
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/fd679f38
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/fd679f38
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/fd679f38
Branch: refs/heads/master
Commit: fd679f38013c3171cddebed8173409b4546f0c95
Parents: 453553d
Author: Anis Kadri <an...@apache.org>
Authored: Sat Jul 27 14:17:27 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Sat Jul 27 14:17:27 2013 -0700
----------------------------------------------------------------------
package.json | 5 +-
spec/adduser.spec.js | 9 +-
spec/config.js | 10 ++
spec/fetch.spec.js | 2 +
spec/publish.spec.js | 5 +-
spec/registry/registry.js | 20 ++++
spec/search.spec.js | 5 +-
spec/unpublish.spec.js | 5 +-
src/adduser.js | 23 ++---
src/config.js | 15 +++
src/fetch.js | 4 +-
src/publish.js | 25 +++--
src/registry/manifest.js | 69 +++++++++++++
src/registry/registry.js | 218 +++++++++++++++++++++++++++++++++++++++++
src/search.js | 13 +--
src/unpublish.js | 23 ++---
16 files changed, 381 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 16d9285..6a2af97 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,10 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "2.0.x",
- "plugman-registry": "0.0.6"
+ "npm": "1.3.4",
+ "rc": "0.3.0",
+ "xmldom": "0.1.16",
+ "tar.gz": "0.1.1"
},
"devDependencies": {
"jasmine-node": "1.7.0"
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/adduser.spec.js
----------------------------------------------------------------------
diff --git a/spec/adduser.spec.js b/spec/adduser.spec.js
index 563592d..732ee71 100644
--- a/spec/adduser.spec.js
+++ b/spec/adduser.spec.js
@@ -1,13 +1,10 @@
var adduser = require('../src/adduser'),
- config = require('../config'),
- registry = require('plugman-registry');
+ registry = require('../src/registry/registry');
describe('adduser', function() {
it('should add a user', function() {
- var sUse = spyOn(registry, 'use').andCallThrough();
var sAddUser = spyOn(registry, 'adduser');
- adduser();
- expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
- expect(sAddUser).toHaveBeenCalled();
+ adduser(function(err, result) { });
+ expect(sAddUser).toHaveBeenCalledWith(null, jasmine.any(Function));
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/config.js
----------------------------------------------------------------------
diff --git a/spec/config.js b/spec/config.js
new file mode 100644
index 0000000..5f4f781
--- /dev/null
+++ b/spec/config.js
@@ -0,0 +1,10 @@
+var config = require('../src/config'),
+ registry = require('../src/registry/registry');
+
+describe('config', function() {
+ it('should run config', function() {
+ var sConfig = spyOn(registry, 'config');
+ config(function(err, result) { });
+ expect(sConfig).toHaveBeenCalledWith(jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/fetch.spec.js
----------------------------------------------------------------------
diff --git a/spec/fetch.spec.js b/spec/fetch.spec.js
index 4151020..3213ad4 100644
--- a/spec/fetch.spec.js
+++ b/spec/fetch.spec.js
@@ -28,6 +28,8 @@ describe('fetch', function() {
expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin, '*'), path.join(temp, 'id'));
});
it('should copy locally-available plugin to plugins directory when spaces in path', function() {
+ //XXX: added this because plugman tries to fetch from registry when plugin folder does not exist
+ spyOn(fs,'existsSync').andReturn(true);
fetch(test_plugin_with_space, temp);
expect(cp).toHaveBeenCalledWith('-R', path.join(test_plugin_with_space, '*'), path.join(temp, 'id'));
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/publish.spec.js
----------------------------------------------------------------------
diff --git a/spec/publish.spec.js b/spec/publish.spec.js
index 3a253e7..59f863e 100644
--- a/spec/publish.spec.js
+++ b/spec/publish.spec.js
@@ -1,13 +1,10 @@
var publish = require('../src/publish'),
- config = require('../config'),
- registry = require('plugman-registry');
+ registry = require('../src/registry/registry');
describe('publish', function() {
it('should publish a plugin', function() {
- var sUse = spyOn(registry, 'use').andCallThrough();
var sPublish = spyOn(registry, 'publish');
publish(new Array('/path/to/myplugin'));
- expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
expect(sPublish).toHaveBeenCalledWith(['/path/to/myplugin'], jasmine.any(Function));
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/registry/registry.js
----------------------------------------------------------------------
diff --git a/spec/registry/registry.js b/spec/registry/registry.js
new file mode 100644
index 0000000..d4baf59
--- /dev/null
+++ b/spec/registry/registry.js
@@ -0,0 +1,20 @@
+var registry = require('../../src/registry/registry'),
+ npm = require('npm');
+
+describe('registry', function() {
+ beforeEach(function() {
+ registry.settings = {
+ cache: plugmanCacheDir,
+ force: true,
+ logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+ userconfig: path.resolve(plugmanConfigDir, 'config')
+ };
+ });
+ it('should run config', function() {
+ var sLoad = spyOn(npm, 'load').andCallThrough();
+ var sConfig = spyOn(npm, 'config');
+ registry.config(new Array('/path/to/myplugin'));
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sPublish).toHaveBeenCalledWith(['/path/to/myplugin'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/search.spec.js
----------------------------------------------------------------------
diff --git a/spec/search.spec.js b/spec/search.spec.js
index f708854..2393c70 100644
--- a/spec/search.spec.js
+++ b/spec/search.spec.js
@@ -1,13 +1,10 @@
var search = require('../src/search'),
- config = require('../config'),
- registry = require('plugman-registry');
+ registry = require('../src/registry/registry');
describe('search', function() {
it('should search a plugin', function() {
- var sUse = spyOn(registry, 'use').andCallThrough();
var sSearch = spyOn(registry, 'search');
search(new Array('myplugin', 'keyword'));
- expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
expect(sSearch).toHaveBeenCalledWith(['myplugin', 'keyword'], jasmine.any(Function));
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/spec/unpublish.spec.js
----------------------------------------------------------------------
diff --git a/spec/unpublish.spec.js b/spec/unpublish.spec.js
index 207804d..f454a27 100644
--- a/spec/unpublish.spec.js
+++ b/spec/unpublish.spec.js
@@ -1,13 +1,10 @@
var unpublish = require('../src/unpublish'),
- config = require('../config'),
- registry = require('plugman-registry');
+ registry = require('../src/registry/registry');
describe('unpublish', function() {
it('should unpublish a plugin', function() {
- var sUse = spyOn(registry, 'use').andCallThrough();
var sUnpublish = spyOn(registry, 'unpublish');
unpublish(new Array('myplugin@0.0.1'));
- expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
expect(sUnpublish).toHaveBeenCalledWith(['myplugin@0.0.1'], jasmine.any(Function));
});
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/adduser.js
----------------------------------------------------------------------
diff --git a/src/adduser.js b/src/adduser.js
index 8ca9c9a..3ff5023 100644
--- a/src/adduser.js
+++ b/src/adduser.js
@@ -1,18 +1,15 @@
-var registry = require('plugman-registry')
- , config = require('../config');
+var registry = require('./registry/registry')
module.exports = function(callback) {
- registry.use(config.registry, function(err) {
registry.adduser(null, function(err) {
- if(callback && typeof callback === 'function') {
- err ? callback(err) : callback(null);
- } else {
- if(err) {
- throw err;
- } else {
- console.log('user added');
- }
- }
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('user added');
+ }
+ }
});
- });
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/config.js
----------------------------------------------------------------------
diff --git a/src/config.js b/src/config.js
new file mode 100644
index 0000000..f863717
--- /dev/null
+++ b/src/config.js
@@ -0,0 +1,15 @@
+var registry = require('./registry/registry')
+
+module.exports = function(params, callback) {
+ registry.config(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/fd679f38/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 8f76bb5..59b95cf 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -5,7 +5,7 @@ var shell = require('shelljs'),
xml_helpers = require('./util/xml-helpers'),
metadata = require('./util/metadata'),
path = require('path'),
- registry = require('plugman-registry');
+ registry = require('./registry/registry');
// XXX: leave the require('../plugman') because jasmine shits itself if you declare it up top
// possible options: link, subdir, git_ref
module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback) {
@@ -82,7 +82,6 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
if(!fs.existsSync(plugin_dir)) {
- registry.use(require('../plugman').config.registry, function() {
registry.fetch([plugin_dir], function(err, plugin_dir) {
if (err) {
if(callback) {
@@ -93,7 +92,6 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
}
movePlugin(plugin_dir, false);
});
- })
} else {
movePlugin(plugin_dir, true);
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/publish.js
----------------------------------------------------------------------
diff --git a/src/publish.js b/src/publish.js
index 06412cc..b5f6832 100644
--- a/src/publish.js
+++ b/src/publish.js
@@ -1,19 +1,16 @@
-var registry = require('plugman-registry')
- , config = require('../config');
+var registry = require('./registry/registry')
module.exports = function(plugin_path, callback) {
- registry.use(config.registry, function(err) {
- // plugin_path is an array of paths
+ // plugin_path is an array of paths
registry.publish(plugin_path, function(err, d) {
- if(callback && typeof callback === 'function') {
- err ? callback(err) : callback(null);
- } else {
- if(err) {
- throw err;
- } else {
- console.log('Plugin published');
- }
- }
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('Plugin published');
+ }
+ }
});
- });
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/registry/manifest.js
----------------------------------------------------------------------
diff --git a/src/registry/manifest.js b/src/registry/manifest.js
new file mode 100644
index 0000000..59f7bb6
--- /dev/null
+++ b/src/registry/manifest.js
@@ -0,0 +1,69 @@
+var DOMParser = require('xmldom').DOMParser,
+ path = require('path'),
+ fs = require('fs');
+
+// Java world big-up!
+// TODO use CALLBACK
+function generatePackageJsonFromPluginXml(plugin_path, cb) {
+ var package_json = {};
+ var plugin_xml = fs.readFileSync(path.resolve(plugin_path, 'plugin.xml'), "utf8");
+ var doc = new DOMParser().parseFromString(plugin_xml);
+
+ if(!doc || !doc.documentElement) {
+ throw new Error('invalid plugin.xml document');
+ }
+
+ // name, version REQUIRED
+ // setting version
+ var version = doc.documentElement.getAttribute('version')
+ if(!version) {
+ var e = new Error('`version` required');
+ if(cb) {
+ cb(e);
+ return null;
+ }
+ throw e;
+ }
+ package_json.version = version;
+
+ // setting name
+ if(doc.documentElement.getElementsByTagName('name').length != 1 ||
+ !doc.documentElement.getElementsByTagName('name').item(0).firstChild) {
+ var e = new Error('`name` is required');
+ if(cb) {
+ cb(e);
+ return null;
+ }
+ throw e;
+ }
+ var name = doc.documentElement.getElementsByTagName('name').item(0).firstChild.nodeValue;
+ if(!name.match(/^\w+|-*$/)) throw new Error('`name` can only contain alphanumberic characters and -')
+ package_json.name = name.toLowerCase();
+
+ // OPTIONAL fields: description, license, keywords. TODO: add more!
+ if(doc.documentElement.getElementsByTagName('description').length == 1 &&
+ doc.documentElement.getElementsByTagName('description').item(0).firstChild) {
+ package_json.description = doc.documentElement
+ .getElementsByTagName('description')
+ .item(0).firstChild.nodeValue;
+ }
+ if(doc.documentElement.getElementsByTagName('license').length == 1 &&
+ doc.documentElement.getElementsByTagName('license').item(0).firstChild) {
+ package_json.license = doc.documentElement
+ .getElementsByTagName('license')
+ .item(0).firstChild.nodeValue;
+ }
+ if(doc.documentElement.getElementsByTagName('keywords').length == 1 &&
+ doc.documentElement.getElementsByTagName('keywords').item(0).firstChild) {
+ package_json.keywords = doc.documentElement
+ .getElementsByTagName('keywords')
+ .item(0).firstChild.nodeValue.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;
+}
+
+module.exports.generatePackageJsonFromPluginXml = generatePackageJsonFromPluginXml;
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
new file mode 100644
index 0000000..bf99a15
--- /dev/null
+++ b/src/registry/registry.js
@@ -0,0 +1,218 @@
+var npm = require('npm'),
+ path = require('path'),
+ http = require('http'),
+ targz = require('tar.gz'),
+ fs = require('fs'),
+ manifest = require('./manifest'),
+ os = require('os'),
+ rc = require('rc'),
+ plugmanConfigDir = path.resolve(process.env.HOME, '.plugman'),
+ plugmanCacheDir = path.resolve(plugmanConfigDir, 'cache');
+
+var settings = module.exports.settings;
+
+function checkConfig(cb) {
+ if(settings != null) {
+ cb();
+ } else {
+ use(cb);
+ }
+}
+
+function handleError(err, cb) {
+ if(typeof cb == 'function') {
+ return cb(err);
+ }
+ throw err;
+}
+/**
+ * @method use
+ * @param {String} registry NPM registry URL
+ * @param {Function} cb callback
+ */
+function use(cb) {
+ if(typeof cb != 'function') throw new Error('Please provide a callback');
+ // check if settings already set
+ if(settings != null) return cb();
+
+ // setting up settings
+ // obviously if settings dir does not exist settings is going to be empty
+ if(!fs.existsSync(plugmanConfigDir)) {
+ fs.mkdirSync(plugmanConfigDir);
+ fs.mkdirSync(plugmanCacheDir);
+ }
+
+ settings = rc('plugman', {
+ cache: plugmanCacheDir,
+ force: true,
+ logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+ userconfig: path.resolve(plugmanConfigDir, 'config')
+ });
+
+ if(settings.registry) {
+ cb();
+ } else {
+ // setting registry
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.config(['set', 'registry', 'http://registry.cordova.io'], cb);
+ });
+ }
+
+}
+
+/**
+ * @method getPackageInfo
+ * @param {String} args Package names
+ * @param {Function} cb callback
+ */
+function getPackageInfo(args, cb) {
+ var thing = args.length ? args.shift().split("@") : [],
+ name = thing.shift(),
+ version = thing.join("@"),
+
+ version = version ? version : 'latest';
+
+ http.get(settings.registry + '/' + name + '/' + version, function(res) {
+ if(res.statusCode != 200) {
+ var err = new Error('Error');
+ if (cb) cb(err);
+ else throw err;
+ } else {
+ var info = '';
+ res.on('data', function(chunk) {
+ info += chunk;
+ });
+ res.on('end', function() {
+ cb(null, JSON.parse(info));
+ });
+ }
+ }).on('error', function(err) {
+ cb(err);
+ });
+}
+
+/**
+ * @method fetchPackage
+ * @param {String} info Package info
+ * @param {Function} cb callback
+ */
+function fetchPackage(info, cb) {
+ var cached = path.resolve(settings.cache, info.name, info.version, 'package');
+ if(fs.existsSync(cached)) {
+ cb(null, cached);
+ } else {
+ var target = os.tmpdir() + info.name;
+ var filename = target + '.tgz';
+ var filestream = fs.createWriteStream(filename);
+ var request = http.get(info.dist.tarball, function(res) {
+ if(res.statusCode != 200) {
+ var err = new Error('failed to fetch the plugin archive');
+ if (cb) cb(err);
+ else throw err;
+ } else {
+ res.pipe(filestream);
+ filestream.on('finish', function() {
+ var decompress = new targz().extract(filename, target, function(err) {
+ cb(err, path.resolve(target, 'package'));
+ });
+ });
+ }
+ });
+ }
+}
+
+module.exports = {
+ settings: null,
+ /**
+ * @method config
+ * @param {Array} args Command argument
+ * @param {Function} cb Command callback
+ */
+ config: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb)
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.config(args, cb);
+ });
+ });
+ },
+ /**
+ * @method adduser
+ * @param {Array} args Command argument
+ * @param {Function} cb Command callback
+ */
+ adduser: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb)
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.adduser(args, cb);
+ });
+ });
+ },
+ /**
+ * @method publish
+ * @param {Array} args Command argument
+ * @param {Function} cb Command callback
+ */
+ publish: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb);
+ manifest.generatePackageJsonFromPluginXml(args[0]);
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.publish(args, function(err, data) {
+ fs.unlink(path.resolve(args[0], 'package.json'));
+ cb(err, data);
+ });
+ });
+ });
+ },
+ /**
+ * @method search
+ * @param {Array} args Array of keywords
+ * @param {Function} cb Command callback
+ */
+ search: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb);
+ npm.load(settings, function(er) {
+ if (er) return handlError(er, cb);
+ npm.commands.search(args, true, cb);
+ });
+ });
+ },
+ /**
+ * @method unpublish
+ * @param {Array} args Command argument
+ * @param {Function} cb Command callback
+ */
+ unpublish: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb);
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.unpublish(args, function(err, d) {
+ if(err) return handleError(err, cb);
+ npm.commands.cache(["clean"], cb);
+ });
+ });
+ });
+ },
+ /**
+ * @method fetch
+ * @param {String} name Plugin name
+ * @param {Function} cb Command callback
+ */
+ fetch: function(args, cb) {
+ checkConfig(function(err) {
+ if(err) return handleError(err, cb)
+ getPackageInfo(args, function(err, info) {
+ if(err) return handleError(err, cb)
+ fetchPackage(info, cb);
+ });
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/search.js
----------------------------------------------------------------------
diff --git a/src/search.js b/src/search.js
index 31b1094..4d679c4 100644
--- a/src/search.js
+++ b/src/search.js
@@ -1,18 +1,15 @@
-var registry = require('plugman-registry')
- , config = require('../config');
+var registry = require('./registry/registry')
module.exports = function(search_opts, callback) {
- registry.use(config.registry, function(err) {
registry.search(search_opts, function(err, plugins) {
if(callback) {
if(err) return callback(err);
callback(null, plugins);
} else {
- if(err) return console.log(err);
- for(var plugin in plugins) {
- console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
- }
+ if(err) return console.log(err);
+ for(var plugin in plugins) {
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ }
}
});
- });
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/fd679f38/src/unpublish.js
----------------------------------------------------------------------
diff --git a/src/unpublish.js b/src/unpublish.js
index 22db926..5a428f1 100644
--- a/src/unpublish.js
+++ b/src/unpublish.js
@@ -1,18 +1,15 @@
-var registry = require('plugman-registry')
- , config = require('../config');
+var registry = require('./registry/registry')
module.exports = function(plugin, callback) {
- registry.use(config.registry, function(err) {
registry.unpublish(plugin, function(err, d) {
- if(callback && typeof callback === 'function') {
- err ? callback(err) : callback(null);
- } else {
- if(err) {
- throw err;
- } else {
- console.log('Plugin unpublished');
- }
- }
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('Plugin unpublished');
+ }
+ }
});
- });
}
[32/50] git commit: fixed wrong URL
Posted by an...@apache.org.
fixed wrong URL
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/f5aa4060
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/f5aa4060
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/f5aa4060
Branch: refs/heads/master
Commit: f5aa40607f49039219c4d7ef6c87a4bced97c1e0
Parents: 1dbf5ae
Author: Anis Kadri <an...@apache.org>
Authored: Sun Jul 14 16:19:15 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Sun Jul 14 16:19:15 2013 -0700
----------------------------------------------------------------------
config.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/f5aa4060/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
index 244bf55..29ea6be 100644
--- a/config.js
+++ b/config.js
@@ -1,3 +1,3 @@
module.exports = {
- registry: "http://plugins.cordova.io"
+ registry: "http://registry.cordova.io"
}
[19/50] git commit: updating cli options and adding short hands
Posted by an...@apache.org.
updating cli options and adding short hands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/4d4a4743
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/4d4a4743
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/4d4a4743
Branch: refs/heads/master
Commit: 4d4a4743564a68ab583d0c451e603d128054d03c
Parents: ca2bec1
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:57:52 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:54:18 2013 -0700
----------------------------------------------------------------------
main.js | 125 +++++++++++++++++++++++++++++++----------------------------
1 file changed, 66 insertions(+), 59 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/4d4a4743/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 94d0f2a..dc524f4 100755
--- a/main.js
+++ b/main.js
@@ -16,36 +16,40 @@
* specific language governing permissions and limitations
* under the License.
*
-*/
+ */
// copyright (c) 2013 Andrew Lunny, Adobe Systems
var path = require('path')
- , url = require('url')
- , package = require(path.join(__dirname, 'package'))
- , nopt = require('nopt')
- , plugins = require('./src/util/plugins')
- , registry = require('plugman-registry')
- , config = require('./config')
- , plugman = require('./plugman');
+, url = require('url')
+, package = require(path.join(__dirname, 'package'))
+, nopt = require('nopt')
+, plugins = require('./src/util/plugins')
+, registry = require('plugman-registry')
+, config = require('./config')
+, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
- , 'project' : path
- , 'plugin' : [String, path, url]
- , 'install' : Boolean
- , 'uninstall' : Boolean
- , 'adduser' : Boolean
- , 'publish' : Boolean
- , 'unpublish' : Boolean
- , 'search' : String
- , 'v' : Boolean
- , 'debug' : Boolean
- , 'plugins': path
- , 'link': Boolean
- , 'variable' : Array
- , 'www': path
- }, shortHands = { 'var' : 'variable' };
-
-var cli_opts = nopt(known_opts);
+ , 'project' : path
+ , 'plugin' : [String, path, url]
+ , 'install' : Boolean
+ , 'uninstall' : Boolean
+ , 'adduser' : Boolean
+ , 'publish' : Boolean
+ , 'unpublish' : Boolean
+ , 'search' : String
+ , 'version' : Boolean
+ , 'help' : Boolean
+ , 'debug' : Boolean
+ , 'plugins': path
+ , 'link': Boolean
+ , 'variable' : Array
+ , 'www': path
+}, shortHands = { 'var' : 'variable' };
+var short_hands = {
+ "v": ["--version"]
+ , "h": ["--help"]
+}
+var cli_opts = nopt(known_opts, short_hands);
// Default the plugins_dir to './cordova/plugins'.
var plugins_dir;
@@ -58,13 +62,13 @@ if (cli_opts.plugins_dir || cli_opts.project) {
}
process.on('uncaughtException', function(error){
- if (cli_opts.debug) {
+ if (cli_opts.debug) {
console.error(error.stack);
- } else {
+ } else {
console.error(error.message);
- }
- process.exit(1);
-});
+ }
+ process.exit(1);
+ });
// Set up appropriate logging based on events
if (cli_opts.debug) {
@@ -73,8 +77,11 @@ if (cli_opts.debug) {
plugman.on('warn', console.warn);
plugman.on('error', console.error);
-if (cli_opts.v) {
+if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
+}
+else if (cli_opts.help) {
+ console.log(plugman.help());
}
else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
console.log(plugman.help());
@@ -83,47 +90,47 @@ else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
else if (cli_opts.adduser) {
- registry.use(config.registry, function(err) {
- registry.adduser(null, function(err) {
- if(err) return console.log(err);
- console.log('user added');
- });
- });
+ registry.use(config.registry, function(err) {
+ registry.adduser(null, function(err) {
+ if(err) return console.log(err);
+ console.log('user added');
+ });
+ });
}
else if (cli_opts.publish) {
- registry.use(config.registry, function(err) {
- registry.publish([cli_opts.plugin], function(err, d) {
- if(err) return console.log('Error publishing plugin');
- console.log('plugin published');
- });
- });
+ registry.use(config.registry, function(err) {
+ registry.publish([cli_opts.plugin], function(err, d) {
+ if(err) return console.log('Error publishing plugin');
+ console.log('plugin published');
+ });
+ });
}
else if (cli_opts.unpublish) {
- registry.use(config.registry, function(err) {
- registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
- if(err) return console.log('Error unpublishing plugin');
- console.log('plugin unpublished');
- });
- });
+ registry.use(config.registry, function(err) {
+ registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
+ if(err) return console.log('Error unpublishing plugin');
+ console.log('plugin unpublished');
+ });
+ });
}
else if (cli_opts.search) {
- registry.use(config.registry, function(err) {
- registry.search(cli_opts.search.split(','), function(err, d) {
- if(err) return console.log(err);
- });
- });
+ registry.use(config.registry, function(err) {
+ registry.search(cli_opts.search.split(','), function(err, d) {
+ if(err) return console.log(err);
+ });
+ });
}
else {
var cli_variables = {}
if (cli_opts.variable) {
cli_opts.variable.forEach(function (variable) {
- var tokens = variable.split('=');
- var key = tokens.shift().toUpperCase();
- if (/^[\w-_]+$/.test(key)) cli_variables[key] = tokens.join('=');
- });
+ var tokens = variable.split('=');
+ var key = tokens.shift().toUpperCase();
+ if (/^[\w-_]+$/.test(key)) cli_variables[key] = tokens.join('=');
+ });
}
var opts = {
- subdir: '.',
+subdir: '.',
cli_variables: cli_variables,
www_dir: cli_opts.www
};
[38/50] git commit: updated cli interface
Posted by an...@apache.org.
updated cli interface
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/241031d2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/241031d2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/241031d2
Branch: refs/heads/master
Commit: 241031d26b6d15c520c568bbbcbce97665100248
Parents: 8dd5a1b
Author: Anis Kadri <an...@apache.org>
Authored: Tue Jul 16 17:18:56 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Tue Jul 16 17:18:56 2013 -0700
----------------------------------------------------------------------
doc/help.txt | 20 ++++++++------
main.js | 64 +++++++++----------------------------------
plugman.js | 81 ++++++++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 91 insertions(+), 74 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/241031d2/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index e59d4fa..ae90cd7 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -1,4 +1,4 @@
-plugman installs and uninstalls plugin.xml-compatible cordova plugins into cordova-generated projects.
+plugman manages plugin.xml-compatible cordova plugins into cordova-generated projects.
Usage
=====
@@ -6,7 +6,7 @@ Usage
Install a plugin
----------------
- $ plugman --platform <platform> --project <directory> --plugin <plugin> [--variable NAME=VALUE]
+ $ plugman install --platform <platform> --project <directory> --plugin <plugin> [--variable NAME=VALUE]
Parameters:
@@ -18,7 +18,7 @@ Parameters:
Uninstall a plugin
------------------
- $ plugman --uninstall --platform <platform> --project <directory> --plugin <plugin-id>
+ $ 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)
@@ -32,7 +32,11 @@ Optional parameters
Optional flags
--------------
- --debug : Verbose mode
+ --debug|-d : Verbose mode
+
+ --help|-h : Displays this message
+
+ --version|-v : Displays version
Interacting with the registry
=============================
@@ -40,20 +44,20 @@ Interacting with the registry
Add a user account
------------------
- $ plugman --adduser
+ $ plugman adduser
Publish a plugin
----------------
- $ plugman --publish --plugin <directory>
+ $ plugman publish --plugin <directory>
Unpublish a plugin
------------------
- $ plugman --unpublish <name>@<version>
+ $ plugman unpublish <name>@<version>
Search for a plugin
-------------------
- $ plugman --search plugin,keywords
+ $ plugman search plugin,keywords
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/241031d2/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 003ddbc..470db89 100755
--- a/main.js
+++ b/main.js
@@ -29,12 +29,6 @@ var path = require('path')
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
, 'project' : path
, 'plugin' : [String, path, url]
- , 'install' : Boolean
- , 'uninstall' : Boolean
- , 'adduser' : Boolean
- , 'publish' : Boolean
- , 'unpublish' : Boolean
- , 'search' : String
, 'version' : Boolean
, 'help' : Boolean
, 'debug' : Boolean
@@ -46,71 +40,39 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
var cli_opts = nopt(known_opts, shortHands);
-// Default the plugins_dir to './cordova/plugins'.
-var plugins_dir;
+var cmd = cli_opts.argv.remain.shift();
// Without these arguments, the commands will fail and print the usage anyway.
if (cli_opts.plugins_dir || cli_opts.project) {
- plugins_dir = typeof cli_opts.plugins_dir == 'string' ?
+ cli_opts.plugins_dir = typeof cli_opts.plugins_dir == 'string' ?
cli_opts.plugins_dir :
path.join(cli_opts.project, 'cordova', 'plugins');
}
-process.on('uncaughtException', function(error){
- if (cli_opts.debug) {
+process.on('uncaughtException', function(error) {
+ if (cli_opts.debug) {
console.error(error.stack);
- } else {
+ } else {
console.error(error.message);
- }
- process.exit(1);
- });
+ }
+ process.exit(1);
+});
// Set up appropriate logging based on events
if (cli_opts.debug) {
plugman.on('log', console.log);
}
+
plugman.on('warn', console.warn);
plugman.on('error', console.error);
plugman.on('results', console.log);
+
if (cli_opts.version) {
console.log(package.name + ' version ' + package.version);
-}
-else if (cli_opts.help) {
+} else if (cli_opts.help) {
console.log(plugman.help());
-}
-else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
- console.log(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 });
-}
-else if (cli_opts.adduser) {
- plugman.adduser();
-}
-else if (cli_opts.publish && cli_opts.plugin) {
- plugman.publish(new Array(cli_opts.plugin));
-}
-else if (cli_opts.unpublish && cli_opts.plugin) {
- plugman.unpublish(new Array(cli_opts.plugin));
-}
-else if (cli_opts.search) {
- plugman.search(cli_opts.search.split(','));
-}
-else if(cli_opts.install) {
- var cli_variables = {}
- if (cli_opts.variable) {
- cli_opts.variable.forEach(function (variable) {
- var tokens = variable.split('=');
- var key = tokens.shift().toUpperCase();
- if (/^[\w-_]+$/.test(key)) cli_variables[key] = tokens.join('=');
- });
- }
- var opts = {
-subdir: '.',
- cli_variables: cli_variables,
- www_dir: cli_opts.www
- };
- plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
+} else if (plugman.commands[cmd]) {
+ plugman.commands[cmd](cli_opts);
} else {
console.log(plugman.help());
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/241031d2/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 541946a..b0dbe03 100755
--- a/plugman.js
+++ b/plugman.js
@@ -21,20 +21,71 @@
var emitter = require('./src/events');
-module.exports = {
- help: require('./src/help'),
- install: require('./src/install'),
- uninstall: require('./src/uninstall'),
- fetch: require('./src/fetch'),
- prepare: require('./src/prepare'),
- config: require('./config'),
- adduser: require('./src/adduser'),
- publish: require('./src/publish'),
- unpublish:require('./src/unpublish'),
- search: require('./src/search'),
- config_changes: require('./src/util/config-changes'),
- on: emitter.addListener,
- off: emitter.removeListener,
+plugman = {
+ help: require('./src/help'),
+ install: require('./src/install'),
+ uninstall: require('./src/uninstall'),
+ fetch: require('./src/fetch'),
+ prepare: require('./src/prepare'),
+ config: require('./config'),
+ adduser: require('./src/adduser'),
+ publish: require('./src/publish'),
+ unpublish: require('./src/unpublish'),
+ search: require('./src/search'),
+ config_changes: require('./src/util/config-changes'),
+ on: emitter.addListener,
+ off: emitter.removeListener,
removeAllListeners: emitter.removeAllListeners,
- emit: emitter.emit
+ emit: emitter.emit
};
+
+plugman.commands = {
+ 'install' : function(cli_opts) {
+ if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+ return console.log(plugman.help());
+ }
+ var cli_variables = {}
+ if (cli_opts.variable) {
+ cli_opts.variable.forEach(function (variable) {
+ var tokens = variable.split('=');
+ var key = tokens.shift().toUpperCase();
+ if (/^[\w-_]+$/.test(key)) cli_variables[key] = tokens.join('=');
+ });
+ }
+ var opts = {
+ subdir: '.',
+ cli_variables: cli_variables,
+ www_dir: cli_opts.www
+ };
+ plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, cli_opts.plugins_dir, opts);
+ },
+ 'uninstall': function(cli_opts) {
+ if(!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+ return console.log(plugman.help());
+ }
+ plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, cli_opts.plugins_dir, { www_dir: cli_opts.www });
+ },
+ 'adduser' : function(cli_opts) {
+ plugman.adduser();
+ },
+
+ 'search' : function(cli_opts) {
+ plugman.search(cli_opts.argv.remain);
+ },
+
+ 'publish' : function(cli_opts) {
+ if(!cli_opts.plugin) {
+ return console.log(plugman.help());
+ }
+ plugman.publish(new Array(cli_opts.plugin));
+ },
+
+ 'unpublish': function(cli_opts) {
+ if(!cli_opts.plugin) {
+ return console.log(plugman.help());
+ }
+ plugman.unpublish(new Array(cli_opts.plugin));
+ }
+};
+
+module.exports = plugman;
[15/50] git commit: adding fetch and fixing cli interface
Posted by an...@apache.org.
adding fetch and fixing cli interface
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/ca2bec10
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/ca2bec10
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/ca2bec10
Branch: refs/heads/master
Commit: ca2bec1081a17bbb518857547ab387e7a0ec7f51
Parents: ccee1ac
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:30:31 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:52:18 2013 -0700
----------------------------------------------------------------------
main.js | 12 ++++++------
package.json | 2 +-
src/fetch.js | 57 +++++++++++++++++++++++++++++++++++--------------------
3 files changed, 43 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ca2bec10/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index fa08057..94d0f2a 100755
--- a/main.js
+++ b/main.js
@@ -25,6 +25,7 @@ var path = require('path')
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
, registry = require('plugman-registry')
+ , config = require('./config')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
@@ -75,15 +76,14 @@ plugman.on('error', console.error);
if (cli_opts.v) {
console.log(package.name + ' version ' + package.version);
}
-else if ((cli_opts.install || cli_opts.uninstall) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
+else if ((cli_opts.install || cli_opts.uninstall || cli_opts.argv.original.length == 0) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
console.log(plugman.help());
- printUsage();
}
else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
else if (cli_opts.adduser) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.adduser(null, function(err) {
if(err) return console.log(err);
console.log('user added');
@@ -91,7 +91,7 @@ else if (cli_opts.adduser) {
});
}
else if (cli_opts.publish) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.publish([cli_opts.plugin], function(err, d) {
if(err) return console.log('Error publishing plugin');
console.log('plugin published');
@@ -99,7 +99,7 @@ else if (cli_opts.publish) {
});
}
else if (cli_opts.unpublish) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
if(err) return console.log('Error unpublishing plugin');
console.log('plugin unpublished');
@@ -107,7 +107,7 @@ else if (cli_opts.unpublish) {
});
}
else if (cli_opts.search) {
- registry.use(null, function(err) {
+ registry.use(config.registry, function(err) {
registry.search(cli_opts.search.split(','), function(err, d) {
if(err) return console.log(err);
});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ca2bec10/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 5fef741..1eeeeb2 100644
--- a/package.json
+++ b/package.json
@@ -29,7 +29,7 @@
"underscore":"1.4.4",
"dep-graph":"1.1.0",
"semver": "2.0.x"
- "plugman-registry": "0.0.1"
+ "plugman-registry": "0.0.2"
},
"devDependencies": {
"jasmine-node": "1.7.0"
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/ca2bec10/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 28d9994..71f8785 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -4,7 +4,8 @@ var shell = require('shelljs'),
plugins = require('./util/plugins'),
xml_helpers = require('./util/xml-helpers'),
metadata = require('./util/metadata'),
- path = require('path');
+ path = require('path'),
+ registry = require('plugman-registry');
// possible options: link, subdir, git_ref
module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback) {
@@ -47,31 +48,45 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
// Copy from the local filesystem.
// First, read the plugin.xml and grab the ID.
plugin_dir = path.join(uri.href, options.subdir);
- var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
- require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...');
- var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);
- var plugin_id = xml.getroot().attrib.id;
- var dest = path.join(plugins_dir, plugin_id);
+ var movePlugin = function(plugin_dir, linkable) {
+ var plugin_xml_path = path.join(plugin_dir, 'plugin.xml');
+ require('../plugman').emit('log', 'Fetch is reading plugin.xml from location "' + plugin_xml_path + '"...');
+ var xml = xml_helpers.parseElementtreeSync(plugin_xml_path);
+ var plugin_id = xml.getroot().attrib.id;
- shell.rm('-rf', dest);
- if (options.link) {
- require('../plugman').emit('log', 'Symlinking from location "' + plugin_dir + '" to location "' + dest + '"');
- fs.symlinkSync(plugin_dir, dest, 'dir');
- } else {
- shell.mkdir('-p', dest);
- require('../plugman').emit('log', 'Copying from location "' + plugin_dir + '" to location "' + dest + '"');
- shell.cp('-R', path.join(plugin_dir, '*'), dest);
- }
+ var dest = path.join(plugins_dir, plugin_id);
- var data = {
- source: {
- type: 'local',
- path: plugin_dir
+ shell.rm('-rf', dest);
+ if (options.link && linkable) {
+ require('../plugman').emit('log', 'Symlinking from location "' + plugin_dir + '" to location "' + dest + '"');
+ fs.symlinkSync(plugin_dir, dest, 'dir');
+ } else {
+ shell.mkdir('-p', dest);
+ require('../plugman').emit('log', 'Copying from location "' + plugin_dir + '" to location "' + dest + '"');
+ shell.cp('-R', path.join(plugin_dir, '*') , dest);
}
+
+ var data = {
+source: {
+type: 'local',
+ path: plugin_dir
+ }
+ };
+ metadata.save_fetch_metadata(dest, data);
+
+ if (callback) callback(null, dest);
};
- metadata.save_fetch_metadata(dest, data);
- if (callback) callback(null, dest);
+
+ if(!fs.existsSync(plugin_dir)) {
+ registry.use(null, function() {
+ registry.fetch(plugin_dir, function(err, plugin_dir) {
+ movePlugin(plugin_dir, false);
+ });
+ })
+ } else {
+ movePlugin(plugin_dir, true);
+ }
}
};
[02/50] git commit: adding registry dependency and wiring up commands
Posted by an...@apache.org.
adding registry dependency and wiring up commands
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/9beb41be
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/9beb41be
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/9beb41be
Branch: refs/heads/master
Commit: 9beb41be4171ab45839abff89bad914cfdbae2f8
Parents: 272c7c5
Author: Anis Kadri <an...@gmail.com>
Authored: Thu Jun 13 18:21:27 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:11:21 2013 -0700
----------------------------------------------------------------------
main.js | 33 ++++++++++++++++++++++++++-------
package.json | 3 ++-
2 files changed, 28 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9beb41be/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 3af9d98..4602711 100755
--- a/main.js
+++ b/main.js
@@ -33,8 +33,8 @@ var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8'
, 'install' : Boolean
, 'uninstall' : Boolean
, 'adduser' : Boolean
- , 'publish' : path
- , 'unpublish' : path
+ , 'publish' : Boolean
+ , 'unpublish' : Boolean
, 'search' : String
, 'v' : Boolean
, 'debug' : Boolean
@@ -68,23 +68,42 @@ process.on('uncaughtException', function(error){
if (cli_opts.v) {
console.log(package.name + ' version ' + package.version);
}
-else if (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin) {
+else if ((cli_opts.install || cli_opts.uninstall) && (!cli_opts.platform || !cli_opts.project || !cli_opts.plugin)) {
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 });
}
else if (cli_opts.adduser) {
- // TODO adduser
+ registry.use(null, function(err) {
+ registry.adduser(null, function(err) {
+ if(err) return console.log(err);
+ console.log('user added');
+ });
+ });
}
else if (cli_opts.publish) {
- // TODO publish
+ registry.use(null, function(err) {
+ registry.publish([cli_opts.plugin], function(err, d) {
+ if(err) return console.log('Error publishing plugin');
+ console.log('plugin published');
+ });
+ });
}
else if (cli_opts.unpublish) {
- // TODO unpublish
+ registry.use(null, function(err) {
+ registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
+ if(err) return console.log('Error unpublishing plugin');
+ console.log('plugin unpublished');
+ });
+ });
}
else if (cli_opts.search) {
- // TODO search
+ registry.use(null, function(err) {
+ registry.search(cli_opts.search.split(','), function(err, d) {
+ if(err) return console.log(err);
+ });
+ });
}
else {
var cli_variables = {}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/9beb41be/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 937da53..f78d2ee 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,8 @@
"ncallbacks":"1.1.0",
"underscore":"1.4.4",
"dep-graph":"1.1.0",
- "semver": "1.x.x"
+ "semver": "1.x.x",
+ "plugman-registry": "0.0.1"
},
"devDependencies": {
"jasmine-node": "1.7.0"
[30/50] git commit: Merge branch 'plugman-registry' of
https://git-wip-us.apache.org/repos/asf/cordova-plugman into plugman-registry
Posted by an...@apache.org.
Merge branch 'plugman-registry' of https://git-wip-us.apache.org/repos/asf/cordova-plugman into plugman-registry
Conflicts:
doc/help.txt
main.js
package.json
plugin_spec.md
plugman.js
src/fetch.js
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/5a22d2a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/5a22d2a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/5a22d2a4
Branch: refs/heads/master
Commit: 5a22d2a43f61fa5a98022d79429fc950f8c393fd
Parents: 93acf39 c9a42d6
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 14:49:46 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:49:46 2013 -0700
----------------------------------------------------------------------
----------------------------------------------------------------------
[10/50] git commit: adding search results
Posted by an...@apache.org.
adding search results
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/dc8caca0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/dc8caca0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/dc8caca0
Branch: refs/heads/master
Commit: dc8caca0af617b4f4d720eb8439d82b01326e89e
Parents: 5ec2924
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jun 19 14:50:33 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:13:29 2013 -0700
----------------------------------------------------------------------
main.js | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/dc8caca0/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 7baebe6..b695953 100755
--- a/main.js
+++ b/main.js
@@ -93,7 +93,7 @@ else if (cli_opts.adduser) {
else if (cli_opts.publish) {
registry.use(config.registry, function(err) {
registry.publish([cli_opts.plugin], function(err, d) {
- if(err) return console.log('Error publishing plugin');
+ if(err) return console.log('Error publishing plugin', err);
console.log('plugin published');
});
});
@@ -108,12 +108,15 @@ else if (cli_opts.unpublish) {
}
else if (cli_opts.search) {
registry.use(config.registry, function(err) {
- registry.search(cli_opts.search.split(','), function(err, d) {
+ registry.search(cli_opts.search.split(','), function(err, plugins) {
if(err) return console.log(err);
+ for(var plugin in plugins) {
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ }
});
});
}
-else {
+else if(cli_opts.install) {
var cli_variables = {}
if (cli_opts.variable) {
cli_opts.variable.forEach(function (variable) {
@@ -128,4 +131,6 @@ else {
www_dir: cli_opts.www
};
plugman.install(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, opts);
+} else {
+ printUsage();
}
[34/50] git commit: Merge branch 'master' into plugman-registry
Posted by an...@apache.org.
Merge branch 'master' into plugman-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/d1083469
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/d1083469
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/d1083469
Branch: refs/heads/master
Commit: d10834690dd774e415fc1c899ff5ff2050b75cbe
Parents: ae545bc 24e452a
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jul 15 14:45:41 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Jul 15 14:45:41 2013 -0700
----------------------------------------------------------------------
src/platforms/wp7.js | 70 -----------------------------------------------
src/platforms/wp8.js | 70 -----------------------------------------------
src/prepare.js | 33 ++++++++++++++++++++++
src/util/csproj.js | 7 ++++-
4 files changed, 39 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
[24/50] git commit: adding fetch and fixing cli interface
Posted by an...@apache.org.
adding fetch and fixing cli interface
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/4aa51bd3
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/4aa51bd3
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/4aa51bd3
Branch: refs/heads/master
Commit: 4aa51bd343e3e1ee4644d2bc64110c0d92075a64
Parents: 67ab4d3
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 15:30:31 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 14:10:14 2013 -0700
----------------------------------------------------------------------
main.js | 1 +
src/fetch.js | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/4aa51bd3/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 3db0f6a..c570114 100755
--- a/main.js
+++ b/main.js
@@ -25,6 +25,7 @@ var path = require('path')
, nopt = require('nopt')
, plugins = require('./src/util/plugins')
, registry = require('plugman-registry')
+ , config = require('./config')
, plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/4aa51bd3/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index c86c76d..910c69d 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -68,10 +68,10 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
}
var data = {
-source: {
-type: 'local',
- path: plugin_dir
- }
+ source: {
+ type: 'local',
+ path: plugin_dir
+ }
};
metadata.save_fetch_metadata(dest, data);
[36/50] git commit: error handling
Posted by an...@apache.org.
error handling
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/8c0dbf73
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/8c0dbf73
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/8c0dbf73
Branch: refs/heads/master
Commit: 8c0dbf737c753c3d52fb0396aa0e45d430d5101c
Parents: 332dc21
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jul 15 17:33:02 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Jul 15 17:33:02 2013 -0700
----------------------------------------------------------------------
plugman.js | 1 +
src/fetch.js | 10 ++++++----
2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8c0dbf73/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index c1f9d2d..541946a 100755
--- a/plugman.js
+++ b/plugman.js
@@ -27,6 +27,7 @@ module.exports = {
uninstall: require('./src/uninstall'),
fetch: require('./src/fetch'),
prepare: require('./src/prepare'),
+ config: require('./config'),
adduser: require('./src/adduser'),
publish: require('./src/publish'),
unpublish:require('./src/unpublish'),
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/8c0dbf73/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 910c69d..7cd4fb2 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -5,8 +5,8 @@ var shell = require('shelljs'),
xml_helpers = require('./util/xml-helpers'),
metadata = require('./util/metadata'),
path = require('path'),
- registry = require('plugman-registry');
-
+ registry = require('plugman-registry');
+// XXX: leave the require('../plugman') because jasmine shits itself if you declare it up top
// possible options: link, subdir, git_ref
module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback) {
require('../plugman').emit('log', 'Fetching plugin from location "' + plugin_dir + '"...');
@@ -80,9 +80,11 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
if(!fs.existsSync(plugin_dir)) {
- registry.use(null, function() {
+ registry.use(require('../plugman').config.registry, function() {
registry.fetch([plugin_dir], function(err, plugin_dir) {
- movePlugin(plugin_dir, false);
+ if (callback) return callback(err);
+ else throw err;
+ movePlugin(plugin_dir, false);
});
})
} else {
[35/50] git commit: typo in callback
Posted by an...@apache.org.
typo in callback
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/332dc21c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/332dc21c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/332dc21c
Branch: refs/heads/master
Commit: 332dc21cd93999ae76fc700b3dcd9e0ea7f7ab9e
Parents: d108346
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jul 15 14:57:56 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Mon Jul 15 14:57:56 2013 -0700
----------------------------------------------------------------------
src/search.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/332dc21c/src/search.js
----------------------------------------------------------------------
diff --git a/src/search.js b/src/search.js
index d70db06..31b1094 100644
--- a/src/search.js
+++ b/src/search.js
@@ -6,7 +6,7 @@ module.exports = function(search_opts, callback) {
registry.search(search_opts, function(err, plugins) {
if(callback) {
if(err) return callback(err);
- callback(plugins);
+ callback(null, plugins);
} else {
if(err) return console.log(err);
for(var plugin in plugins) {
[45/50] git commit: adding callbacks to most functions and updating
README.md
Posted by an...@apache.org.
adding callbacks to most functions and updating README.md
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/e778e8a1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/e778e8a1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/e778e8a1
Branch: refs/heads/master
Commit: e778e8a19c74e4ec7ab37a10de390a036707db56
Parents: 7114350
Author: Anis Kadri <an...@apache.org>
Authored: Wed Jul 24 15:31:38 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Wed Jul 24 15:31:38 2013 -0700
----------------------------------------------------------------------
README.md | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
config.js | 4 ++--
src/adduser.js | 13 ++++++++++---
src/publish.js | 16 ++++++++++++----
src/unpublish.js | 13 ++++++++++---
5 files changed, 78 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e778e8a1/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 5f366e4..3ed620d 100644
--- a/README.md
+++ b/README.md
@@ -27,11 +27,11 @@ This document defines tool usage.
## Command Line Usage
- plugman --platform <ios|android|blackberry10|wp7|wp8> --project <directory> --plugin <name|url|path> [--plugins_dir <directory>] [--www <directory>] [--variable <name>=<value> [--variable <name>=<value> ...]]
- plugman --uninstall --platform <ios|android|blackberr10|wp7|wp8> --project <directory> --plugin <id> [--www <directory>] [--plugins_dir <directory>]
+ plugman install --platform <ios|android|blackberry10|wp7|wp8> --project <directory> --plugin <name|url|path> [--plugins_dir <directory>] [--www <directory>] [--variable <name>=<value> [--variable <name>=<value> ...]]
+ plugman uninstall --platform <ios|android|blackberr10|wp7|wp8> --project <directory> --plugin <id> [--www <directory>] [--plugins_dir <directory>]
* Using minimum parameters, installs a plugin into a cordova project. You must specify a platform and cordova project location for that platform. You also must specify a plugin, with the different `--plugin` parameter forms being:
- * `name`: The directory name where the plugin contents exist. This must be an existing directory under the `--plugins_dir` path (see below for more info).
+ * `name`: The directory name where the plugin contents exist. This must be an existing directory under the `--plugins_dir` path (see below for more info) or a plugin in the Cordova registry.
* `url`: A URL starting with https:// or git://, pointing to a valid git repository that is clonable and contains a `plugin.xml` file. The contents of this repository would be copied into the `--plugins_dir`.
* `path`: A path to a directory containing a valid plugin which includes a `plugin.xml` file. This path's contents will be copied into the `--plugins_dir`.
* `--uninstall`: Uninstalls an already-`--install`'ed plugin from a cordova project. Specify the plugin ID.
@@ -49,6 +49,10 @@ Other parameters:
{ install: [Function: installPlugin],
uninstall: [Function: uninstallPlugin],
fetch: [Function: fetchPlugin],
+ search: [Function: search],
+ publish: [Function: publish],
+ unpublish: [Function: unpublish],
+ adduser: [Function: adduser],
prepare: [Function: handlePrepare] }
### `install` method
@@ -59,7 +63,7 @@ Installs a plugin into a specified cordova project of a specified platform.
* `platform`: one of `android`, `ios`, `blackberry10`, `wp7` or `wp8`
* `project_dir`: path to an instance of the above specified platform's cordova project
- * `id`: a string representing the `id` of the plugin, a path to a cordova plugin with a valid `plugin.xml` file, or an `https://` or `git://` url to a git repository of a valid cordova plugin
+ * `id`: a string representing the `id` of the plugin, a path to a cordova plugin with a valid `plugin.xml` file, or an `https://` or `git://` url to a git repository of a valid cordova plugin or a plugin published to the Cordova registry
* `plugins_dir`: path to directory where plugins will be stored, defaults to `<project_dir>/cordova/plugins`
* `subdir`: subdirectory within the plugin directory to consider as plugin directory root, defaults to `.`
* `cli_variables`: an object mapping cordova plugin specification variable namess (see [plugin specification](plugin_spec.md)) to values
@@ -87,7 +91,7 @@ Copies a cordova plugin into a single location that plugman uses to track which
module.exports = function fetchPlugin(plugin_dir, plugins_dir, link, subdir, git_ref, callback) {
- * `plugin_dir`: path or URL to a plugin directory/repository
+ * `plugin_dir`: path, URL to a plugin directory/repository or name of a plugin published to the Cordova registry.
* `plugins_dir`: path housing all plugins used in this project
* `link`: if `plugin_dir` points to a local path, will create a symbolic link to that folder instead of copying into `plugins_dir`, defaults to `false`
* `subdir`: subdirectory within the plugin directory to consider as plugin directory root, defaults to `.`
@@ -104,11 +108,46 @@ Finalizes plugin installation by making configuration file changes and setting u
* `platform`: one of `android`, `ios`, `blackberry10`, `wp7` or `wp8`
* `plugins_dir`: path housing all plugins used in this project
+## Registry related actions
+
+Plugman uses an [npmjs.org](http://github.com/isaacs/npmjs.org) based registry to host plugins. The URL can be configured in the `config.js` file at the root of the installation folder.
+
+### `config.js` file
+
+ module.exports = {
+ registry: "http://registry.cordova.io"
+ }
+
+### `adduser` method
+
+Adds a user account to the registry. Function takes no arguments other than a an optional callback
+
+ module.exports = function(callback) {
+
+### `publish` method
+
+Publishes plugins to the registry. `plugin_paths` is an array of plugin paths to publish to the reigstry.
+
+ module.exports = function(plugin_paths, callback) {
+
+### `unpublish` method
+
+unpublishes plugins from the registry. Can unpublish a version by specifying `plugin@version` or the whole plugin by just specifying `plugin`. `plugins` is an array of `plugin[@version]` elements.
+
+ module.exports = function(plugins, callback) {
+
+### `search` method
+
+Searches plugins in the registry. `search_opts` is an array of keywords
+
+ module.exports = function(search_opts, callback) {
+
## Example Plugins
- Google has a [bunch of plugins](https://github.com/MobileChromeApps/chrome-cordova/tree/master/plugins) which are maintained actively by a contributor to plugman
- Adobe maintains plugins for its Build cloud service, which are open sourced and [available on GitHub](https://github.com/phonegap-build)
- BlackBerry has a [bunch of plugins](https://github.com/blackberry/cordova-blackberry/tree/master/blackberry10/plugins) offering deep platform integration
+- Core and 3rd party plugins can be found on the [Cordova Registry](http://plugins.cordova.io).
## Development
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e778e8a1/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
index 0c305b4..c1e6339 100644
--- a/config.js
+++ b/config.js
@@ -1,4 +1,4 @@
module.exports = {
- registry: "http://registry.cordova.io"
-// registry: "http://localhost:5984/registry/_design/app/_rewrite"
+// registry: "http://registry.cordova.io"
+ registry: "http://localhost:5984/registry/_design/app/_rewrite"
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e778e8a1/src/adduser.js
----------------------------------------------------------------------
diff --git a/src/adduser.js b/src/adduser.js
index da7cf4e..8ca9c9a 100644
--- a/src/adduser.js
+++ b/src/adduser.js
@@ -1,11 +1,18 @@
var registry = require('plugman-registry')
, config = require('../config');
-module.exports = function() {
+module.exports = function(callback) {
registry.use(config.registry, function(err) {
registry.adduser(null, function(err) {
- if(err) return console.log(err);
- console.log('user added');
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('user added');
+ }
+ }
});
});
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e778e8a1/src/publish.js
----------------------------------------------------------------------
diff --git a/src/publish.js b/src/publish.js
index 234de15..06412cc 100644
--- a/src/publish.js
+++ b/src/publish.js
@@ -1,11 +1,19 @@
var registry = require('plugman-registry')
, config = require('../config');
-module.exports = function(plugin) {
+module.exports = function(plugin_path, callback) {
registry.use(config.registry, function(err) {
- registry.publish(plugin, function(err, d) {
- if(err) return console.log('Error publishing plugin', err);
- console.log('plugin published');
+ // plugin_path is an array of paths
+ registry.publish(plugin_path, function(err, d) {
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('Plugin published');
+ }
+ }
});
});
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/e778e8a1/src/unpublish.js
----------------------------------------------------------------------
diff --git a/src/unpublish.js b/src/unpublish.js
index 072d740..22db926 100644
--- a/src/unpublish.js
+++ b/src/unpublish.js
@@ -1,11 +1,18 @@
var registry = require('plugman-registry')
, config = require('../config');
-module.exports = function(plugin) {
+module.exports = function(plugin, callback) {
registry.use(config.registry, function(err) {
registry.unpublish(plugin, function(err, d) {
- if(err) return console.log('Error unpublishing plugin');
- console.log('plugin unpublished');
+ if(callback && typeof callback === 'function') {
+ err ? callback(err) : callback(null);
+ } else {
+ if(err) {
+ throw err;
+ } else {
+ console.log('Plugin unpublished');
+ }
+ }
});
});
}
[42/50] git commit: fixing fetch
Posted by an...@apache.org.
fixing fetch
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/1641fe84
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/1641fe84
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/1641fe84
Branch: refs/heads/master
Commit: 1641fe84133e8e9b0ee3fd9f7fff8ffb776b7642
Parents: 9dab680
Author: Anis Kadri <an...@apache.org>
Authored: Fri Jul 19 14:27:24 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Fri Jul 19 14:27:24 2013 -0700
----------------------------------------------------------------------
src/fetch.js | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/1641fe84/src/fetch.js
----------------------------------------------------------------------
diff --git a/src/fetch.js b/src/fetch.js
index 7cd4fb2..d5e3e8c 100644
--- a/src/fetch.js
+++ b/src/fetch.js
@@ -82,8 +82,13 @@ module.exports = function fetchPlugin(plugin_dir, plugins_dir, options, callback
if(!fs.existsSync(plugin_dir)) {
registry.use(require('../plugman').config.registry, function() {
registry.fetch([plugin_dir], function(err, plugin_dir) {
- if (callback) return callback(err);
- else throw err;
+ if (err) {
+ if(callback) {
+ return callback(err);
+ } else {
+ throw err;
+ }
+ }
movePlugin(plugin_dir, false);
});
})
[06/50] git commit: updating plugin spec
Posted by an...@apache.org.
updating plugin spec
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/b0fe1f4b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/b0fe1f4b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/b0fe1f4b
Branch: refs/heads/master
Commit: b0fe1f4b01826fb0e8df2975caa3c040ed1b3269
Parents: c7a0ff9
Author: Anis Kadri <an...@apache.org>
Authored: Mon Jun 17 16:08:32 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:12:38 2013 -0700
----------------------------------------------------------------------
plugin_spec.md | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/b0fe1f4b/plugin_spec.md
----------------------------------------------------------------------
diff --git a/plugin_spec.md b/plugin_spec.md
index 2fbabbf..efe1de4 100644
--- a/plugin_spec.md
+++ b/plugin_spec.md
@@ -72,12 +72,46 @@ If no `<engine>` tags are specified, plugman will attempt to install into the sp
## <name> element
A human-readable name for the plugin. The text content of the element contains
-the name of the plugin. An example:
+the name of the plugin. Has to be lower case and cannot contain spaces or special characters. An example:
- <name>Foo</name>
+ <name>foo</name>
This element does not (yet) handle localization.
+## <description> element
+
+A human-readable description for the plugin. The text content of the element contains
+the description of the plugin. An example:
+
+ <description>foo plugin description</description>
+
+This element does not (yet) handle localization.
+
+## <author> element
+
+Plugin author name. The text content of the element contains
+the name of the plugin author. An example:
+
+ <author>foo plugin description</author>
+
+## <keywords> element
+
+Plugin keywords. The text content of the element contains comma separated keywords to describe the plugin. An example:
+
+ <keywords>foo,bar</keywords>
+
+## <license> element
+
+Plugin license. The text content of the element contains the plugin license. An example:
+
+ <keywords>foo,bar</keywords>
+
+## <license> element
+
+Plugin license. The text content of the element contains the plugin license. An example:
+
+ <license>Apache</license>
+
## <asset> element
One or more elements listing the files or directories to be copied into a
[49/50] git commit: updating specs
Posted by an...@apache.org.
updating specs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/582fdfa6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/582fdfa6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/582fdfa6
Branch: refs/heads/master
Commit: 582fdfa6e4dadf07f1b356696204088226316a7a
Parents: fd679f3
Author: Anis Kadri <an...@apache.org>
Authored: Sat Jul 27 17:46:27 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Sat Jul 27 17:46:27 2013 -0700
----------------------------------------------------------------------
plugman.js | 5 +-
spec/config.js | 10 ---
spec/config.spec.js | 11 +++
spec/plugins/DummyPlugin/plugin.xml | 9 ++-
spec/registry/registry.js | 20 ------
spec/registry/registry.spec.js | 94 +++++++++++++++++++++++++
src/registry/manifest.js | 25 +++----
src/registry/registry.js | 117 +++++++++++++++----------------
8 files changed, 187 insertions(+), 104 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 716c5ef..b921f4d 100755
--- a/plugman.js
+++ b/plugman.js
@@ -27,7 +27,7 @@ plugman = {
uninstall: require('./src/uninstall'),
fetch: require('./src/fetch'),
prepare: require('./src/prepare'),
- config: require('./config'),
+ config: require('./src/config'),
adduser: require('./src/adduser'),
publish: require('./src/publish'),
unpublish: require('./src/unpublish'),
@@ -40,6 +40,9 @@ plugman = {
};
plugman.commands = {
+ 'config' : function(cli_opts) {
+ plugman.config(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/582fdfa6/spec/config.js
----------------------------------------------------------------------
diff --git a/spec/config.js b/spec/config.js
deleted file mode 100644
index 5f4f781..0000000
--- a/spec/config.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var config = require('../src/config'),
- registry = require('../src/registry/registry');
-
-describe('config', function() {
- it('should run config', function() {
- var sConfig = spyOn(registry, 'config');
- config(function(err, result) { });
- expect(sConfig).toHaveBeenCalledWith(jasmine.any(Function));
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/spec/config.spec.js
----------------------------------------------------------------------
diff --git a/spec/config.spec.js b/spec/config.spec.js
new file mode 100644
index 0000000..fe54636
--- /dev/null
+++ b/spec/config.spec.js
@@ -0,0 +1,11 @@
+var config = require('../src/config'),
+ registry = require('../src/registry/registry');
+
+describe('config', function() {
+ it('should run config', function() {
+ var sConfig = spyOn(registry, 'config');
+ var params = ['set', 'registry', 'http://registry.cordova.io'];
+ config(params, function(err, result) { });
+ expect(sConfig).toHaveBeenCalledWith(params, jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/spec/plugins/DummyPlugin/plugin.xml
----------------------------------------------------------------------
diff --git a/spec/plugins/DummyPlugin/plugin.xml b/spec/plugins/DummyPlugin/plugin.xml
index deba345..162044a 100644
--- a/spec/plugins/DummyPlugin/plugin.xml
+++ b/spec/plugins/DummyPlugin/plugin.xml
@@ -23,7 +23,14 @@
id="com.phonegap.plugins.dummyplugin"
version="0.6.0">
- <name>Dummy Plugin</name>
+ <!-- new requirement: NO SPACES -->
+ <name>dummyplugin</name>
+ <!-- These are going to be required by plugman-registry -->
+ <description>my description</description>
+ <author>Jackson Badman</author>
+ <keywords>dummy,plugin</keywords>
+ <license>BSD</license>
+ <!-- end plugman-registry requirements -->
<asset src="www/dummyplugin.js" target="dummyplugin.js" />
<asset src="www/dummyplugin" target="dummyplugin" />
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/spec/registry/registry.js
----------------------------------------------------------------------
diff --git a/spec/registry/registry.js b/spec/registry/registry.js
deleted file mode 100644
index d4baf59..0000000
--- a/spec/registry/registry.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var registry = require('../../src/registry/registry'),
- npm = require('npm');
-
-describe('registry', function() {
- beforeEach(function() {
- registry.settings = {
- cache: plugmanCacheDir,
- force: true,
- logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
- userconfig: path.resolve(plugmanConfigDir, 'config')
- };
- });
- it('should run config', function() {
- var sLoad = spyOn(npm, 'load').andCallThrough();
- var sConfig = spyOn(npm, 'config');
- registry.config(new Array('/path/to/myplugin'));
- expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
- expect(sPublish).toHaveBeenCalledWith(['/path/to/myplugin'], jasmine.any(Function));
- });
-});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/spec/registry/registry.spec.js
----------------------------------------------------------------------
diff --git a/spec/registry/registry.spec.js b/spec/registry/registry.spec.js
new file mode 100644
index 0000000..8b26c1f
--- /dev/null
+++ b/spec/registry/registry.spec.js
@@ -0,0 +1,94 @@
+var registry = require('../../src/registry/registry'),
+ manifest = require('../../src/registry/manifest'),
+ fs = require('fs'),
+ path = require('path'),
+ npm = require('npm');
+
+describe('registry', function() {
+ describe('manifest', function() {
+ var pluginDir, packageJson;
+ beforeEach(function() {
+ pluginDir = __dirname + '/../plugins/DummyPlugin';
+ packageJson = path.resolve(pluginDir, 'package.json');
+ });
+ afterEach(function() {
+ fs.unlink(packageJson);
+
+ });
+ 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('dummyplugin');
+ expect(JSON.parse(fs.readFileSync(packageJson)).version).toEqual('0.6.0');
+ });
+ });
+ describe('actions', function() {
+ beforeEach(function() {
+ var fakeSettings = {
+ cache: '/some/cache/dir',
+ logstream: 'somelogstream@2313213',
+ userconfig: '/some/config/dir'
+ };
+ var fakeNPMCommands = {
+ config: function() {},
+ adduser: function() {},
+ publish: function() {},
+ unpublish: function() {},
+ search: function() {}
+ }
+ registry.settings = fakeSettings;
+ npm.commands = fakeNPMCommands;
+ });
+ it('should run config', function() {
+ var params = ['set', 'registry', 'http://registry.cordova.io'];
+ var sLoad = spyOn(npm, 'load').andCallFake(function(err, cb) {
+ cb();
+ });
+ var sConfig = spyOn(npm.commands, 'config');
+ registry.config(params, function() {});
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sConfig).toHaveBeenCalledWith(params, jasmine.any(Function));
+ });
+ it('should run adduser', function() {
+ var sLoad = spyOn(npm, 'load').andCallFake(function(err, cb) {
+ cb();
+ });
+ var sAddUser = spyOn(npm.commands, 'adduser');
+ registry.adduser(null, function() {});
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sAddUser).toHaveBeenCalledWith(null, jasmine.any(Function));
+ });
+ it('should run publish', function() {
+ var params = [__dirname + '/../plugins/DummyPlugin'];
+ var sLoad = spyOn(npm, 'load').andCallFake(function(err, cb) {
+ cb();
+ });
+ var sPublish = spyOn(npm.commands, 'publish');
+ var sGenerate = spyOn(manifest, 'generatePackageJsonFromPluginXml');
+ registry.publish(params, function() {});
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sGenerate).toHaveBeenCalledWith(params[0]);
+ expect(sPublish).toHaveBeenCalledWith(params, jasmine.any(Function));
+ });
+ it('should run unpublish', function() {
+ var params = ['dummyplugin@0.6.0'];
+ var sLoad = spyOn(npm, 'load').andCallFake(function(err, cb) {
+ cb();
+ });
+ var sUnpublish = spyOn(npm.commands, 'unpublish');
+ registry.unpublish(params, function() {});
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sUnpublish).toHaveBeenCalledWith(params, jasmine.any(Function));
+ });
+ it('should run search', function() {
+ var params = ['dummyplugin', 'plugin'];
+ var sLoad = spyOn(npm, 'load').andCallFake(function(err, cb) {
+ cb();
+ });
+ var sSearch = spyOn(npm.commands, 'search');
+ registry.search(params, function() {});
+ expect(sLoad).toHaveBeenCalledWith(registry.settings, jasmine.any(Function));
+ expect(sSearch).toHaveBeenCalledWith(params, true, jasmine.any(Function));
+ });
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/src/registry/manifest.js
----------------------------------------------------------------------
diff --git a/src/registry/manifest.js b/src/registry/manifest.js
index 59f7bb6..9a6e66c 100644
--- a/src/registry/manifest.js
+++ b/src/registry/manifest.js
@@ -2,8 +2,14 @@ var DOMParser = require('xmldom').DOMParser,
path = require('path'),
fs = require('fs');
+function handleError(err, cb) {
+ if(typeof cb == 'function') {
+ return cb(err);
+ }
+ throw err;
+}
+
// Java world big-up!
-// TODO use CALLBACK
function generatePackageJsonFromPluginXml(plugin_path, cb) {
var package_json = {};
var plugin_xml = fs.readFileSync(path.resolve(plugin_path, 'plugin.xml'), "utf8");
@@ -18,11 +24,7 @@ function generatePackageJsonFromPluginXml(plugin_path, cb) {
var version = doc.documentElement.getAttribute('version')
if(!version) {
var e = new Error('`version` required');
- if(cb) {
- cb(e);
- return null;
- }
- throw e;
+ return handleError(e, cb)
}
package_json.version = version;
@@ -30,14 +32,13 @@ function generatePackageJsonFromPluginXml(plugin_path, cb) {
if(doc.documentElement.getElementsByTagName('name').length != 1 ||
!doc.documentElement.getElementsByTagName('name').item(0).firstChild) {
var e = new Error('`name` is required');
- if(cb) {
- cb(e);
- return null;
- }
- throw e;
+ return handleError(e, cb)
}
var name = doc.documentElement.getElementsByTagName('name').item(0).firstChild.nodeValue;
- if(!name.match(/^\w+|-*$/)) throw new Error('`name` can only contain alphanumberic characters and -')
+ if(!name.match(/^\w+|-*$/)) {
+ var e = new Error('`name` can only contain alphanumberic characters and -')
+ return handleError(e, cb);
+ }
package_json.name = name.toLowerCase();
// OPTIONAL fields: description, license, keywords. TODO: add more!
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/582fdfa6/src/registry/registry.js
----------------------------------------------------------------------
diff --git a/src/registry/registry.js b/src/registry/registry.js
index bf99a15..a56f36a 100644
--- a/src/registry/registry.js
+++ b/src/registry/registry.js
@@ -9,57 +9,12 @@ var npm = require('npm'),
plugmanConfigDir = path.resolve(process.env.HOME, '.plugman'),
plugmanCacheDir = path.resolve(plugmanConfigDir, 'cache');
-var settings = module.exports.settings;
-
-function checkConfig(cb) {
- if(settings != null) {
- cb();
- } else {
- use(cb);
- }
-}
-
function handleError(err, cb) {
if(typeof cb == 'function') {
return cb(err);
}
throw err;
}
-/**
- * @method use
- * @param {String} registry NPM registry URL
- * @param {Function} cb callback
- */
-function use(cb) {
- if(typeof cb != 'function') throw new Error('Please provide a callback');
- // check if settings already set
- if(settings != null) return cb();
-
- // setting up settings
- // obviously if settings dir does not exist settings is going to be empty
- if(!fs.existsSync(plugmanConfigDir)) {
- fs.mkdirSync(plugmanConfigDir);
- fs.mkdirSync(plugmanCacheDir);
- }
-
- settings = rc('plugman', {
- cache: plugmanCacheDir,
- force: true,
- logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
- userconfig: path.resolve(plugmanConfigDir, 'config')
- });
-
- if(settings.registry) {
- cb();
- } else {
- // setting registry
- npm.load(settings, function(er) {
- if (er) return handlError(er);
- npm.commands.config(['set', 'registry', 'http://registry.cordova.io'], cb);
- });
- }
-
-}
/**
* @method getPackageInfo
@@ -68,11 +23,13 @@ function use(cb) {
*/
function getPackageInfo(args, cb) {
var thing = args.length ? args.shift().split("@") : [],
- name = thing.shift(),
- version = thing.join("@"),
+ name = thing.shift(),
+ version = thing.join("@");
version = version ? version : 'latest';
+ var settings = module.exports.settings;
+
http.get(settings.registry + '/' + name + '/' + version, function(res) {
if(res.statusCode != 200) {
var err = new Error('Error');
@@ -98,6 +55,8 @@ function getPackageInfo(args, cb) {
* @param {Function} cb callback
*/
function fetchPackage(info, cb) {
+ var settings = module.exports.settings;
+
var cached = path.resolve(settings.cache, info.name, info.version, 'package');
if(fs.existsSync(cached)) {
cb(null, cached);
@@ -130,10 +89,10 @@ module.exports = {
* @param {Function} cb Command callback
*/
config: function(args, cb) {
- checkConfig(function(err) {
- if(err) return handleError(err, cb)
+ initSettings(function(err, settings) {
+ if(err) return handleError(err, cb);
npm.load(settings, function(er) {
- if (er) return handlError(er);
+ if (er) return handleError(er);
npm.commands.config(args, cb);
});
});
@@ -144,10 +103,10 @@ module.exports = {
* @param {Function} cb Command callback
*/
adduser: function(args, cb) {
- checkConfig(function(err) {
- if(err) return handleError(err, cb)
+ initSettings(function(err, settings) {
+ if(err) return handleError(err, cb);
npm.load(settings, function(er) {
- if (er) return handlError(er);
+ if (er) return handleError(er);
npm.commands.adduser(args, cb);
});
});
@@ -158,11 +117,11 @@ module.exports = {
* @param {Function} cb Command callback
*/
publish: function(args, cb) {
- checkConfig(function(err) {
+ initSettings(function(err, settings) {
if(err) return handleError(err, cb);
manifest.generatePackageJsonFromPluginXml(args[0]);
npm.load(settings, function(er) {
- if (er) return handlError(er);
+ if (er) return handleError(er);
npm.commands.publish(args, function(err, data) {
fs.unlink(path.resolve(args[0], 'package.json'));
cb(err, data);
@@ -176,10 +135,10 @@ module.exports = {
* @param {Function} cb Command callback
*/
search: function(args, cb) {
- checkConfig(function(err) {
+ initSettings(function(err, settings) {
if(err) return handleError(err, cb);
npm.load(settings, function(er) {
- if (er) return handlError(er, cb);
+ if (er) return handleError(er, cb);
npm.commands.search(args, true, cb);
});
});
@@ -190,7 +149,7 @@ module.exports = {
* @param {Function} cb Command callback
*/
unpublish: function(args, cb) {
- checkConfig(function(err) {
+ initSettings(function(err, settings) {
if(err) return handleError(err, cb);
npm.load(settings, function(er) {
if (er) return handlError(er);
@@ -207,8 +166,8 @@ module.exports = {
* @param {Function} cb Command callback
*/
fetch: function(args, cb) {
- checkConfig(function(err) {
- if(err) return handleError(err, cb)
+ initSettings(function(err, settings) {
+ if(err) return handleError(err, cb);
getPackageInfo(args, function(err, info) {
if(err) return handleError(err, cb)
fetchPackage(info, cb);
@@ -216,3 +175,41 @@ module.exports = {
});
}
}
+
+/**
+ * @method initSettings
+ * @param {Function} cb callback
+ */
+function initSettings(cb) {
+ var settings = module.exports.settings;
+ if(typeof cb != 'function') throw new Error('Please provide a callback');
+ // check if settings already set
+ if(settings != null) return cb(null, settings);
+
+ // setting up settings
+ // obviously if settings dir does not exist settings is going to be empty
+ if(!fs.existsSync(plugmanConfigDir)) {
+ fs.mkdirSync(plugmanConfigDir);
+ fs.mkdirSync(plugmanCacheDir);
+ }
+
+ settings = rc('plugman', {
+ cache: plugmanCacheDir,
+ force: true,
+ logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+ userconfig: path.resolve(plugmanConfigDir, 'config')
+ });
+
+ if(settings.registry) {
+ cb(null, settings);
+ } else {
+ // setting registry
+ npm.load(settings, function(er) {
+ if (er) return handlError(er);
+ npm.commands.config(['set', 'registry', 'http://registry.cordova.io'], function(err) {
+ cb(err, settings);
+ });
+ });
+ }
+
+}
[21/50] git commit: minor refactor, added specs
Posted by an...@apache.org.
minor refactor, added specs
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugman/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugman/commit/57246a23
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/57246a23
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/57246a23
Branch: refs/heads/master
Commit: 57246a23af65863854b747deb7eb8b882a1416a2
Parents: 7772f2a
Author: Anis Kadri <an...@apache.org>
Authored: Thu Jul 11 13:08:23 2013 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Jul 11 13:58:46 2013 -0700
----------------------------------------------------------------------
config.js | 2 +-
main.js | 43 +++++++++++--------------------------------
plugman.js | 4 ++++
spec/adduser.spec.js | 13 +++++++++++++
spec/publish.spec.js | 13 +++++++++++++
spec/search.spec.js | 13 +++++++++++++
spec/unpublish.spec.js | 13 +++++++++++++
src/adduser.js | 11 +++++++++++
src/publish.js | 11 +++++++++++
src/search.js | 13 +++++++++++++
src/unpublish.js | 11 +++++++++++
11 files changed, 114 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/config.js
----------------------------------------------------------------------
diff --git a/config.js b/config.js
index 7056d93..244bf55 100644
--- a/config.js
+++ b/config.js
@@ -1,3 +1,3 @@
module.exports = {
- registry: "http://localhost:5984/registry/_design/scratch/_rewrite"
+ registry: "http://plugins.cordova.io"
}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index 6f26d2a..7121a0e 100755
--- a/main.js
+++ b/main.js
@@ -20,13 +20,11 @@
// copyright (c) 2013 Andrew Lunny, Adobe Systems
var path = require('path')
-, url = require('url')
-, package = require(path.join(__dirname, 'package'))
-, nopt = require('nopt')
-, plugins = require('./src/util/plugins')
-, registry = require('plugman-registry')
-, config = require('./config')
-, plugman = require('./plugman');
+ , url = require('url')
+ , package = require(path.join(__dirname, 'package'))
+ , nopt = require('nopt')
+ , plugins = require('./src/util/plugins')
+ , plugman = require('./plugman');
var known_opts = { 'platform' : [ 'ios', 'android', 'blackberry10', 'wp7', 'wp8' ]
, 'project' : path
@@ -90,35 +88,16 @@ else if (cli_opts.uninstall) {
plugman.uninstall(cli_opts.platform, cli_opts.project, cli_opts.plugin, plugins_dir, { www_dir: cli_opts.www });
}
else if (cli_opts.adduser) {
- registry.use(config.registry, function(err) {
- registry.adduser(null, function(err) {
- if(err) return console.log(err);
- console.log('user added');
- });
- });
+ plugman.adduser();
}
-else if (cli_opts.publish) {
- registry.use(config.registry, function(err) {
- registry.publish([cli_opts.plugin], function(err, d) {
- if(err) return console.log('Error publishing plugin');
- console.log('plugin published');
- });
- });
+else if (cli_opts.publish && cli_opts.plugin) {
+ plugman.publish(new Array(cli_opts.plugin));
}
-else if (cli_opts.unpublish) {
- registry.use(config.registry, function(err) {
- registry.unpublish([cli_opts.plugin, '--force'], function(err, d) {
- if(err) return console.log('Error unpublishing plugin');
- console.log('plugin unpublished');
- });
- });
+else if (cli_opts.unpublish && cli_opts.plugin) {
+ plugman.unpublish(new Array(cli_opts.plugin));
}
else if (cli_opts.search) {
- registry.use(config.registry, function(err) {
- registry.search(cli_opts.search.split(','), function(err, d) {
- if(err) return console.log(err);
- });
- });
+ plugman.search(cli_opts.search.split(',');
}
else if(cli_opts.install) {
var cli_variables = {}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/plugman.js
----------------------------------------------------------------------
diff --git a/plugman.js b/plugman.js
index 2775fe1..c1f9d2d 100755
--- a/plugman.js
+++ b/plugman.js
@@ -27,6 +27,10 @@ module.exports = {
uninstall: require('./src/uninstall'),
fetch: require('./src/fetch'),
prepare: require('./src/prepare'),
+ adduser: require('./src/adduser'),
+ publish: require('./src/publish'),
+ unpublish:require('./src/unpublish'),
+ search: require('./src/search'),
config_changes: require('./src/util/config-changes'),
on: emitter.addListener,
off: emitter.removeListener,
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/spec/adduser.spec.js
----------------------------------------------------------------------
diff --git a/spec/adduser.spec.js b/spec/adduser.spec.js
new file mode 100644
index 0000000..563592d
--- /dev/null
+++ b/spec/adduser.spec.js
@@ -0,0 +1,13 @@
+var adduser = require('../src/adduser'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('adduser', function() {
+ it('should add a user', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sAddUser = spyOn(registry, 'adduser');
+ adduser();
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sAddUser).toHaveBeenCalled();
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/spec/publish.spec.js
----------------------------------------------------------------------
diff --git a/spec/publish.spec.js b/spec/publish.spec.js
new file mode 100644
index 0000000..3a253e7
--- /dev/null
+++ b/spec/publish.spec.js
@@ -0,0 +1,13 @@
+var publish = require('../src/publish'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('publish', function() {
+ it('should publish a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sPublish = spyOn(registry, 'publish');
+ publish(new Array('/path/to/myplugin'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sPublish).toHaveBeenCalledWith(['/path/to/myplugin'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/spec/search.spec.js
----------------------------------------------------------------------
diff --git a/spec/search.spec.js b/spec/search.spec.js
new file mode 100644
index 0000000..f708854
--- /dev/null
+++ b/spec/search.spec.js
@@ -0,0 +1,13 @@
+var search = require('../src/search'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('search', function() {
+ it('should search a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sSearch = spyOn(registry, 'search');
+ search(new Array('myplugin', 'keyword'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sSearch).toHaveBeenCalledWith(['myplugin', 'keyword'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/spec/unpublish.spec.js
----------------------------------------------------------------------
diff --git a/spec/unpublish.spec.js b/spec/unpublish.spec.js
new file mode 100644
index 0000000..207804d
--- /dev/null
+++ b/spec/unpublish.spec.js
@@ -0,0 +1,13 @@
+var unpublish = require('../src/unpublish'),
+ config = require('../config'),
+ registry = require('plugman-registry');
+
+describe('unpublish', function() {
+ it('should unpublish a plugin', function() {
+ var sUse = spyOn(registry, 'use').andCallThrough();
+ var sUnpublish = spyOn(registry, 'unpublish');
+ unpublish(new Array('myplugin@0.0.1'));
+ expect(sUse).toHaveBeenCalledWith(config.registry, jasmine.any(Function));
+ expect(sUnpublish).toHaveBeenCalledWith(['myplugin@0.0.1'], jasmine.any(Function));
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/src/adduser.js
----------------------------------------------------------------------
diff --git a/src/adduser.js b/src/adduser.js
new file mode 100644
index 0000000..da7cf4e
--- /dev/null
+++ b/src/adduser.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function() {
+ registry.use(config.registry, function(err) {
+ registry.adduser(null, function(err) {
+ if(err) return console.log(err);
+ console.log('user added');
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/src/publish.js
----------------------------------------------------------------------
diff --git a/src/publish.js b/src/publish.js
new file mode 100644
index 0000000..234de15
--- /dev/null
+++ b/src/publish.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(plugin) {
+ registry.use(config.registry, function(err) {
+ registry.publish(plugin, function(err, d) {
+ if(err) return console.log('Error publishing plugin', err);
+ console.log('plugin published');
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/src/search.js
----------------------------------------------------------------------
diff --git a/src/search.js b/src/search.js
new file mode 100644
index 0000000..2b244b3
--- /dev/null
+++ b/src/search.js
@@ -0,0 +1,13 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(search_opts) {
+ registry.use(config.registry, function(err) {
+ registry.search(search_opts, function(err, plugins) {
+ if(err) return console.log(err);
+ for(var plugin in plugins) {
+ console.log(plugins[plugin].name, '-', plugins[plugin].description || 'no description provided');
+ }
+ });
+ });
+}
http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/57246a23/src/unpublish.js
----------------------------------------------------------------------
diff --git a/src/unpublish.js b/src/unpublish.js
new file mode 100644
index 0000000..072d740
--- /dev/null
+++ b/src/unpublish.js
@@ -0,0 +1,11 @@
+var registry = require('plugman-registry')
+ , config = require('../config');
+
+module.exports = function(plugin) {
+ registry.use(config.registry, function(err) {
+ registry.unpublish(plugin, function(err, d) {
+ if(err) return console.log('Error unpublishing plugin');
+ console.log('plugin unpublished');
+ });
+ });
+}