2014-10-03 01:14:41 +08:00
|
|
|
/* jshint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
2016-03-14 09:46:29 +08:00
|
|
|
module.exports = function (grunt) {
|
2016-03-13 09:21:27 +08:00
|
|
|
|
|
|
|
require('load-grunt-tasks')(grunt);
|
|
|
|
|
2014-10-03 01:14:41 +08:00
|
|
|
// configure Grunt
|
|
|
|
grunt.initConfig({
|
2016-03-13 09:21:27 +08:00
|
|
|
|
2016-03-21 10:43:08 +08:00
|
|
|
watch: {
|
|
|
|
scripts: {
|
|
|
|
files: ['**/*.js', '**/*.jsx'],
|
|
|
|
tasks: ['force:jscs:check'],
|
|
|
|
options: {
|
|
|
|
event: ['all'],
|
2016-04-23 07:19:17 +08:00
|
|
|
spawn: true,
|
2016-03-21 10:43:08 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2016-03-13 09:21:27 +08:00
|
|
|
jscs: {
|
2016-03-14 08:12:01 +08:00
|
|
|
check: {
|
|
|
|
src: ['**/*.js', '**/*.jsx'],
|
|
|
|
options: {
|
|
|
|
config: '.jscsrc',
|
|
|
|
verbose: true,
|
|
|
|
esnext: true,
|
|
|
|
},
|
|
|
|
},
|
2016-04-23 07:19:17 +08:00
|
|
|
autofix: {
|
2016-03-14 08:12:01 +08:00
|
|
|
src: ['**/*.js', '**/*.jsx'],
|
|
|
|
options: {
|
|
|
|
config: '.jscsrc',
|
|
|
|
verbose: true,
|
|
|
|
esnext: true,
|
|
|
|
fix: true,
|
|
|
|
},
|
|
|
|
},
|
2016-03-13 09:21:27 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
shell: {
|
|
|
|
start_meteor: {
|
2016-03-14 09:46:29 +08:00
|
|
|
command: 'HOME=/usr/share/meteor JASMINE_SERVER_UNIT=0 JASMINE_SERVER_INTEGRATION=0 JASMINE_CLIENT_INTEGRATION=0 JASMINE_BROWSER=PhantomJS JASMINE_MIRROR_PORT=3000 ROOT_URL=http://127.0.0.1/html5client meteor',
|
|
|
|
},
|
|
|
|
},
|
2016-03-21 10:43:08 +08:00
|
|
|
|
|
|
|
concurrent: {
|
|
|
|
options: {
|
|
|
|
logConcurrentOutput: true,
|
|
|
|
limit: 3,
|
|
|
|
},
|
|
|
|
meteor_watch: {
|
2016-04-23 07:19:17 +08:00
|
|
|
tasks: ['shell:start_meteor', 'watch'],
|
2016-03-21 10:43:08 +08:00
|
|
|
},
|
2016-04-23 07:19:17 +08:00
|
|
|
},
|
2014-10-03 01:14:41 +08:00
|
|
|
});
|
|
|
|
|
2016-03-13 09:21:27 +08:00
|
|
|
grunt.loadNpmTasks('grunt-jscs');
|
|
|
|
grunt.loadNpmTasks('grunt-force-task');
|
2016-03-21 10:43:08 +08:00
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-shell');
|
|
|
|
grunt.loadNpmTasks('grunt-concurrent');
|
2014-10-03 01:14:41 +08:00
|
|
|
|
2016-03-13 09:21:27 +08:00
|
|
|
// sets the default task to run JSCS first (forcing our way past warnings) and then start Meteor:
|
2016-03-21 10:43:08 +08:00
|
|
|
grunt.registerTask('default', ['force:jscs:check', 'concurrent:meteor_watch']);
|
2016-03-14 08:12:01 +08:00
|
|
|
|
|
|
|
// sets the autofix task to fix JSCS warning when possible and then start Meteor:
|
2016-03-21 10:43:08 +08:00
|
|
|
grunt.registerTask('autofix', ['force:jscs:autofix', 'concurrent:meteor_watch']);
|
2014-10-03 01:14:41 +08:00
|
|
|
};
|