-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
50 lines (39 loc) · 1.15 KB
/
gulpfile.js
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
'use strict';
var gulp = require('gulp');
var del = require('del');
var coffeelint = require('gulp-coffeelint');
var coffee = require('gulp-coffee');
var karma = require('karma');
var path = require('path');
var configFile = path.resolve(__dirname, 'spec/karma.conf.js');
require('coffee-script/register');
var CI = process.env.CI === 'true';
var paths = {
coffee: ['./lib/**/*.coffee'],
watch: ['./gulpfile.js', './lib/**', './spec/**', '!spec/{temp,temp/**}'],
tests: ['./spec/**/*.coffee', '!spec/{temp,temp/**}']
};
gulp.task('lint', function () {
return gulp.src(paths.coffee)
.pipe(coffeelint())
.pipe(coffeelint.reporter());
});
gulp.task('watch', ['test'], function () {
gulp.watch(paths.watch, ['test']);
});
gulp.task('test', function (done) {
var server = new karma.Server({
configFile: configFile,
singleRun: true
}, done);
server.start();
});
gulp.task('clean', function(cb) {
del(['dist/**/*'], cb);
});
gulp.task('dist', ['clean'], function () {
return gulp.src(paths.coffee, {base: './lib'})
.pipe(coffee({bare: true})).on('error', console.log)
.pipe(gulp.dest('./dist'));
});
gulp.task('default', ['test']);