2015-07-07 06:31:31 +08:00
|
|
|
/* File: gulpfile.js */
|
|
|
|
|
|
|
|
// grab our packages
|
2015-11-01 22:27:49 +08:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var jshint = require('gulp-jshint');
|
2015-07-07 06:31:31 +08:00
|
|
|
var nodemon = require('gulp-nodemon');
|
2015-11-01 22:27:49 +08:00
|
|
|
var mocha = require('gulp-mocha');
|
2015-11-02 08:42:12 +08:00
|
|
|
var exit = require('gulp-exit');
|
2015-07-07 06:31:31 +08:00
|
|
|
|
|
|
|
// define the default task and add the watch task to it
|
|
|
|
gulp.task('default', ['watch']);
|
|
|
|
|
|
|
|
// configure the jshint task
|
2015-11-01 22:27:49 +08:00
|
|
|
gulp.task('lint', function() {
|
2015-07-07 06:31:31 +08:00
|
|
|
return gulp.src('app/**/*.js')
|
|
|
|
.pipe(jshint())
|
|
|
|
.pipe(jshint.reporter('jshint-stylish'));
|
|
|
|
});
|
|
|
|
|
|
|
|
// configure which files to watch and what tasks to use on file changes
|
|
|
|
gulp.task('watch', function() {
|
|
|
|
gulp.watch('app/**/*.js', ['jshint']);
|
2015-07-28 06:50:20 +08:00
|
|
|
|
2015-07-07 06:31:31 +08:00
|
|
|
// Start up the server and have it reload when anything in the
|
|
|
|
// ./build/ directory changes
|
|
|
|
nodemon({script: 'server.js', watch: 'app/**'});
|
|
|
|
});
|
2015-11-01 22:27:49 +08:00
|
|
|
|
|
|
|
gulp.task('test', function() {
|
|
|
|
return gulp
|
|
|
|
.src('test/*.js')
|
2015-11-02 08:42:12 +08:00
|
|
|
.pipe(mocha())
|
|
|
|
.pipe(exit());
|
2015-11-01 22:27:49 +08:00
|
|
|
});
|
2015-11-02 08:42:12 +08:00
|
|
|
|