forked from qrohlf/trianglify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.old
45 lines (39 loc) · 1.46 KB
/
gulpfile.old
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
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var mocha = require('gulp-mocha');
var git = require('gulp-git');
var bump = require('gulp-bump');
var filter = require('gulp-filter');
var tag_version = require('gulp-tag-version');
// Check source for syntax errors and style issues
gulp.task('jshint', function() {
return gulp.src('lib/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
// Run test suite
gulp.task('test', ['jshint'], function () {
return gulp.src('test/test.js', {read: false})
.pipe(mocha({reporter: 'spec'}));
});
function version_bump(type) {
// get all the files to bump version in
return gulp.src(['./package.json', './bower.json'])
// bump the version number in those files
.pipe(bump({type: type}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('bump package version'))
// read only one file to get the version number
.pipe(filter('package.json'))
// **tag it in the repository**
.pipe(tag_version());
}
gulp.task('patch', function() { return version_bump('patch'); });
gulp.task('feature', function() { return version_bump('minor'); });
gulp.task('release', function() { return version_bump('major'); });
gulp.task('default', ['jshint']);