You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/06/19 16:00:23 UTC
git commit: CB-6973: Fix JSHint errors in plugman/registry/*
Repository: cordova-lib
Updated Branches:
refs/heads/master 5e4f8655c -> 8d1d70e27
CB-6973: Fix JSHint errors in plugman/registry/*
Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/8d1d70e2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/8d1d70e2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/8d1d70e2
Branch: refs/heads/master
Commit: 8d1d70e27506cfcafff73563595a245e8bdb0c33
Parents: 5e4f865
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Thu Jun 19 09:59:34 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Thu Jun 19 09:59:34 2014 -0400
----------------------------------------------------------------------
cordova-lib/src/plugman/registry/manifest.js | 9 +-
cordova-lib/src/plugman/registry/registry.js | 112 +++++++++++----------
cordova-lib/src/plugman/registry/whitelist.js | 7 +-
3 files changed, 72 insertions(+), 56 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8d1d70e2/cordova-lib/src/plugman/registry/manifest.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/manifest.js b/cordova-lib/src/plugman/registry/manifest.js
index 82e96ae..5306b0e 100644
--- a/cordova-lib/src/plugman/registry/manifest.js
+++ b/cordova-lib/src/plugman/registry/manifest.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
var xml_helpers = require('../../util/xml-helpers'),
path = require('path'),
Q = require('q'),
@@ -59,12 +64,12 @@ function generatePackageJsonFromPluginXml(plugin_path) {
issue = pluginElm.findtext('issue'),
engines = pluginElm.findall('engines/engine'),
platformsElm = pluginElm.findall('platform'),
- englishdoc = "",
+ englishdoc = '',
platforms = [];
platformsElm.forEach(function(plat){
platforms.push(plat.attrib.name);
- })
+ });
if(!version) throw new Error('`version` required');
package_json.version = version;
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8d1d70e2/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 dad89c3..c1a6c7c 100644
--- a/cordova-lib/src/plugman/registry/registry.js
+++ b/cordova-lib/src/plugman/registry/registry.js
@@ -16,19 +16,20 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc,
+ laxcomma:true
+*/
+
var npm = require('npm'),
path = require('path'),
- http = require('http'),
url = require('url'),
fs = require('fs'),
manifest = require('./manifest'),
- os = require('os'),
rc = require('rc'),
Q = require('q'),
request = require('request'),
- zlib = require('zlib'),
- tar = require('tar'),
- shell = require('shelljs'),
home = process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE,
plugmanConfigDir = path.resolve(home, '.plugman'),
plugmanCacheDir = path.resolve(plugmanConfigDir, 'cache');
@@ -43,7 +44,7 @@ module.exports = {
*/
config: function(args) {
return initSettings().then(function(settings) {
- return Q.ninvoke(npm, 'load', settings)
+ return Q.ninvoke(npm, 'load', settings);
})
.then(function() {
return Q.ninvoke(npm.commands, 'config', args);
@@ -69,7 +70,7 @@ module.exports = {
*/
adduser: function(args) {
return initSettings().then(function(settings) {
- return Q.ninvoke(npm, 'load', settings)
+ return Q.ninvoke(npm, 'load', settings);
})
.then(function() {
return Q.ninvoke(npm.commands, 'adduser', args);
@@ -91,7 +92,7 @@ module.exports = {
// With no --force we'll get a 409 (conflict) when trying to
// overwrite an existing package@version.
npm.config.set('force', true);
- return Q.ninvoke(npm.commands, 'publish', args)
+ return Q.ninvoke(npm.commands, 'publish', args);
}).fin(function() {
fs.unlink(path.resolve(args[0], 'package.json'));
});
@@ -132,7 +133,7 @@ module.exports = {
}).then(function() {
// npm.unpublish removes the cache for the unpublished package
// cleaning the entire cache might not be necessary.
- return Q.ninvoke(npm.commands, 'cache', ["clean"]);
+ return Q.ninvoke(npm.commands, 'cache', ['clean']);
});
},
@@ -180,7 +181,7 @@ module.exports = {
return info[version];
});
}
-}
+};
/**
* @method initSettings
@@ -189,7 +190,7 @@ module.exports = {
function initSettings() {
var settings = module.exports.settings;
// check if settings already set
- if(settings != null) return Q(settings);
+ if(settings !== null) return Q(settings);
// setting up settings
// obviously if settings dir does not exist settings is going to be empty
@@ -201,10 +202,10 @@ function initSettings() {
settings =
module.exports.settings =
rc('plugman', {
- cache: plugmanCacheDir,
- registry: 'http://registry.cordova.io',
- logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
- userconfig: path.resolve(plugmanConfigDir, 'config')
+ cache: plugmanCacheDir,
+ registry: 'http://registry.cordova.io',
+ logstream: fs.createWriteStream(path.resolve(plugmanConfigDir, 'plugman.log')),
+ userconfig: path.resolve(plugmanConfigDir, 'config')
});
return Q(settings);
}
@@ -226,7 +227,7 @@ function bumpCounter(info, client) {
client: client,
version: info.version
};
- var remote = settings.registry + '/downloads'
+ var remote = settings.registry + '/downloads';
makeRequest('POST', remote, message, function (err, res, body) {
// ignore errors
@@ -235,50 +236,55 @@ function bumpCounter(info, client) {
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 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 }
- , headers = opts.headers = {}
+ var strict = settings['strict-ssl'];
+ if (strict === undefined) strict = true;
+ var opts = { url: remote
+ , method: method
+ , ca: settings.ca
+ , strictSSL: strict
+ };
- headers.accept = "application/json"
+ var headers = opts.headers = {};
- headers["user-agent"] = settings['user-agent'] ||
- 'node/' + process.version
+ headers.accept = 'application/json';
- var p = settings.proxy
- var sp = settings['https-proxy'] || p
- opts.proxy = remote.protocol === "https:" ? sp : p
+ headers['user-agent'] = settings['user-agent'] ||
+ 'node/' + process.version;
- // 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 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)
+ var req = request(opts, cb);
- req.on("error", cb)
- req.on("socket", function (s) {
- s.on("error", cb)
- })
+ req.on('error', cb);
+ req.on('socket', function (s) {
+ s.on('error', cb);
+ });
- return req
+ return req;
}
http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/8d1d70e2/cordova-lib/src/plugman/registry/whitelist.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/registry/whitelist.js b/cordova-lib/src/plugman/registry/whitelist.js
index 007c448..7f2740b 100644
--- a/cordova-lib/src/plugman/registry/whitelist.js
+++ b/cordova-lib/src/plugman/registry/whitelist.js
@@ -16,6 +16,11 @@
specific language governing permissions and limitations
under the License.
*/
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+ indent:4, unused:vars, latedef:nofunc
+*/
+
module.exports = [
'org.apache.cordova.splashscreen',
'org.apache.cordova.network-information',
@@ -36,4 +41,4 @@ module.exports = [
'org.apache.cordova.device-motion',
'org.apache.cordova.battery-status',
'org.apache.cordova.statusbar'
-]
+];