'use strict';

var gulp   = require('gulp');
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var mocha  = require('gulp-mocha');
var bump   = require('gulp-bump');

var paths = {
  lint: ['./gulpfile.js', './lib/**/*.js'],
  tests: './test/**/*.js',
};

gulp.task('lint', function () {
  return gulp.src(paths.lint)
    .pipe(jshint('.jshintrc'))
    .pipe(jscs())
    .pipe(jshint.reporter('jshint-stylish'));
});

gulp.task('mocha', function () {
  gulp.src(paths.tests)
    .pipe(mocha({ reporter: 'list' }));
});

gulp.task('bump', ['test'], function () {
  var bumpType = process.env.BUMP || 'patch'; // major.minor.patch

  return gulp.src(['./package.json'])
    .pipe(bump({ type: bumpType }))
    .pipe(gulp.dest('./'));
});

gulp.task('test', ['lint', 'mocha']);
gulp.task('release', ['bump']);

@@ -247,16 +247,17 @@
  tests: 
+%5B
 './test/
@@ -265,16 +265,40 @@
 */*.js',
+ '!test/%7Btemp,temp/**%7D'%5D
 %0A%7D;%0A%0Agul

exclude temp folder for globbing