{"size": 1284, "ext": "js", "max_stars_repo_path": "gulpfile.js", "max_stars_repo_name": "VandeurenGlenn/firebase-tools", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gulpfile.js", "max_issues_repo_name": "VandeurenGlenn/firebase-tools", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulpfile.js", "max_forks_repo_name": "VandeurenGlenn/firebase-tools", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 19.1641791045, "max_line_length": 57, "alphanum_fraction": 0.535046729}
/**************/
/*  REQUIRES  */
/**************/
var gulp = require('gulp');

// File I/O
var exit = require('gulp-exit');
var eslint = require('gulp-eslint');

// Testing
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');

var _ = require('lodash');

/****************/
/*  FILE PATHS  */
/****************/
var paths = {
  js: [
    'index.js',
    'lib/*.js',
    'commands/*.js'
  ],

  tests: [
    'test/**/*.spec.js'
  ]
};


/***********/
/*  TASKS  */
/***********/
// Lints the JavaScript files
gulp.task('lint', function() {
  var filesToLint = _.union(paths.js, paths.tests);
  return gulp.src(filesToLint)
    .pipe(eslint())
    .pipe(eslint.format())
    .pipe(eslint.failAfterError());
});

// Runs the Mocha test suite
gulp.task('test', function() {
  return gulp.src(paths.js)
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on('finish', function () {
      gulp.src(paths.tests)
        .pipe(mocha({
          reporter: 'spec',
          timeout: 5000
        }))
        .pipe(istanbul.writeReports())
        .pipe(exit());
    });
});

// Reruns the linter every time a JavaScript file changes
gulp.task('watch', function() {
  gulp.watch(paths.js, ['lint']);
});

// Default task
gulp.task('default', ['lint', 'test']);
