forked from allenhwkim/angular-jsdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
31 lines (29 loc) · 1.16 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
var gulp = require('gulp');
var bump = require('gulp-bump');
var shell = require('gulp-shell');
var tap = require('gulp-tap');
var gutil = require('gulp-util');
var bumpVersion = function(type) {
type = type || 'patch';
var version = '';
gulp.src(['./bower.json', './package.json'])
.pipe(bump({type: type}))
.pipe(gulp.dest('./'))
.pipe(tap(function(file, t) {
version = JSON.parse(file.contents.toString()).version;
})).on('end', function() {
var color = gutil.colors;
gulp.src('')
.pipe(shell([
'git commit --all --message "Version ' + version + '"',
(type != 'patch' ? 'git tag --annotate "v' + version + '" --message "Version ' + version + '"' : 'true')
], {ignoreErrors: false}))
.pipe(tap(function() {
gutil.log(color.green("Version bumped to ") + color.yellow(version) + color.green(", don't forget to push!"));
}));
});
};
gulp.task('bump', function() { bumpVersion('patch'); });
gulp.task('bump:patch', function() { bumpVersion('patch'); });
gulp.task('bump:minor', function() { bumpVersion('minor'); });
gulp.task('bump:major', function() { bumpVersion('major'); });