<commit_before>var _ = require('lodash');
var gulp = require('gulp');
var ejs = require('gulp-ejs-precompiler');
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');
var del = require('del');
var SOURCE_DIR = 'src';
var OUTPUT_DIR = 'build';

gulp.task('scripts', function () { 
  return gulp.src(
    _.map(['util', 'calc', 'parser', 'jsgcalc', 'jsgui'], function (f) {
       return SOURCE_DIR + '/answer_generators/graphr/scripts/' + f + '.js'
    }))
  .pipe(concat('graphr.js'))
  .pipe(uglify())
  .pipe(gulp.dest(OUTPUT_DIR + '/answer_generators/graphr/scripts/'));
});

gulp.task('sass', function () {
  return gulp.src('src/**/*.scss')
  .pipe(sass({    
    style: 'compressed'
  }))
  .pipe(gulp.dest(OUTPUT_DIR));        
});

gulp.task('checkejs', function () {
  var s = gulp.src(SOURCE_DIR + '/**/*.ejs') 
    .pipe(plumber())
    .pipe(ejs({
      compileDebug: true,
      client: true
    }))
    .pipe(gulp.dest(OUTPUT_DIR + '/compiled_templates'));
});

gulp.task('clean', function(cb) {
  del([OUTPUT_DIR], cb);
});

gulp.task('build', ['sass', 'scripts']);


gulp.task('default', ['checkejs']);<commit_msg>Preprocess more answer generator modules and other plugin's JS files<commit_after>/*jslint node: true, continue: true, devel: true, evil: true, indent: 2, nomen: true, plusplus: true, regexp: true, sloppy: true, sub: true, unparam: true, vars: true, white: true */
var _ = require('lodash');
var gulp = require('gulp');
var ejs = require('gulp-ejs-precompiler');
var plumber = require('gulp-plumber');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sass = require('gulp-ruby-sass');
var del = require('del');
var SOURCE_DIR = 'src';
var OUTPUT_DIR = 'build';

var ANSWER_GENERATOR_MODULES = {
  calculator: {
    scripts: ['ideadeviate_calculator']  
  },  
  graphr : {
    scripts: ['util', 'calc', 'parser', 'jsgcalc', 'jsgui']    
  }
};

gulp.task('scripts', function () { 
  Object.keys(ANSWER_GENERATOR_MODULES).forEach(function (mod) {
    var descriptor = ANSWER_GENERATOR_MODULES[mod];
    return gulp.src(
      _.map(descriptor.scripts, function (f) {
         return SOURCE_DIR + '/answer_generators/' + mod + '/scripts/' + f + '.js';
      }))
    .pipe(concat(mod + '.js'))
    .pipe(uglify())
    .pipe(gulp.dest(OUTPUT_DIR + '/answer_generators/' + mod + '/scripts/'));    
  });

  return gulp.src(
    _.map(['content_recognizers', 'triggers'], function (pluginType) {
       return SOURCE_DIR + '/' + pluginType + '/*/*.js';
    }), {
      base: SOURCE_DIR    
    })      
  .pipe(uglify())
  .pipe(gulp.dest(OUTPUT_DIR));        
});

gulp.task('sass', function () {
  return gulp.src('src/answer_generators/**/*.scss')
  .pipe(sass({    
    style: 'compressed'
  }))
  .pipe(gulp.dest(OUTPUT_DIR + '/answer_generators/'));        
});

gulp.task('checkejs', function () {
  var s = gulp.src(SOURCE_DIR + '/**/*.ejs') 
    .pipe(plumber())
    .pipe(ejs({
      compileDebug: true,
      client: true
    }))
    .pipe(gulp.dest(OUTPUT_DIR + '/compiled_templates/'));
});

gulp.task('clean', function(cb) {
  del([OUTPUT_DIR], cb);
});

gulp.task('build', ['sass', 'scripts']);


gulp.task('default', ['checkejs']);
{'fraction_non_alphanumeric': 0.20474777448071216, 'fraction_numerical': 0.0002967359050445104, 'mean_word_length': 3.7146853146853145, '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': '3541251', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1222, 'n_words': 234}