Skip to content

Commit

Permalink
Added gulp-tag-version to easily manage semver
Browse files Browse the repository at this point in the history
  • Loading branch information
dotlouis committed Mar 3, 2015
1 parent 7dad173 commit 8a6aa48
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
38 changes: 38 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ var del = require('del');
var size = require('gulp-filesize');
var usemin = require('gulp-usemin');
var rev = require('gulp-rev');
var git = require('gulp-git');
var bump = require('gulp-bump');
var filter = require('gulp-filter');
var tag_version = require('gulp-tag-version');

gulp.task('default',['build', 'templates'], function(){

Expand Down Expand Up @@ -91,3 +95,37 @@ gulp.task('build',['templates'], function(){
.pipe(size())
.pipe(gulp.dest('dist/'));
});


/**
* Bumping version number and tagging the repository with it.
* Please read http://semver.org/
*
* You can use the commands
*
* gulp patch # makes v0.1.0 → v0.1.1
* gulp feature # makes v0.1.1 → v0.2.0
* gulp release # makes v0.2.1 → v1.0.0
*
* To bump the version numbers accordingly after you did a patch,
* introduced a feature or made a backwards-incompatible release.
*/

function inc(importance) {
// get all the files to bump version in
return gulp.src(['./manifest.json','./package.json', './bower.json'])
// bump the version number in those files
.pipe(bump({type: importance}))
// save it back to filesystem
.pipe(gulp.dest('./'))
// commit the changed version number
.pipe(git.commit('bumps package version'))
// read only one file to get the version number
.pipe(filter('manifest.json'))
// **tag it in the repository**
.pipe(tag_version());
}

gulp.task('patch', function() { return inc('patch'); })
gulp.task('feature', function() { return inc('minor'); })
gulp.task('release', function() { return inc('major'); })
3 changes: 1 addition & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"manifest_version": 2,

"name": "Cardboard - New Tab Page",
"author": "virtual-dev",
"description": "The default New Tab is not Google enough ? Try Cardboard, Now with more Material Design (plus nifty features)",
"version": "2.0.0",
"chrome_url_overrides" : {
"chrome_url_overrides": {
"newtab": "index.html"
},
"icons": {
Expand Down
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-htmlify": "^2.1.1",
"gulp-angular-templatecache": "^1.5.0",
"gulp-bump": "^0.2.2",
"gulp-concat": "^2.5.2",
"gulp-filesize": "0.0.6",
"gulp-filter": "^2.0.2",
"gulp-git": "^1.0.1",
"gulp-inject": "^1.2.0",
"gulp-minify-css": "^0.5.1",
"gulp-minify-html": "^1.0.0",
"gulp-ng-annotate": "^0.5.2",
"gulp-rev": "^3.0.1",
"gulp-tag-version": "^1.2.1",
"gulp-uglify": "^1.1.0",
"gulp-usemin": "^0.3.11"
}
Expand Down

0 comments on commit 8a6aa48

Please sign in to comment.