-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
81 lines (73 loc) · 1.65 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
var gulp = require('gulp');
var del = require('del');
var coffee = require('gulp-coffee');
var bump = require('gulp-bump');
var mocha = require('gulp-mocha');
var register = require('coffee-script/register');
var git = require('gulp-git');
//
// Default "gulp"
//
gulp.task('default', ['test'] );
//
// Clean the lib folder
//
gulp.task('clean', function(done) {
del(["./lib"], done);
});
//
// Build the coffees into lib
//
gulp.task('build', ['clean'], function() {
return gulp
.src("./src/**/*.coffee")
.pipe(coffee({bare: true}).on('error', console.log))
.pipe(gulp.dest("./lib"));
});
//
// Watch and rerun tests on coffees
//
gulp.task('watch', ['test'], function() {
gulp.watch("./src/**/*.coffee", ['test']);
gulp.watch("./test/**/*.coffee", ['test']);
});
//
// Testing
//
gulp.task('test', ['build'], function () {
return gulp
.src('./test/**/*.coffee', {read: false})
.pipe(coffee({bare: true}))
.pipe(mocha({reporter: 'Spec'}))
.on('error', function(err){
console.log(err.toString());
this.emit('end');
});
});
//
// Version bumping
//
gulp.task('bump', function(){
gulp.src('./package.json')
.pipe(bump())
.pipe(gulp.dest('./'));
});
gulp.task('bump-minor', function(){
gulp.src('./package.json')
.pipe(bump({type:'minor'}))
.pipe(gulp.dest('./'));
});
gulp.task('bump-major', function(){
gulp.src('./package.json')
.pipe(bump({type:'major'}))
.pipe(gulp.dest('./'));
});
//
// Publishing
//
gulp.task('publish', ['build'], function(done){
var p = require('./package.json')
return gulp.src('./package.json')
.pipe( git.add() )
.pipe( git.commit('Bumped version to ' + p.version) );
});