Skip to content

Commit

Permalink
Task runner and common dev tasks. Closes gh-118
Browse files Browse the repository at this point in the history
commit 4c5adb3059e1ae46ca9fe6a068042921e0d9c740
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Mon May 18 12:14:55 2015 -0400

    grunt-jsbeautifier -> jsbeautifier

commit 32e1db709052523a4b67d8bdbca9ab22c9f9d672
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Wed May 13 18:09:59 2015 -0400

    gruntfile.js: update default/test

commit 228997da6a9fb8d5d973930ab981ea976ef1877c
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Wed May 13 18:08:49 2015 -0400

    gruntfile.js: correct name of nodeunit task runner.

commit 7807df3e8350c37c455f286c8370223dcbce2ff7
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Wed May 13 17:49:35 2015 -0400

    grunt-jsbeautifier: fix options

commit 45c411a95c155c833ff810c1d219bc72bf3d693c
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Wed May 13 17:48:41 2015 -0400

    grunt-jsbeautifier: remove VERIFY_ONLY flag

commit b5cd6df349d7fbb91521e9ad8303c94852a85d5c
Author: Rick Waldron <waldron.rick@gmail.com>
Date:   Wed May 13 17:46:14 2015 -0400

    grunt, grunt-cli, basic code maintenance tasks.
  • Loading branch information
rwaldron committed May 18, 2015
1 parent 7e653b2 commit d84cd34
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 1 deletion.
29 changes: 29 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"disallowNewlineBeforeBlockStatements": true,
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceAfterKeywords": [
"if", "else",
"switch", "case",
"try", "catch",
"do", "while", "for",
"return", "typeof", "void"
],
"validateQuoteMarks": {
"mark": "'",
"escape": true
},
"excludeFiles": [
"node_modules/**/*.js"
]
}
24 changes: 24 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"loopfunc": true,
"laxcomma": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
"newcap": false,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"node": true,
"strict": false,
"esnext": true,
"unused": true,
"globals": {
"exports": true,
"document": true,
"Promise": true,
"copy": true
}
}
103 changes: 103 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
module.exports = function(grunt) {

// Project configuration.
grunt.initConfig({
nodeunit: {
tests: [
'test/unit/*.js'
]
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'bin/*',
'lib/**/*.js',
'test/**/*.js',
'Gruntfile.js',

// This is commented out because there are
// too many errors to address. I went through
// half of them and still:
//
// >> 75 errors in 3 files
//
// There are a lot of undefined vars being used
// and without fully understanding these files, it's
// not worth the effort to fix them all.
// 'resources/**/*.js',
]
},
jscs: {
all: [
'bin/*',
'lib/**/*.js',
'test/**/*.js',
'Gruntfile.js',
// 'resources/**/*.js',
],
options: {
config: '.jscsrc'
}
},
jsbeautifier: {
all: [
'bin/*',
'lib/**/*.js',
'test/**/*.js',
'Gruntfile.js',
// 'resources/**/*.js',
],
options: {
js: {
braceStyle: "collapse",
breakChainedMethods: false,
e4x: false,
evalCode: false,
indentChar: " ",
indentLevel: 0,
indentSize: 2,
indentWithTabs: false,
jslintHappy: false,
keepArrayIndentation: false,
keepFunctionIndentation: false,
maxPreserveNewlines: 10,
preserveNewlines: true,
spaceBeforeConditional: true,
spaceInParen: false,
unescapeStrings: false,
wrapLineLength: 0
}
}
},
watch: {
src: {
files: [
'Gruntfile.js',
'lib/**/!(johnny-five)*.js',
'test/**/*.js',
'eg/**/*.js'
],
tasks: ['default'],
options: {
interrupt: true,
},
}
}
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-jscs');
grunt.loadNpmTasks('grunt-jsbeautifier');


// 'npm test' runs these tasks
grunt.registerTask('test', ['jshint', 'jscs', 'jsbeautifier' /*, nodeunit*/]);

// Default task.
grunt.registerTask('default', ['test']);

};
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@
},
"homepage": "https://github.com/tessel/v2-cli",
"devDependencies": {
"debug": "^2.1.3"
"debug": "^2.1.3",
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-watch": "^0.6.1",
"grunt-jsbeautifier": "^0.2.10",
"grunt-jscs": "^1.8.0"
},
"dependencies": {
"async": "^0.9.0",
Expand Down
5 changes: 5 additions & 0 deletions test/unit/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TODO:

- write auto-mocks
- install sinon
- write units for existing functionality

0 comments on commit d84cd34

Please sign in to comment.