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: CB-7234 added better outputs for plugin registry workflows
Date Fri, 05 Sep 2014 18:14:07 GMT
CB-7234 added better outputs for plugin registry workflows


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

Branch: refs/heads/master
Commit: 429292fd2ce1a2a5369a1bc06375199db124f800
Parents: f528fdd
Author: Steven Gill <stevengill97@gmail.com>
Authored: Mon Aug 4 15:36:05 2014 -0700
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Sep 5 11:12:17 2014 -0700

----------------------------------------------------------------------
 cordova-lib/src/plugman/plugman.js           | 17 ++++++++++++-----
 cordova-lib/src/plugman/registry/registry.js | 12 +++++++++---
 2 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/429292fd/cordova-lib/src/plugman/plugman.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/plugman.js b/cordova-lib/src/plugman/plugman.js
index 9e42382..5598628 100644
--- a/cordova-lib/src/plugman/plugman.js
+++ b/cordova-lib/src/plugman/plugman.js
@@ -178,9 +178,13 @@ plugman.commands =  {
         if(!plugin_path) {
             return console.log(plugman.help());
         }
-        plugman.publish(plugin_path, function(err) {
-            if (err) throw err;
-            else console.log('Plugin published');
+        plugman.publish(plugin_path, function(arg1, err) {
+            if (err) {
+                console.log('Error Code: '+err.code);
+                throw err;
+            } else {
+                console.log('Plugin published');
+            }
         });
     },
 
@@ -189,8 +193,11 @@ plugman.commands =  {
         if(!plugin) {
             return console.log(plugman.help());
         }
-        plugman.unpublish(plugin, function(err) {
-            if (err) throw err;
+        plugman.unpublish(plugin, function(arg1, err) {
+            if (err) {
+                console.log('Error Code: ' + err.code);
+                throw err;
+            }
             else console.log('Plugin unpublished');
         });
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/429292fd/cordova-lib/src/plugman/registry/registry.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/registry.js b/cordova-lib/src/plugman/registry/registry.js
index c1a6c7c..d74a572 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -31,6 +31,7 @@ var npm = require('npm'),
     Q = require('q'),
     request = require('request'),
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
+    events = require('../../events'),
     plugmanConfigDir = path.resolve(home, '.plugman'),
     plugmanCacheDir = path.resolve(plugmanConfigDir, 'cache');
 
@@ -91,10 +92,13 @@ module.exports = {
             }).then(function() {
                 // With  no --force we'll get a 409 (conflict) when trying to
                 // overwrite an existing package@version.
-                npm.config.set('force', true);
+                //npm.config.set('force', true);
+                events.emit('log', 'attempting to publish plugin to registry');
                 return Q.ninvoke(npm.commands, 'publish', args);
-            }).fin(function() {
+            }).then(function() {
                 fs.unlink(path.resolve(args[0], 'package.json'));
+            }).catch(function(err){
+                return err;
             });
         });
     },
@@ -125,10 +129,11 @@ module.exports = {
         }).then(function() {
             // --force is required to delete an entire plugin with all versions.
             // Without --force npm can only unpublish a specific version.
-            npm.config.set('force', true);
+            //npm.config.set('force', true);
             // Note, npm.unpublish does not report back errors (at least some)
             // e.g.: `unpublish non.existent.plugin`
             // will complete with no errors.
+            events.emit('log', 'attempting to unpublish plugin from registry');
             return Q.ninvoke(npm.commands, 'unpublish', args);
         }).then(function() {
             // npm.unpublish removes the cache for the unpublished package
@@ -177,6 +182,7 @@ module.exports = {
             // Plugin info should be accessed as info[version]. If a version
             // specifier like >=x.y.z was used when calling npm view, info
             // can contain several versions, but we take the first one here.
+            console.log(info);
             var version = Object.keys(info)[0];
             return info[version];
         });


Mime
View raw message