cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [02/50] git commit: adding registry dependency and wiring up commands
Date Sun, 28 Jul 2013 00:55:24 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/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 <anis.kadri@gmail.com>
Authored: Thu Jun 13 18:21:27 2013 -0700
Committer: Anis Kadri <anis@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"


Mime
View raw message