No capitalize step

This commit is contained in:
Raul Ochoa 2015-03-16 00:21:55 +01:00
parent 336491b54c
commit 8c09dfd230
8 changed files with 41 additions and 41 deletions

View File

@ -14,7 +14,7 @@
"immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());` "immed" : true, // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
// "indent" : 4, // {int} Number of spaces to use for indentation // "indent" : 4, // {int} Number of spaces to use for indentation
// "latedef" : false, // true: Require variables/functions to be defined before being used // "latedef" : false, // true: Require variables/functions to be defined before being used
// "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()`
"noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee` "noarg" : true, // true: Prohibit use of `arguments.caller` and `arguments.callee`
// "noempty" : true, // true: Prohibit use of empty blocks // "noempty" : true, // true: Prohibit use of empty blocks
"nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters. "nonbsp" : true, // true: Prohibit "non-breaking whitespace" characters.

View File

@ -1,6 +1,6 @@
var sqlApi = require('../sql/sql_api'); var sqlApi = require('../sql/sql_api');
var PSQL = require('cartodb-psql'); var PSQL = require('cartodb-psql');
var Step = require('step'); var step = require('step');
function QueryTablesApi(pgConnection, metadataBackend) { function QueryTablesApi(pgConnection, metadataBackend) {
this.pgConnection = pgConnection; this.pgConnection = pgConnection;
@ -78,7 +78,7 @@ QueryTablesApi.prototype.runQuery = function(username, query, queryHandler, call
var params = {}; var params = {};
Step( step(
function setAuth() { function setAuth() {
self.pgConnection.setDBAuth(username, params, this); self.pgConnection.setDBAuth(username, params, this);
}, },
@ -109,7 +109,7 @@ QueryTablesApi.prototype.runQuery = function(username, query, queryHandler, call
} else { } else {
Step( step(
function getApiKey() { function getApiKey() {
self.metadataBackend.getUserMapKey(username, this); self.metadataBackend.getUserMapKey(username, this);
}, },

View File

@ -1,4 +1,4 @@
var Step = require('step'); var step = require('step');
var _ = require('underscore'); var _ = require('underscore');
function PgConnection(metadataBackend) { function PgConnection(metadataBackend) {
@ -24,7 +24,7 @@ PgConnection.prototype.setDBAuth = function(username, params, callback) {
var user_params = {}; var user_params = {};
var auth_user = global.environment.postgres_auth_user; var auth_user = global.environment.postgres_auth_user;
var auth_pass = global.environment.postgres_auth_pass; var auth_pass = global.environment.postgres_auth_pass;
Step( step(
function getId() { function getId() {
self.metadataBackend.getUserId(username, this); self.metadataBackend.getUserId(username, this);
}, },
@ -76,7 +76,7 @@ PgConnection.prototype.setDBConn = function(dbowner, params, callback) {
dbhost: global.environment.postgres.host, dbhost: global.environment.postgres.host,
dbport: global.environment.postgres.port dbport: global.environment.postgres.port
}); });
Step( step(
function getConnectionParams() { function getConnectionParams() {
self.metadataBackend.getUserDBConnectionParams(dbowner, this); self.metadataBackend.getUserDBConnectionParams(dbowner, this);
}, },

View File

@ -1,5 +1,5 @@
var _ = require('underscore'); var _ = require('underscore');
var Step = require('step'); var step = require('step');
var Windshaft = require('windshaft'); var Windshaft = require('windshaft');
var Cache = require('./cache_validator'); var Cache = require('./cache_validator');
var os = require('os'); var os = require('os');
@ -102,7 +102,7 @@ var CartodbWindshaft = function(serverOptions) {
} }
} }
var req = res.req; var req = res.req;
Step ( step (
function addCacheChannel() { function addCacheChannel() {
if ( ! req ) { if ( ! req ) {
// having no associated request can happen when // having no associated request can happen when
@ -172,7 +172,7 @@ var CartodbWindshaft = function(serverOptions) {
*/ */
ws.get(serverOptions.base_url + '/infowindow', function(req, res){ ws.get(serverOptions.base_url + '/infowindow', function(req, res){
ws.doCORS(res); ws.doCORS(res);
Step( step(
function(){ function(){
serverOptions.getInfowindow(req, this); serverOptions.getInfowindow(req, this);
}, },
@ -193,7 +193,7 @@ var CartodbWindshaft = function(serverOptions) {
*/ */
ws.get(serverOptions.base_url + '/map_metadata', function(req, res){ ws.get(serverOptions.base_url + '/map_metadata', function(req, res){
ws.doCORS(res); ws.doCORS(res);
Step( step(
function(){ function(){
serverOptions.getMapMetadata(req, this); serverOptions.getMapMetadata(req, this);
}, },

View File

@ -1,4 +1,4 @@
var Step = require('step'); var step = require('step');
var _ = require('underscore'); var _ = require('underscore');
function TemplateMapsController(app, serverOptions, templateMaps, metadataBackend, templateBaseUrl, surrogateKeysCache, function TemplateMapsController(app, serverOptions, templateMaps, metadataBackend, templateBaseUrl, surrogateKeysCache,
@ -35,7 +35,7 @@ TemplateMapsController.prototype.create = function(req, res) {
var cdbuser = self.serverOptions.userByReq(req); var cdbuser = self.serverOptions.userByReq(req);
Step( step(
function checkPerms(){ function checkPerms(){
self.serverOptions.authorizedByAPIKey(req, this); self.serverOptions.authorizedByAPIKey(req, this);
}, },
@ -83,7 +83,7 @@ TemplateMapsController.prototype.update = function(req, res) {
var cdbuser = this.serverOptions.userByReq(req); var cdbuser = this.serverOptions.userByReq(req);
var template; var template;
var tpl_id; var tpl_id;
Step( step(
function checkPerms(){ function checkPerms(){
self.serverOptions.authorizedByAPIKey(req, this); self.serverOptions.authorizedByAPIKey(req, this);
}, },
@ -142,7 +142,7 @@ TemplateMapsController.prototype.retrieve = function(req, res) {
var cdbuser = this.serverOptions.userByReq(req); var cdbuser = this.serverOptions.userByReq(req);
var tpl_id; var tpl_id;
Step( step(
function checkPerms(){ function checkPerms(){
self.serverOptions.authorizedByAPIKey(req, this); self.serverOptions.authorizedByAPIKey(req, this);
}, },
@ -203,7 +203,7 @@ TemplateMapsController.prototype.destroy = function(req, res) {
var cdbuser = this.serverOptions.userByReq(req); var cdbuser = this.serverOptions.userByReq(req);
var tpl_id; var tpl_id;
Step( step(
function checkPerms(){ function checkPerms(){
self.serverOptions.authorizedByAPIKey(req, this); self.serverOptions.authorizedByAPIKey(req, this);
}, },
@ -256,7 +256,7 @@ TemplateMapsController.prototype.list = function(req, res) {
var cdbuser = this.serverOptions.userByReq(req); var cdbuser = this.serverOptions.userByReq(req);
Step( step(
function checkPerms(){ function checkPerms(){
self.serverOptions.authorizedByAPIKey(req, this); self.serverOptions.authorizedByAPIKey(req, this);
}, },
@ -296,7 +296,7 @@ TemplateMapsController.prototype.instantiate = function(req, res) {
if ( req.profiler && req.profiler.statsd_client) { if ( req.profiler && req.profiler.statsd_client) {
req.profiler.start('windshaft-cartodb.instance_template_post'); req.profiler.start('windshaft-cartodb.instance_template_post');
} }
Step( step(
function() { function() {
if ( ! req.headers['content-type'] || req.headers['content-type'].split(';')[0] != 'application/json') { if ( ! req.headers['content-type'] || req.headers['content-type'].split(';')[0] != 'application/json') {
throw new Error('template POST data must be of type application/json, it is instead '); throw new Error('template POST data must be of type application/json, it is instead ');
@ -323,7 +323,7 @@ TemplateMapsController.prototype.jsonp = function(req, res) {
if ( req.profiler && req.profiler.statsd_client) { if ( req.profiler && req.profiler.statsd_client) {
req.profiler.start('windshaft-cartodb.instance_template_get'); req.profiler.start('windshaft-cartodb.instance_template_get');
} }
Step( step(
function() { function() {
if ( req.query.callback === undefined || req.query.callback.length === 0) { if ( req.query.callback === undefined || req.query.callback.length === 0) {
throw new Error('callback parameter should be present and be a function name'); throw new Error('callback parameter should be present and be a function name');
@ -367,7 +367,7 @@ TemplateMapsController.prototype.instantiateTemplate = function(req, res, templa
tpl_id = tpl_id[1]; tpl_id = tpl_id[1];
} }
var auth_token = req.query.auth_token; var auth_token = req.query.auth_token;
Step( step(
function getTemplate(){ function getTemplate(){
self.templateMaps.getTemplate(cdbuser, tpl_id, this); self.templateMaps.getTemplate(cdbuser, tpl_id, this);
}, },
@ -460,7 +460,7 @@ TemplateMapsController.prototype.finish_instantiation = function(err, response,
TemplateMapsController.prototype.setDBParams = function(cdbuser, params, callback) { TemplateMapsController.prototype.setDBParams = function(cdbuser, params, callback) {
var self = this; var self = this;
Step( step(
function setAuth() { function setAuth() {
self.pgConnection.setDBAuth(cdbuser, params, this); self.pgConnection.setDBAuth(cdbuser, params, this);
}, },

View File

@ -1,7 +1,7 @@
var dot = require('dot'); var dot = require('dot');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var Step = require('step'); var step = require('step');
function HealthCheck(metadataBackend, tilelive) { function HealthCheck(metadataBackend, tilelive) {
this.metadataBackend = metadataBackend; this.metadataBackend = metadataBackend;
@ -41,7 +41,7 @@ HealthCheck.prototype.check = function(config, callback) {
}; };
var mapnikXmlParams = config; var mapnikXmlParams = config;
Step( step(
function getDBParams() { function getDBParams() {
startTime = Date.now(); startTime = Date.now();
self.metadataBackend.getAllUserDBParams(config.username, this); self.metadataBackend.getAllUserDBParams(config.username, this);

View File

@ -1,5 +1,5 @@
var _ = require('underscore'); var _ = require('underscore');
var Step = require('step'); var step = require('step');
var QueryTablesApi = require('./api/query_tables_api'); var QueryTablesApi = require('./api/query_tables_api');
var PgConnection = require('./backends/pg_connection'); var PgConnection = require('./backends/pg_connection');
var crypto = require('crypto'); var crypto = require('crypto');
@ -147,7 +147,7 @@ module.exports = function(redisPool) {
var that = this; var that = this;
Step ( step (
function checkCached() { function checkCached() {
if ( me.channelCache.hasOwnProperty(cacheKey) ) { if ( me.channelCache.hasOwnProperty(cacheKey) ) {
callback(null, me.channelCache[cacheKey]); callback(null, me.channelCache[cacheKey]);
@ -167,7 +167,7 @@ module.exports = function(redisPool) {
} }
var next = this; var next = this;
var mapStore = app.mapStore; var mapStore = app.mapStore;
Step( step(
function loadFromStore() { function loadFromStore() {
mapStore.load(req.params.token, this); mapStore.load(req.params.token, this);
}, },
@ -333,7 +333,7 @@ module.exports = function(redisPool) {
var dbName = req.params.dbname; var dbName = req.params.dbname;
var cacheKey = dbName + ':' + token; var cacheKey = dbName + ':' + token;
Step( step(
function getAffectedTablesAndLastUpdatedTime() { function getAffectedTablesAndLastUpdatedTime() {
queryTablesApi.getAffectedTablesAndLastUpdatedTime(username, sql, this); queryTablesApi.getAffectedTablesAndLastUpdatedTime(username, sql, this);
}, },
@ -444,7 +444,7 @@ module.exports = function(redisPool) {
} }
//console.log("given ApiKey: " + givenKey); //console.log("given ApiKey: " + givenKey);
var user = me.userByReq(req); var user = me.userByReq(req);
Step( step(
function (){ function (){
cartoData.getUserMapKey(user, this); cartoData.getUserMapKey(user, this);
}, },
@ -468,7 +468,7 @@ module.exports = function(redisPool) {
var that = this; var that = this;
var user = me.userByReq(req); var user = me.userByReq(req);
Step( step(
function (){ function (){
that.authorizedByAPIKey(req, this); that.authorizedByAPIKey(req, this);
}, },
@ -618,7 +618,7 @@ module.exports = function(redisPool) {
if (req.profiler) req.profiler.done('req2params.setup'); if (req.profiler) req.profiler.done('req2params.setup');
Step( step(
function getPrivacy(){ function getPrivacy(){
me.authorize(req, this); me.authorize(req, this);
}, },
@ -671,7 +671,7 @@ module.exports = function(redisPool) {
var that = this; var that = this;
var user = me.userByReq(req); var user = me.userByReq(req);
Step( step(
function(){ function(){
// TODO: if this step really needed ? // TODO: if this step really needed ?
that.req2params(req, this); that.req2params(req, this);
@ -699,7 +699,7 @@ module.exports = function(redisPool) {
var that = this; var that = this;
var user = me.userByReq(req); var user = me.userByReq(req);
Step( step(
function(){ function(){
// TODO: if this step really needed ? // TODO: if this step really needed ?
that.req2params(req, this); that.req2params(req, this);

View File

@ -1,7 +1,7 @@
var crypto = require('crypto'), var crypto = require('crypto');
Step = require('step'), var step = require('step');
_ = require('underscore'), var _ = require('underscore');
dot = require('dot'); var dot = require('dot');
var EventEmitter = require('events').EventEmitter; var EventEmitter = require('events').EventEmitter;
@ -71,7 +71,7 @@ o._redisCmd = function(redisFunc, redisArgs, callback) {
var that = this; var that = this;
var db = that.db_signatures; var db = that.db_signatures;
Step( step(
function getRedisClient() { function getRedisClient() {
that.redis_pool.acquire(db, this); that.redis_pool.acquire(db, this);
}, },
@ -204,7 +204,7 @@ o.addTemplate = function(owner, template, callback) {
var userTemplatesKey = this.key_usr_tpl({ owner:owner }); var userTemplatesKey = this.key_usr_tpl({ owner:owner });
var limit = this._userTemplateLimit(); var limit = this._userTemplateLimit();
Step( step(
function checkLimit() { function checkLimit() {
if ( ! limit ) { if ( ! limit ) {
return 0; return 0;
@ -252,7 +252,7 @@ o.addTemplate = function(owner, template, callback) {
// //
o.delTemplate = function(owner, tpl_id, callback) { o.delTemplate = function(owner, tpl_id, callback) {
var self = this; var self = this;
Step( step(
function deleteTemplate() { function deleteTemplate() {
self._redisCmd('HDEL', [ self.key_usr_tpl({ owner:owner }), tpl_id ], this); self._redisCmd('HDEL', [ self.key_usr_tpl({ owner:owner }), tpl_id ], this);
}, },
@ -310,7 +310,7 @@ o.updTemplate = function(owner, tpl_id, template, callback) {
var userTemplatesKey = this.key_usr_tpl({ owner:owner }); var userTemplatesKey = this.key_usr_tpl({ owner:owner });
Step( step(
function getExistingTemplate() { function getExistingTemplate() {
self._redisCmd('HGET', [ userTemplatesKey, tpl_id ], this); self._redisCmd('HGET', [ userTemplatesKey, tpl_id ], this);
}, },
@ -365,7 +365,7 @@ o.listTemplates = function(owner, callback) {
// //
o.getTemplate = function(owner, tpl_id, callback) { o.getTemplate = function(owner, tpl_id, callback) {
var self = this; var self = this;
Step( step(
function getTemplate() { function getTemplate() {
self._redisCmd('HGET', [ self.key_usr_tpl({owner:owner}), tpl_id ], this); self._redisCmd('HGET', [ self.key_usr_tpl({owner:owner}), tpl_id ], this);
}, },