<commit_before>var gulp = require('gulp'),
        gutil = require('gulp-util'),
        coffee = require('gulp-coffee'),
        coffeelint = require('gulp-coffeelint'),
        sourcemaps = require('gulp-sourcemaps'),
        nodemon = require('gulp-nodemon'),
        concat = require('gulp-concat'),
        clean = require('gulp-clean'),
        runSequence = require('run-sequence'),
        _ = require('lodash'),
        mocha = require('gulp-mocha'),
        livereload = require('gulp-livereload');

var target = './dist';

var sources = {
  coffee: [
    {
      src: './*.coffee',
      target: target + '/'
    },
    {
      src: './plugins/**/*.coffee',
      target: target + '/plugins/'
    },
    {
      src: './routes/**/*.coffee',
      target: target + '/routes/'
    }
  ],
  static: [
    {
      src: './public/**/*.*',
      target: target + '/public'
    }
  ],
  tests: [
    {
      src: './test/**/*.coffee',
      target: './test/'
    }
  ]
};


gulp.task('develop', function () {
  process.env.NODE_ENV = 'develop';

  livereload.listen();
  nodemon({
    script: 'dist/server'
            //ext: 'js jade',
  }).on('restart', function () {
    setTimeout(function () {
      livereload.changed();
    }, 500);
  });
});

/**
 * Lint the files
 */
gulp.task('lint', function () {
  _.each(sources.coffee, function (path) {
    gulp.src(path.src)
      .pipe(coffeelint())
      .pipe(coffeelint.reporter());
  });
});

/**
 * Copy source files to dist
 */
gulp.task('src', function () {
  _.each(sources.static, function (path) {
    gulp.src(path.src)
      .pipe(gulp.dest(path.target));
  });
});

/**
 * Compile & lint the coffeescript files
 * AND add the app.js
 * AND mapp sourcefiles
 */
gulp.task('coffee', function () {

  _.each(sources.coffee, function (path) {
    gulp.src(path.src)
      .pipe(coffee())
      .pipe(gulp.dest(path.target));
  });

});

/**
 * Watch for changes
 */
gulp.task('watch', function () {
  gulp.watch(['./public/**/*.*'], ['src']);
  gulp.watch(['./routes/**/*.coffee','./plugins/**/*.coffee','./*.coffee'], ['lint', 'coffee']);
});

/**
 * Clean the dist folder
 */
gulp.task('clean', function () {
  gulp.src(['dist/**/*.*'], {read: false}).pipe(clean());
});

/**
 * Create the build task sequence chain
 */
gulp.task('build', function () {
  runSequence('clean', ['lint', 'src', 'coffee']);
});


/**
 * defualt `gulp`
 */
gulp.task('default', ['build', 'watch']);


gulp.task('test', function() {
  require('coffee-script/register');
  _.each(sources.tests, function(path){
    gulp.src(path.src, {read: false})
      .pipe(mocha({
          reporter: 'spec'
      }
      ));
  });
});<commit_msg>gulp clean separated, gulp now runs w/o race conditions<commit_after>var gulp = require('gulp'),
        gutil = require('gulp-util'),
        coffee = require('gulp-coffee'),
        coffeelint = require('gulp-coffeelint'),
        sourcemaps = require('gulp-sourcemaps'),
        nodemon = require('gulp-nodemon'),
        concat = require('gulp-concat'),
        clean = require('gulp-clean'),
        runSequence = require('run-sequence'),
        _ = require('lodash'),
        mocha = require('gulp-mocha'),
        livereload = require('gulp-livereload');

var target = './dist';

var sources = {
  coffee: [
    {
      src: './*.coffee',
      target: target + '/'
    },
    {
      src: './plugins/**/*.coffee',
      target: target + '/plugins/'
    },
    {
      src: './routes/**/*.coffee',
      target: target + '/routes/'
    }
  ],
  static: [
    {
      src: './public/**/*.*',
      target: target + '/public'
    }
  ],
  tests: [
    {
      src: './test/**/*.coffee',
      target: './test/'
    }
  ]
};



/**
 * Lint the files
 */
gulp.task('lint', function () {
  _.each(sources.coffee, function (path) {
    gulp.src(path.src)
      .pipe(coffeelint())
      .pipe(coffeelint.reporter());
  });
});

/**
 * Copy source files to dist
 */
gulp.task('src', function () {
  _.each(sources.static, function (path) {
    gulp.src(path.src)
      .pipe(gulp.dest(path.target));
  });
});

/**
 * Compile & lint the coffeescript files
 * AND add the app.js
 * AND mapp sourcefiles
 */
gulp.task('coffee',['lint'], function () {

  _.each(sources.coffee, function (path) {
    gulp.src(path.src)
      .pipe(coffee())
      .pipe(gulp.dest(path.target));
  });

});


/**
 * Clean the dist folder
 */
gulp.task('clean', function () {
  gulp.src(['dist/**/*.*'], {read: false}).pipe(clean());
});

/**
 * Create the build task sequence chain
 */
gulp.task('build', function () {
  runSequence('src', 'coffee');
});

/**
 * Watch for changes
 */
gulp.task('watch',['livereload'], function () {
  gulp.watch(['./public/**/*.*'], ['src']);
  gulp.watch(['./routes/**/*.coffee','./plugins/**/*.coffee','./*.coffee'], ['lint', 'coffee']);
});

gulp.task('livereload', ['build'], function () {
  process.env.NODE_ENV = 'develop';

  livereload.listen();
  nodemon({
    script: './dist/server'
            //ext: 'js jade',
  }).on('restart', function () {
    setTimeout(function () {
      livereload.changed();
    }, 500);
  });
});


gulp.task('test', function() {
  require('coffee-script/register');
  _.each(sources.tests, function(path){
    gulp.src(path.src, {read: false})
      .pipe(mocha({
          reporter: 'spec'
      }
      ));
  });
});


/**
 * defualt `gulp`
 */
gulp.task('default', ['watch'],function(){

});
{'fraction_non_alphanumeric': 0.22903998525889074, 'fraction_numerical': 0.001105583195135434, 'mean_word_length': 2.5201037613488975, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '444536', 'n_tokens_mistral': 1935, 'n_tokens_neox': 1880, 'n_words': 328}