You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2015/03/20 19:12:13 UTC
cordova-lib git commit: CB-8725 Fix plugin add from npm when
authenticated to CPR
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 <ag...@chromium.org>
Authored: Fri Mar 20 14:11:51 2015 -0400
Committer: Andrew Grieve <ag...@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