diff --git a/.eslintignore b/.eslintignore index 9bd8cc5..c224601 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,3 +1,4 @@ **/*{.,-}min.js node_modules/**/* data/**/* +test/data/**/* diff --git a/.eslintrc b/.eslintrc index 5a0c52e..48b1192 100644 --- a/.eslintrc +++ b/.eslintrc @@ -68,7 +68,7 @@ rules: no-labels: 2 no-lone-blocks: 2 no-loop-func: 2 - no-magic-numbers: [2,{"ignore": [0,1,-1]}] + no-magic-numbers: [2,{"ignore": [0,1,-1,2]}] no-multi-spaces: 2 no-multi-str: 2 no-native-reassign: 2 diff --git a/bootstrap/commands.js b/bootstrap/commands.js index c70cc9d..2834472 100644 --- a/bootstrap/commands.js +++ b/bootstrap/commands.js @@ -1,10 +1,11 @@ 'use strict'; /* global app,config,appdir*/ -var shell = require('../lib/shell'); + var each = require('lodash/each'); var includeAll = require('include-all'); var path = require('path'); require('.'); +var shell = require('../lib/shell'); global.app = new shell({ chdir: appdir + '/' }); diff --git a/bootstrap/database.js b/bootstrap/database.js index d85e7a5..e819463 100644 --- a/bootstrap/database.js +++ b/bootstrap/database.js @@ -6,6 +6,7 @@ var each = require('lodash/each'); var includeAll = require('include-all'); var setAssociation = function setAssociation(modelDef, modelName) { + /* istanbul ignore else*/ if (modelDef.associate !== null && typeof modelDef.associate === 'function') { modelDef.associate(); console.debug('associate ' + modelName); diff --git a/bootstrap/index.js b/bootstrap/index.js index 184309a..d00b5e4 100644 --- a/bootstrap/index.js +++ b/bootstrap/index.js @@ -3,22 +3,26 @@ var utils = require('../lib/utils'); var raven = require('raven'); global.logger = require('debug-logger'); -global.appdir = utils.workspace(); +/* istanbul ignore if */ +if (!global.appdir) { + global.appdir = utils.workspace(); +} global.config = require('./config')(); var console = logger(config.core.log.prefix + ':app'); logger.inspectOptions = { colors: true }; - +/* istanbul ignore else*/ if (config.app && config.app.debug) { - process.env.DEBUG = config.core.log.prefix + ':*'; + process.env.DEBUG = config.core.log.prefix + '*'; console.log('set env.debug to ' + config.core.log.prefix + '*'); } global.i18n = require('i18n'); i18n.configure(config.core.langs); - +// no need sentry in test +/* istanbul ignore if */ if (process.env.NODE_ENV !== "development" && typeof config.services !== "undefined" && typeof config.services.raven !== "undefined" diff --git a/lib/shell/index.js b/lib/shell/index.js index c2f0a70..237dd9d 100644 --- a/lib/shell/index.js +++ b/lib/shell/index.js @@ -2,11 +2,9 @@ // Core var Shell = module.exports = require('./lib/Shell'); Shell.styles = require('./lib/Styles'); -Shell.NullStream = require('./lib/NullStream'); // Plugins Shell.completer = require('./lib/plugins/completer'); -Shell.error = require('./lib/plugins/error'); Shell.help = require('./lib/plugins/help'); Shell.history = require('./lib/plugins/history'); Shell.router = require('./lib/plugins/router'); diff --git a/lib/shell/lib/Response.js b/lib/shell/lib/Response.js index 8d87396..d1d1665 100644 --- a/lib/shell/lib/Response.js +++ b/lib/shell/lib/Response.js @@ -1,15 +1,14 @@ 'use strict'; var styles = require('./Styles'); var pad = require('pad'); -var utils = require('../../utilsCmd'); - +var util = require('util'); var response = (function exportResponse(_super) { var Response = function Response(settings) { this.shell = settings.shell; - Response.__super__.constructor.call(this, settings); + Response.super_.call(this, settings); } - utils._extends(Response, _super); + util.inherits(Response, _super); Response.prototype.pad = pad; diff --git a/lib/shell/lib/routes/shellOnly.js b/lib/shell/lib/routes/shellOnly.js index 39e03af..cc4b8f7 100644 --- a/lib/shell/lib/routes/shellOnly.js +++ b/lib/shell/lib/routes/shellOnly.js @@ -1,5 +1,4 @@ 'use strict'; -// Generated by CoffeeScript 1.4.0 /* `routes.shellOnly` diff --git a/lib/utils.js b/lib/utils.js index 9339625..96c7b57 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -2,7 +2,7 @@ /* eslint global-require: 0 */ var fs = require('fs'); var path = require('path'); -var existsSync = fs.existsSync || path.existsSync; +var existsSync = fs.existsSync; module.exports = { workspace: function workspace() { diff --git a/lib/utilsCmd.js b/lib/utilsCmd.js index a9c5783..6922e15 100644 --- a/lib/utilsCmd.js +++ b/lib/utilsCmd.js @@ -30,23 +30,6 @@ module.exports = { each(result, function eachMessage(message) { res.green(message).ln(); }); - - }, - _extends: function extend(child, parent) { - var __hasProp = {}.hasOwnProperty; - for (var key in parent) { - if (__hasProp.call(parent, key)) { - child[key] = parent[key]; - } - } - - var ctor = function ctor() { - this.constructor = child; - } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); - child.__super__ = parent.prototype; - return child; } };