-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgulpfile.js
More file actions
57 lines (48 loc) · 1.36 KB
/
gulpfile.js
File metadata and controls
57 lines (48 loc) · 1.36 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
'use strict';
var pkg = require('./package.json'),
gulp = require('gulp'),
umd = require('gulp-umd'),
minify = require('gulp-minify'),
jshint = require('gulp-jshint'),
mocha = require('gulp-mocha'),
ghPages = require('gulp-gh-pages');
var path = {
scripts: 'src/*.js',
dist: 'dist/*.js',
test: 'test/NaiveBayesClassifier-test.js',
readme: 'README.md',
docs: './docs/NaiveBayesClassifier/' + pkg.version + '/**/*.*'
};
require('gulp-grunt')(gulp); // Require all grunt tasks, we need this because grunt-jsdoc is better than the gulp alternative
gulp.task('docs', function () {
gulp.start('grunt-jsdoc');
});
gulp.task('build', function() {
gulp.src(path.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(umd()) // Ship in 'regular module' UMD format: returnExports.js
.pipe(minify())
.pipe(gulp.dest('./dist/'));
});
gulp.task('test', function() {
gulp.start('build');
gulp.src(path.test)
.pipe(mocha({reporter: 'nyan'}));
});
gulp.task('default', function() {
gulp.start('build', 'test', 'docs');
});
gulp.task('deploy', function() {
return gulp.src(path.docs)
.pipe(ghPages({
force: true,
cacheDir: '.deploy'
}));
});
// Build, test and generate docs, every time we update the code
gulp.task('watch', function() {
gulp.watch(path.scripts, ['default']);
gulp.watch(path.readme, ['docs']);
gulp.watch(path.test, ['test']);
});