forked from os-js/OS.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jscs now a part of testing (run npm install)
- Loading branch information
1 parent
8ce4e63
commit 96cfd00
Showing
3 changed files
with
93 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"disallowSpacesInNamedFunctionExpression": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"disallowSpacesInFunctionExpression": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"disallowSpacesInAnonymousFunctionExpression": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"disallowSpacesInFunctionDeclaration": { | ||
"beforeOpeningRoundBrace": true | ||
}, | ||
"disallowEmptyBlocks": true, | ||
"disallowSpacesInsideArrayBrackets": true, | ||
"disallowSpaceAfterPrefixUnaryOperators": true, | ||
"disallowSpaceBeforePostfixUnaryOperators": true, | ||
"disallowSpaceBeforeBinaryOperators": [ | ||
"," | ||
], | ||
"disallowMixedSpacesAndTabs": true, | ||
"disallowTrailingWhitespace": true, | ||
"disallowTrailingComma": true, | ||
"disallowYodaConditions": true, | ||
"disallowKeywords": [ "with" ], | ||
"disallowMultipleLineBreaks": true, | ||
"requireSpaceBeforeBlockStatements": true, | ||
"requireParenthesesAroundIIFE": true, | ||
"requireSpacesInConditionalExpression": true, | ||
"requireBlocksOnNewline": 1, | ||
"requireCommaBeforeLineBreak": true, | ||
"requireSpaceBeforeBinaryOperators": true, | ||
"requireSpaceAfterBinaryOperators": true, | ||
"requireLineFeedAtFileEnd": true, | ||
"requireCapitalizedConstructors": true, | ||
"requireCurlyBraces": [ | ||
"do" | ||
], | ||
"requireSpaceAfterKeywords": [ | ||
"if", | ||
"else", | ||
"for", | ||
"while", | ||
"do", | ||
"switch", | ||
"case", | ||
"return", | ||
"try", | ||
"catch", | ||
"typeof" | ||
], | ||
"safeContextKeyword": ["self", "_handlerInstance"], | ||
"validateLineBreaks": "LF", | ||
"validateQuoteMarks": "'", | ||
"validateIndentation": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,16 @@ | |
* | ||
* Copyright (c) 2011-2016, Anders Evenrud <[email protected]> | ||
* All rights reserved. | ||
* | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* list of conditions and the following disclaimer. | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
|
@@ -40,14 +40,27 @@ | |
|
||
try { | ||
require('time-grunt')(grunt); | ||
} catch ( e ) { } | ||
} catch (e) { } | ||
|
||
grunt.file.defaultEncoding = 'utf-8'; | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-mocha-test'); | ||
//grunt.loadNpmTasks('grunt-mocha'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-jscs'); | ||
|
||
var sourceFiles = [ | ||
'Gruntfile.js', | ||
'src/*.js', | ||
'src/client/javascript/*.js', | ||
'src/client/javascript/**/*.js', | ||
'src/packages/default/**/*.js', | ||
'!src/packages/default/Broadway/**', | ||
'!src/packages/default/**/locales.js', | ||
'!src/packages/default/**/locale.js', | ||
'!src/packages/default/Calculator/main.js' | ||
]; | ||
|
||
grunt.initConfig({ | ||
jshint: { | ||
|
@@ -81,22 +94,12 @@ | |
node: true, | ||
maxerr: 9999 | ||
}, | ||
all: [ | ||
'Gruntfile.js', | ||
'src/*.js', | ||
'src/client/javascript/*.js', | ||
'src/client/javascript/**/*.js', | ||
'src/packages/default/**/*.js', | ||
'!src/packages/default/Broadway/**', | ||
'!src/packages/default/**/locales.js', | ||
'!src/packages/default/**/locale.js', | ||
'!src/packages/default/Calculator/main.js' | ||
] | ||
all: sourceFiles | ||
}, | ||
mochaTest: { | ||
test: { | ||
src: ['test/server/*.js'] | ||
}, | ||
} | ||
}, | ||
watch: { | ||
core: { | ||
|
@@ -135,6 +138,15 @@ | |
], | ||
tasks: ['config', 'manifest'] | ||
} | ||
}, | ||
jscs: { | ||
src: sourceFiles, | ||
options: { | ||
config: '.jscsrc', | ||
verbose: true, | ||
fix: false, | ||
requireCurlyBraces: ['if'] | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -148,21 +160,21 @@ | |
* Task: Build config | ||
*/ | ||
grunt.registerTask('config', 'Build config files (or modify `set:path.to.key:value`, `get:path.to.key`, `preload:name:path:type`)', function(fn, key, value, arg) { | ||
if ( fn ) { | ||
if (fn) { | ||
var result; | ||
if ( fn === 'get' ) { | ||
if (fn === 'get') { | ||
grunt.log.writeln('Path: ' + key); | ||
|
||
result = _build.getConfigPath(grunt, key); | ||
grunt.log.writeln('Type: ' + typeof result); | ||
console.log(result); | ||
console.log(); | ||
} else if ( fn === 'set' ) { | ||
} else if (fn === 'set') { | ||
grunt.log.writeln('Path: ' + key); | ||
|
||
result = _build.setConfigPath(grunt, key, value); | ||
console.log(result); | ||
} else if ( fn === 'preload' ) { | ||
} else if (fn === 'preload') { | ||
result = _build.addPreload(grunt, key, value, arg); | ||
console.log(result); | ||
} else { | ||
|
@@ -295,7 +307,7 @@ | |
grunt.registerTask('default', ['all']); | ||
grunt.registerTask('dist', ['config', 'dist-index', 'core', 'themes', 'packages', 'manifest']); | ||
grunt.registerTask('dist-dev', ['config', 'dist-dev-index', 'themes:fonts', 'themes:styles', 'manifest']); | ||
grunt.registerTask('test', ['jshint', 'mochaTest'/*, 'mocha'*/]); | ||
grunt.registerTask('test', ['jshint', 'jscs', 'mochaTest'/*, 'mocha'*/]); | ||
}; | ||
|
||
})(require('node-fs-extra'), require('path'), require('./src/build.js'), require('grunt'), require('less')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters