2014-01-06 12:33:44 -08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
2014-01-09 14:49:48 -08:00
|
|
|
|
|
|
|
//Load NPM tasks
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-mocha-test');
|
|
|
|
grunt.loadNpmTasks('grunt-nodemon');
|
|
|
|
grunt.loadNpmTasks('grunt-concurrent');
|
|
|
|
grunt.loadNpmTasks('grunt-env');
|
2014-02-10 12:33:54 -08:00
|
|
|
grunt.loadNpmTasks('grunt-markdown');
|
2014-01-09 14:49:48 -08:00
|
|
|
|
2014-01-06 12:54:32 -08:00
|
|
|
// Project Configuration
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
watch: {
|
2014-02-10 12:33:54 -08:00
|
|
|
readme: {
|
|
|
|
files: ['README.md'],
|
|
|
|
tasks: ['markdown']
|
|
|
|
},
|
2014-01-06 12:54:32 -08:00
|
|
|
js: {
|
2014-02-24 20:44:19 -08:00
|
|
|
files: ['Gruntfile.js', 'insight.js', 'app/**/*.js'],
|
2014-01-06 12:54:32 -08:00
|
|
|
tasks: ['jshint'],
|
|
|
|
options: {
|
|
|
|
livereload: true,
|
2014-01-06 12:33:44 -08:00
|
|
|
},
|
2014-01-09 14:49:48 -08:00
|
|
|
},
|
|
|
|
// we monitor only app/models/* because we have test for models only now
|
2014-01-13 12:21:42 -08:00
|
|
|
// test: {
|
|
|
|
// files: ['test/**/*.js', 'test/*.js','app/models/*.js'],
|
|
|
|
// tasks: ['test'],
|
|
|
|
// }
|
2014-01-06 12:54:32 -08:00
|
|
|
},
|
|
|
|
jshint: {
|
|
|
|
all: {
|
2014-02-26 07:05:30 -08:00
|
|
|
src: ['Gruntfile.js', 'insight.js', 'app/**/*.js', 'lib/*.js', 'config/*.js'],
|
2014-01-06 12:54:32 -08:00
|
|
|
options: {
|
|
|
|
jshintrc: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2014-01-07 11:49:42 -08:00
|
|
|
mochaTest: {
|
|
|
|
options: {
|
|
|
|
reporter: 'spec',
|
|
|
|
},
|
2014-01-09 14:49:48 -08:00
|
|
|
src: ['test/**/*.js'],
|
2014-01-07 11:49:42 -08:00
|
|
|
},
|
2014-01-06 12:54:32 -08:00
|
|
|
nodemon: {
|
|
|
|
dev: {
|
2014-01-21 16:01:47 -08:00
|
|
|
script: 'insight.js',
|
2014-01-06 12:54:32 -08:00
|
|
|
options: {
|
|
|
|
args: [],
|
2014-02-24 20:44:19 -08:00
|
|
|
ignore: ['test/**/*', 'util/**/*', 'dev-util/**/*'],
|
2014-01-09 14:49:48 -08:00
|
|
|
// nodeArgs: ['--debug'],
|
2014-01-06 12:54:32 -08:00
|
|
|
delayTime: 1,
|
|
|
|
env: {
|
|
|
|
PORT: 3000
|
|
|
|
},
|
|
|
|
cwd: __dirname
|
2014-01-06 12:33:44 -08:00
|
|
|
}
|
2014-01-06 12:54:32 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
concurrent: {
|
|
|
|
tasks: ['nodemon', 'watch'],
|
|
|
|
options: {
|
|
|
|
logConcurrentOutput: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
env: {
|
|
|
|
test: {
|
|
|
|
NODE_ENV: 'test'
|
|
|
|
}
|
2014-02-10 12:33:54 -08:00
|
|
|
},
|
|
|
|
markdown: {
|
|
|
|
all: {
|
|
|
|
files: [
|
|
|
|
{
|
|
|
|
expand: true,
|
|
|
|
src: 'README.md',
|
|
|
|
dest: '.',
|
|
|
|
ext: '.html'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2014-01-06 12:54:32 -08:00
|
|
|
}
|
|
|
|
});
|
2014-01-06 12:33:44 -08:00
|
|
|
|
2014-01-06 12:54:32 -08:00
|
|
|
//Making grunt default to force in order not to break the project.
|
|
|
|
grunt.option('force', true);
|
2014-01-06 12:33:44 -08:00
|
|
|
|
2014-01-06 12:54:32 -08:00
|
|
|
//Default task(s).
|
2014-02-24 20:44:19 -08:00
|
|
|
grunt.registerTask('default', ['jshint', 'concurrent']);
|
2014-02-10 14:04:26 -08:00
|
|
|
|
2014-01-06 13:38:30 -08:00
|
|
|
//Test task.
|
|
|
|
grunt.registerTask('test', ['env:test', 'mochaTest']);
|
2014-01-06 12:33:44 -08:00
|
|
|
};
|