cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject cordova-lib git commit: CB-8725 Fix plugin add from npm when authenticated to CPR
Date Fri, 20 Mar 2015 18:12:13 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/master 0c941529c -> e30801ad4


CB-8725 Fix plugin add from npm when authenticated to CPR


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

Branch: refs/heads/master
Commit: e30801ad45d00effc2ba5c5eda6308c61041eaa8
Parents: 0c94152
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Mar 20 14:11:51 2015 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Mar 20 14:11:51 2015 -0400

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 38 ++++++-----------------
 1 file changed, 9 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/e30801ad/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 d5ba965..e8e4dd8 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -189,7 +189,6 @@ module.exports = {
             return fetchPlugin(plugin, client, false);
         })
         .fail(function() {
-            module.exports.settings = null;
             return fetchPlugin(plugin, client, true);
         });
     },
@@ -224,18 +223,8 @@ module.exports = {
  * @param {Boolean} determines if we are using the npm registry
  * @return {Promise.<Object>} Promised settings.
  */
-function initSettings(useNpmRegistry) {
+function initSettings() {
     var settings = module.exports.settings;
-    var NPM_REG_URL = 'http://registry.npmjs.org';
-    var CPR_REG_URL = 'http://registry.cordova.io';
-    var registryURL;
-
-    //if useNpmRegistry is true, use npm registry
-    if(useNpmRegistry) {
-        registryURL = NPM_REG_URL;
-    } else {
-        registryURL = CPR_REG_URL;
-    }
 
     // check if settings already set
     if(settings !== null) return Q(settings);
@@ -251,19 +240,12 @@ function initSettings(useNpmRegistry) {
     module.exports.settings =
     rc('plugman', {
         cache: plugmanCacheDir,
-        registry: registryURL,
+        registry: 'http://registry.cordova.io',
         logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
         userconfig: path.resolve(plugmanConfigDir, 'config'),
         'cache-min': oneDay
     });
 
-    // if npm is true, use npm registry.
-    // ~/.plugman/config overides the above config if it exists.
-    // Need to reset the registry value in settings
-    if(useNpmRegistry) {
-        settings.registry = NPM_REG_URL;
-    }
-
     return Q(settings);
 }
 
@@ -358,15 +340,13 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
     } else {
         registryName = 'cordova plugins registry';
     }
-    return initSettings(useNpmRegistry)
-    .then(function (settings) {
-        return Q.nfcall(npm.load)
-        // configure npm here instead of passing parameters to npm.load due to CB-7670
-        .then(function () {
-            for (var prop in settings){
-                npm.config.set(prop, settings[prop]);
-            }
-        });
+
+    return initSettings().then(function(settings) {
+        // Don't use any option overrides for npm repo.
+        if (useNpmRegistry) {
+            settings = {};
+        }
+        return Q.ninvoke(npm, 'load', settings);
     })
     .then(function() {
         events.emit('log', 'Fetching plugin "' + plugin + '" via ' + registryName);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message