Skip to content

Commit

Permalink
Added js beautifier task to grunt
Browse files Browse the repository at this point in the history
  • Loading branch information
kachok committed Jul 14, 2014
1 parent 7fed570 commit 9ee0a96
Show file tree
Hide file tree
Showing 94 changed files with 9,894 additions and 10,224 deletions.
17 changes: 17 additions & 0 deletions .jsbeautifyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"jslint_happy": true,
"brace_style": "collapse",
"keep_array_indentation": false,
"keep_function_indentation": false,
"space_before_conditional": true,
"break_chained_methods": false,
"eval_code": false,
"unescape_strings": false,
"wrap_line_length": 0
}
209 changes: 114 additions & 95 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,74 +1,90 @@
/*global module*/

module.exports = function(grunt) {
module.exports = function (grunt) {

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-istanbul-coverage');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-istanbul-coverage');
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-jsbeautifier');

// Project configuration.
grunt.initConfig({
jshint: {
files: ['*.js', './lib/*.js', './test/*.js'],
options: {
browser: true,
smarttabs: true,
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: false,
boss: true,
eqnull: true,
node: true,
expr:true,
globals: {
'it': true,
'describe': true,
'before': true,
'after': true,
'done': true
}
}
},
watch: {
all: {
files: ['./lib/*.js', '*.js', './test/*.js'],
tasks: ['default']
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
timeout: '10000',
recursive:true
// Project configuration.
grunt.initConfig({
jshint: {
files: ['*.js', './lib/*.js', './test/*.js'],
options: {
browser: true,
smarttabs: true,
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: false,
boss: true,
eqnull: true,
node: true,
expr: true,
globals: {
'it': true,
'describe': true,
'before': true,
'after': true,
'done': true
}
}
},
watch: {
all: {
files: ['./lib/*.js', '*.js', './test/*.js'],
tasks: ['default']
}
},
jsbeautifier: {
beautify: {
src: ['Gruntfile.js', 'lib/*.js', 'lib/**/*.js', 'test/*.js', 'test/**/*.js'],
options: {
config: '.jsbeautifyrc'
}
},
check: {
src: ['Gruntfile.js', 'lib/*.js', 'lib/**/*.js', 'test/*.js', 'test/**/*.js'],
options: {
mode: 'VERIFY_ONLY',
config: '.jsbeautifyrc'
}
}
},
src: ['test/*.js', 'test/**/*.js'],
generator: ['test/test-generator.js']
}
},
coveralls: {
options: {
// LCOV coverage file relevant to every target
src: 'coverage/lcov.info',
mochaTest: {
test: {
options: {
reporter: 'spec',
timeout: '10000',
recursive: true
},
src: ['test/*.js', 'test/**/*.js'],
generator: ['test/test-generator.js']
}
},
coveralls: {
options: {
// LCOV coverage file relevant to every target
src: 'coverage/lcov.info',

// When true, grunt-coveralls will only print a warning rather than
// an error, to prevent CI builds from failing unnecessarily (e.g. if
// coveralls.io is down). Optional, defaults to false.
force: false
// When true, grunt-coveralls will only print a warning rather than
// an error, to prevent CI builds from failing unnecessarily (e.g. if
// coveralls.io is down). Optional, defaults to false.
force: false
},
//your_target: {
// Target-specific LCOV coverage file
//src: 'coverage-results/extra-results-*.info'
//},
},
//your_target: {
// Target-specific LCOV coverage file
//src: 'coverage-results/extra-results-*.info'
//},
},
coverage: {
coverage: {
options: {
thresholds: {
'statements': 50,
Expand All @@ -80,42 +96,45 @@ module.exports = function(grunt) {
root: '.'
}
}
});
});

// Default task.
grunt.registerTask('default', ['jshint', 'mochaTest']);
//Express omitted for travis build.
grunt.registerTask('commit', ['jshint', 'mochaTest']);
grunt.registerTask('mocha', ['mochaTest']);
grunt.registerTask('timestamp', function() {
grunt.log.subhead(Date());
});
// Default task.
grunt.registerTask('default', ['jshint', 'mochaTest']);
//Express omitted for travis build.
grunt.registerTask('commit', ['jshint', 'mochaTest']);
grunt.registerTask('mocha', ['mochaTest']);
grunt.registerTask('timestamp', function () {
grunt.log.subhead(Date());
});

// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:ccda_samples', 'mocha test --recursive --grep [ccda_samples]', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep ccda_samples', function (err, stdout) {
grunt.log.write(stdout);
done(err);
// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:ccda_samples', 'mocha test --recursive --grep [ccda_samples]', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep ccda_samples', function (err, stdout) {
grunt.log.write(stdout);
done(err);
});
});
});

// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:ccda', 'mocha test --recursive --grep ccda', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep ccda', function (err, stdout) {
grunt.log.write(stdout);
done(err);
// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:ccda', 'mocha test --recursive --grep ccda', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep ccda', function (err, stdout) {
grunt.log.write(stdout);
done(err);
});
});
});

// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:sections', 'mocha test --recursive --grep sections', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep sections', function (err, stdout) {
grunt.log.writeln(stdout);
done(err);
// Alias the `generator:ccda_samples` task to run `mocha test --recursive --grep generator` instead
grunt.registerTask('generator:sections', 'mocha test --recursive --grep sections', function () {
var done = this.async();
require('child_process').exec('mocha test --recursive --grep sections', function (err, stdout) {
grunt.log.writeln(stdout);
done(err);
});
});
});

};
//JS beautifier
grunt.registerTask('beautify', ['jsbeautifier:beautify']);

};
2 changes: 1 addition & 1 deletion lib/generator.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
//generation of CCDA from JSON (model) or some other machine-readable formats
//generation of CCDA from JSON (model) or some other machine-readable formats
Loading

0 comments on commit 9ee0a96

Please sign in to comment.