You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2015/10/20 00:20:28 UTC

cordova-lib git commit: CB-9824 removed plugin download counter code from lib

Repository: cordova-lib
Updated Branches:
  refs/heads/master b33dd04de -> 9d75a4257


CB-9824 removed plugin download counter code from lib


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

Branch: refs/heads/master
Commit: 9d75a4257c02bd033589362ba4c3d175b28fca45
Parents: b33dd04
Author: Steve Gill <st...@gmail.com>
Authored: Mon Oct 19 14:16:12 2015 -0700
Committer: Steve Gill <st...@gmail.com>
Committed: Mon Oct 19 14:17:43 2015 -0700

----------------------------------------------------------------------
 cordova-lib/src/plugman/registry/registry.js | 82 -----------------------
 1 file changed, 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/9d75a425/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 5624c4e..e5f22ce 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -21,11 +21,9 @@
 
 var npm = require('npm'),
     path = require('path'),
-    url = require('url'),
     fs = require('fs'),
     rc = require('rc'),
     Q = require('q'),
-    request = require('request'),
     npmhelper = require('../../util/npm-helper'),
     home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
     events = require('cordova-common').events,
@@ -171,84 +169,6 @@ function initThenLoadSettingsWithRestore(useEmptySettings, promises) {
     });
 }
 
-// Send a message to the registry to update download counts.
-function bumpCounter(info, client) {
-    // Update the download count for this plugin.
-    // Fingers crossed that the timestamps are unique, and that no plugin is downloaded
-    // twice in a single millisecond.
-    //
-    // This is acceptable, because the failure mode is Couch gracefully rejecting the second one
-    // (for lacking a _rev), and dropped a download count is not important.
-    var settings = module.exports.settings;
-    var now = new Date();
-    var message = {
-        day: now.getUTCFullYear() + '-' + (now.getUTCMonth()+1) + '-' + now.getUTCDate(),
-        pkg: info.name,
-        client: client,
-        version: info.version
-    };
-    var remote = settings.registry + '/downloads';
-
-    makeRequest('POST', remote, message, function (err, res, body) {
-        // ignore errors
-    });
-}
-
-
-function makeRequest (method, where, what, cb_) {
-    var settings = module.exports.settings;
-    var remote = url.parse(where);
-    if (typeof cb_ !== 'function') {
-        cb_ = what;
-        what = null;
-    }
-    var cbCalled = false;
-    function cb () {
-        if (cbCalled) return;
-        cbCalled = true;
-        cb_.apply(null, arguments);
-    }
-
-    var strict = settings['strict-ssl'];
-    if (strict === undefined) strict = true;
-    var opts = { url: remote
-               , method: method
-               , ca: settings.ca
-               , strictSSL: strict
-               };
-
-    var headers = opts.headers = {};
-
-    headers.accept = 'application/json';
-
-    headers['user-agent'] = settings['user-agent'] ||
-                            'node/' + process.version;
-
-    var p = settings.proxy;
-    var sp = settings['https-proxy'] || p;
-    opts.proxy = remote.protocol === 'https:' ? sp : p;
-
-    // figure out wth 'what' is
-    if (what) {
-        if (Buffer.isBuffer(what) || typeof what === 'string') {
-            opts.body = what;
-            headers['content-type'] = 'application/json';
-            headers['content-length'] = Buffer.byteLength(what);
-        } else {
-            opts.json = what;
-        }
-    }
-
-    var req = request(opts, cb);
-
-    req.on('error', cb);
-    req.on('socket', function (s) {
-        s.on('error', cb);
-    });
-
-    return req;
-}
-
 /**
 * @param {Array} with one element - the plugin id or "id@version"
 * @param useNpmRegistry: {Boolean} - to use the npm registry
@@ -267,8 +187,6 @@ function fetchPlugin(plugin, client, useNpmRegistry) {
         events.emit('log', 'Fetching plugin "' + plugin + '" via ' + registryName);
         return Q.ninvoke(npm.commands, 'cache', ['add', plugin])
         .then(function (info) {
-            var cl = (client === 'plugman' ? 'plugman' : 'cordova-cli');
-            bumpCounter(info, cl);
             var pluginDir = path.resolve(npm.cache, info.name, info.version, 'package');
             // Unpack the plugin that was added to the cache (CB-8154)
             var package_tgz = path.resolve(npm.cache, info.name, info.version, 'package.tgz');


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