gulpfile.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. var mocha = require('gulp-mocha');
  24. var jshint = require('gulp-jshint');
  25. var eslint = require('gulp-eslint');
  26. var TEST = [ 'test/*.js' ];
  27. var LINT = [
  28. 'gulpfile.js',
  29. 'escodegen.js'
  30. ];
  31. var ESLINT_OPTION = {
  32. 'rulesdir': 'tools/rules/',
  33. 'rules': {
  34. 'push-with-multiple-arguments': 2,
  35. 'quotes': 0,
  36. 'eqeqeq': 0,
  37. 'no-use-before-define': 0,
  38. 'no-shadow': 0
  39. },
  40. 'env': {
  41. 'node': true
  42. }
  43. };
  44. gulp.task('test', function () {
  45. return gulp.src(TEST).pipe(mocha({ reporter: 'spec' }));
  46. });
  47. gulp.task('lint', function () {
  48. return gulp.src(LINT)
  49. .pipe(jshint('.jshintrc'))
  50. .pipe(jshint.reporter(require('jshint-stylish')))
  51. .pipe(jshint.reporter('fail'))
  52. .pipe(eslint(ESLINT_OPTION))
  53. .pipe(eslint.formatEach('compact', process.stderr));
  54. });
  55. gulp.task('travis', [ 'lint', 'test' ]);
  56. gulp.task('default', [ 'travis' ]);