cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/2] git commit: adding registry dependency and wiring up commands
Date Fri, 14 Jun 2013 01:21:42 GMT
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/92584416
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugman/tree/92584416
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugman/diff/92584416

Branch: refs/heads/plugman-registry
Commit: 92584416a461ed3e27c5fe6f1042392db76a1c28
Parents: 69835c8
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Thu Jun 13 18:21:27 2013 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Thu Jun 13 18:21:27 2013 -0700

----------------------------------------------------------------------
 main.js      | 39 +++++++++++++++++++++++++++++++--------
 package.json |  3 ++-
 2 files changed, 33 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/92584416/main.js
----------------------------------------------------------------------
diff --git a/main.js b/main.js
index b4db738..a07f335 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
@@ -64,23 +64,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)) {
     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 = {}
@@ -105,5 +124,9 @@ function printUsage() {
     console.log('Install a plugin (will fetch if cannot be found):\n\t' + package.name +
' --platform <'+ platforms +'> --project <directory> --plugin <name|path|url>
[--www <directory>] [--plugins_dir <directory>] [--variable <name>=<value>]\n');
     console.log('Uninstall a plugin:\n\t' + package.name + ' --uninstall --platform <'+
platforms +'> --project <directory> --plugin <id> [--www <directory>]
[--plugins_dir <directory>]\n');
     console.log('\n\t--plugins_dir defaults to <project>/cordova/plugins, but can be
any directory containing a subdirectory for each plugin');
-    console.log('\n\t--www defaults to the project\'s www folder, but can be any directory
where web assets should be installed into');
+    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');
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/92584416/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 85c83c7..7631b7e 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"


Mime
View raw message