You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gulpfile.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. Copyright (C) 2014 Yusuke Suzuki <utatane.tea@gmail.com>
  3. Redistribution and use in source and binary forms, with or without
  4. modification, are permitted provided that the following conditions are met:
  5. * Redistributions of source code must retain the above copyright
  6. notice, this list of conditions and the following disclaimer.
  7. * Redistributions in binary form must reproduce the above copyright
  8. notice, this list of conditions and the following disclaimer in the
  9. documentation and/or other materials provided with the distribution.
  10. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
  11. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  12. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  13. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  14. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  15. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  16. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  18. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  19. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20. */
  21. 'use strict';
  22. var gulp = require('gulp'),
  23. git = require('gulp-git'),
  24. bump = require('gulp-bump'),
  25. filter = require('gulp-filter'),
  26. tagVersion = require('gulp-tag-version');
  27. var TEST = [ 'test/*.js' ];
  28. var POWERED = [ 'powered-test/*.js' ];
  29. var SOURCE = [ 'src/**/*.js' ];
  30. /**
  31. * Bumping version number and tagging the repository with it.
  32. * Please read http://semver.org/
  33. *
  34. * You can use the commands
  35. *
  36. * gulp patch # makes v0.1.0 -> v0.1.1
  37. * gulp feature # makes v0.1.1 -> v0.2.0
  38. * gulp release # makes v0.2.1 -> v1.0.0
  39. *
  40. * To bump the version numbers accordingly after you did a patch,
  41. * introduced a feature or made a backwards-incompatible release.
  42. */
  43. function inc(importance) {
  44. // get all the files to bump version in
  45. return gulp.src(['./package.json'])
  46. // bump the version number in those files
  47. .pipe(bump({type: importance}))
  48. // save it back to filesystem
  49. .pipe(gulp.dest('./'))
  50. // commit the changed version number
  51. .pipe(git.commit('Bumps package version'))
  52. // read only one file to get the version number
  53. .pipe(filter('package.json'))
  54. // **tag it in the repository**
  55. .pipe(tagVersion({
  56. prefix: ''
  57. }));
  58. }
  59. gulp.task('patch', [ ], function () { return inc('patch'); })
  60. gulp.task('minor', [ ], function () { return inc('minor'); })
  61. gulp.task('major', [ ], function () { return inc('major'); })