forked from TID-Lab/aggie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
60 lines (51 loc) · 1.58 KB
/
gulpfile.js
File metadata and controls
60 lines (51 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var glob = require('glob');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var browserify = require('gulp-browserify');
var watchify = require('gulp-watchify');
var plumber = require('gulp-plumber');
// Use --file=[filename] to run continuous tests on a file during development.
// Gulp will automatically run the tests on that file whenever the code changes
var testFile;
process.argv.forEach(function(arg) {
if (arg.substr(0, 6) == '--file') {
testFile = arg.split('=')[1];
}
});
var paths = {
js: ['lib/**/*.js', 'models/*.js'],
test: ['test/*.test.js']
};
gulp.task('lint', function() {
gulp.src(paths.js)
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('angular', function() {
gulp.src('public/angular/js/app.js')
.pipe(plumber())
.pipe(browserify())
.pipe(rename('app.min.js'))
.pipe(gulp.dest('public/angular/js'));
});
gulp.task('angular.watch', watchify(function(watchify) {
gulp.src('public/angular/js/app.js')
.pipe(plumber())
.pipe(watchify({ watching: true }))
.pipe(rename('app.min.js'))
.pipe(gulp.dest('public/angular/js'));
}));
gulp.task('test', function() {
// Prefer cli argument, default to all test files
gulp.src(testFile || paths.test)
.pipe(mocha({reporter: 'spec'}))
.on('error', function() {});
});
gulp.task('watch', function() {
gulp.watch(paths.js, ['lint', 'test']);
gulp.watch(paths.test, ['lint', 'test']);
});
gulp.task('default', ['lint', 'test', 'watch']);