Merge pull request #67 from strongloop/feature/infrastructure-cleanup

Infrastructure cleanup
This commit is contained in:
Miroslav Bajtoš 2014-11-13 16:09:10 +01:00
commit 08fcc5faa7
12 changed files with 80 additions and 56 deletions

24
.jscsrc Normal file
View File

@ -0,0 +1,24 @@
{
"preset": "google",
"requireCurlyBraces": [
"do",
"try",
"catch"
],
"disallowSpacesInsideObjectBrackets": null,
"requireSpaceAfterLineComment": true,
"maximumLineLength": {
"value": 80,
"allowRegex": true
},
"validateJSDoc": {
"checkParamNames": false,
"checkRedundantParams": false,
"requireParamTypes": true
},
"excludeFiles": [
"node_modules/**",
"coverage/**",
"test/sandbox/**"
]
}

View File

@ -1,24 +1,21 @@
{ {
"node": true, "node": true,
"browser": true, "browser": true,
"camelcase" : true,
"eqnull" : true, "eqnull" : true,
"indent": 2, "indent": 2,
"undef": true, "undef": true,
"unused": true, "unused": true,
"quotmark": "single", "quotmark": "single",
"maxlen": 80,
"trailing": true,
"newcap": true, "newcap": true,
"nonew": true, "nonew": true,
"sub": true, "sub": true,
"unused": "vars", "unused": "vars",
"globals": { "globals": {
"describe": true, "describe": false,
"it": true, "it": false,
"before": true, "before": false,
"beforeEach": true, "beforeEach": false,
"after": true, "after": false,
"afterEach": true "afterEach": false
} }
} }

View File

@ -136,7 +136,7 @@ exports.compileToBrowserify = function(options, bundler) {
addInstructionsToBrowserify(compile(options), bundler); addInstructionsToBrowserify(compile(options), bundler);
}; };
//-- undocumented low-level API --// /*-- undocumented low-level API --*/
exports.ConfigLoader = ConfigLoader; exports.ConfigLoader = ConfigLoader;
exports.compile = compile; exports.compile = compile;

View File

@ -309,7 +309,9 @@ function loadModelDefinition(rootDir, jsonFile, allFiles) {
var basename = path.basename(jsonFile, path.extname(jsonFile)); var basename = path.basename(jsonFile, path.extname(jsonFile));
// find a matching file with a supported extension like `.js` or `.coffee` // find a matching file with a supported extension like `.js` or `.coffee`
var base, ext, validFileType; var base;
var ext;
var validFileType;
var sourceFile = allFiles var sourceFile = allFiles
.filter(function(f) { .filter(function(f) {
ext = path.extname(f); ext = path.extname(f);

View File

@ -189,8 +189,8 @@ function hasCompatibleType(origValue, newValue) {
/** /**
* Try to read a config file with .json extension * Try to read a config file with .json extension
* @param cwd Dirname of the file * @param {string} cwd Dirname of the file
* @param fileName Name of the file without extension * @param {string} fileName Name of the file without extension
* @returns {Object|undefined} Content of the file, undefined if not found. * @returns {Object|undefined} Content of the file, undefined if not found.
*/ */
function tryReadJsonConfig(cwd, fileName) { function tryReadJsonConfig(cwd, fileName) {

View File

@ -69,7 +69,7 @@ function assertLoopBackVersion(app) {
} }
function setHost(app, instructions) { function setHost(app, instructions) {
//jshint camelcase:false // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var host = var host =
process.env.npm_config_host || process.env.npm_config_host ||
process.env.OPENSHIFT_SLS_IP || process.env.OPENSHIFT_SLS_IP ||
@ -86,7 +86,7 @@ function setHost(app, instructions) {
} }
function setPort(app, instructions) { function setPort(app, instructions) {
//jshint camelcase:false // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var port = _.find([ var port = _.find([
process.env.npm_config_port, process.env.npm_config_port,
process.env.OPENSHIFT_SLS_PORT, process.env.OPENSHIFT_SLS_PORT,

View File

@ -15,7 +15,7 @@
"main": "index.js", "main": "index.js",
"browser": "browser.js", "browser": "browser.js",
"scripts": { "scripts": {
"pretest": "jshint .", "pretest": "jscs . && jshint .",
"test": "mocha" "test": "mocha"
}, },
"license": { "license": {
@ -32,15 +32,15 @@
"underscore": "^1.6.0" "underscore": "^1.6.0"
}, },
"devDependencies": { "devDependencies": {
"browserify": "^6.1.0",
"fs-extra": "^0.12.0",
"browserify": "^4.1.8", "browserify": "^4.1.8",
"chai": "^1.10.0",
"coffee-script": "^1.8.0", "coffee-script": "^1.8.0",
"coffeeify": "^0.7.0", "coffeeify": "^0.7.0",
"fs-extra": "^0.12.0",
"jscs": "^1.7.3",
"jshint": "^2.5.6", "jshint": "^2.5.6",
"loopback": "^2.5.0", "loopback": "^2.5.0",
"mocha": "^1.19.0", "mocha": "^1.19.0",
"must": "^0.12.0",
"supertest": "^0.14.0" "supertest": "^0.14.0"
} }
} }

View File

@ -1,7 +1,7 @@
var boot = require('../'); var boot = require('../');
var fs = require('fs'); var fs = require('fs');
var path = require('path'); var path = require('path');
var expect = require('must'); var expect = require('chai').expect;
var browserify = require('browserify'); var browserify = require('browserify');
var sandbox = require('./helpers/sandbox'); var sandbox = require('./helpers/sandbox');
var vm = require('vm'); var vm = require('vm');

View File

@ -1,7 +1,7 @@
var boot = require('../'); var boot = require('../');
var fs = require('fs-extra'); var fs = require('fs-extra');
var path = require('path'); var path = require('path');
var expect = require('must'); var expect = require('chai').expect;
var sandbox = require('./helpers/sandbox'); var sandbox = require('./helpers/sandbox');
var appdir = require('./helpers/appdir'); var appdir = require('./helpers/appdir');
@ -12,7 +12,10 @@ describe('compiler', function() {
beforeEach(appdir.init); beforeEach(appdir.init);
describe('from options', function() { describe('from options', function() {
var options, instructions, appConfig; var options;
var instructions;
var appConfig;
beforeEach(function() { beforeEach(function() {
options = { options = {
config: { config: {

View File

@ -2,7 +2,7 @@ var boot = require('../');
var path = require('path'); var path = require('path');
var loopback = require('loopback'); var loopback = require('loopback');
var assert = require('assert'); var assert = require('assert');
var expect = require('must'); var expect = require('chai').expect;
var fs = require('fs-extra'); var fs = require('fs-extra');
var sandbox = require('./helpers/sandbox'); var sandbox = require('./helpers/sandbox');
var appdir = require('./helpers/appdir'); var appdir = require('./helpers/appdir');
@ -266,7 +266,7 @@ describe('executor', function() {
}); });
it('should prioritize sources', function() { it('should prioritize sources', function() {
/*jshint camelcase:false */ // jscs:disable requireCamelCaseOrUpperCaseIdentifiers
process.env.npm_config_host = randomHost(); process.env.npm_config_host = randomHost();
process.env.OPENSHIFT_SLS_IP = randomHost(); process.env.OPENSHIFT_SLS_IP = randomHost();
process.env.OPENSHIFT_NODEJS_IP = randomHost(); process.env.OPENSHIFT_NODEJS_IP = randomHost();
@ -328,7 +328,6 @@ describe('executor', function() {
}); });
}); });
function assertValidDataSource(dataSource) { function assertValidDataSource(dataSource) {
// has methods // has methods
assert.isFunc(dataSource, 'createModel'); assert.isFunc(dataSource, 'createModel');

View File

@ -2,4 +2,3 @@ process.bootFlags.push('barSyncLoaded');
module.exports = function(app) { module.exports = function(app) {
process.bootFlags.push('barSyncExecuted'); process.bootFlags.push('barSyncExecuted');
}; };