@@ -11,6 +11,10 @@ var del = require('del');
1111var size = require ( 'gulp-filesize' ) ;
1212var usemin = require ( 'gulp-usemin' ) ;
1313var rev = require ( 'gulp-rev' ) ;
14+ var git = require ( 'gulp-git' ) ;
15+ var bump = require ( 'gulp-bump' ) ;
16+ var filter = require ( 'gulp-filter' ) ;
17+ var tag_version = require ( 'gulp-tag-version' ) ;
1418
1519gulp . task ( 'default' , [ 'build' , 'templates' ] , function ( ) {
1620
@@ -91,3 +95,37 @@ gulp.task('build',['templates'], function(){
9195 . pipe ( size ( ) )
9296 . pipe ( gulp . dest ( 'dist/' ) ) ;
9397} ) ;
98+
99+
100+ /**
101+ * Bumping version number and tagging the repository with it.
102+ * Please read http://semver.org/
103+ *
104+ * You can use the commands
105+ *
106+ * gulp patch # makes v0.1.0 → v0.1.1
107+ * gulp feature # makes v0.1.1 → v0.2.0
108+ * gulp release # makes v0.2.1 → v1.0.0
109+ *
110+ * To bump the version numbers accordingly after you did a patch,
111+ * introduced a feature or made a backwards-incompatible release.
112+ */
113+
114+ function inc ( importance ) {
115+ // get all the files to bump version in
116+ return gulp . src ( [ './manifest.json' , './package.json' , './bower.json' ] )
117+ // bump the version number in those files
118+ . pipe ( bump ( { type : importance } ) )
119+ // save it back to filesystem
120+ . pipe ( gulp . dest ( './' ) )
121+ // commit the changed version number
122+ . pipe ( git . commit ( 'bumps package version' ) )
123+ // read only one file to get the version number
124+ . pipe ( filter ( 'manifest.json' ) )
125+ // **tag it in the repository**
126+ . pipe ( tag_version ( ) ) ;
127+ }
128+
129+ gulp . task ( 'patch' , function ( ) { return inc ( 'patch' ) ; } )
130+ gulp . task ( 'feature' , function ( ) { return inc ( 'minor' ) ; } )
131+ gulp . task ( 'release' , function ( ) { return inc ( 'major' ) ; } )
0 commit comments