<commit_before>var gulp = require('gulp'),
    _ = require('lodash'),
    browserify = require('browserify'),
    concat = require('gulp-concat'),
    del = require('del'),
    exec = require('child_process').exec,
    globby = require('globby'),
    gutil = require('gulp-util'),
    merge = require('merge-stream'),
    path = require('path'),
    Promise = require('bluebird'),
    push = require('couchdb-push'),
    sass = require('gulp-sass'),
    source = require('vinyl-source-stream'),
    stringify = require('stringify'),
    notify = require("gulp-notify"),
    notifier = require("node-notifier");

// Check for NODE_ENV; if doesn't exist, use 'personal'.
// Usage (BEFORE launching gulp): export NODE_ENV=somevalue
if (_.isEmpty(process.env.NODE_ENV)) {
    process.env.NODE_ENV = "personal";
}

// Must be loaded *after* NODE_ENV is set.
var config = require('config');

var settings = {
    source: path.resolve(config.get('source')),
    sourceWatch: config.get('sourceWatch'),
    destination: config.get('destination'),
    codeOutputPath: path.join(config.get('source'), '_attachments', 'code'),
    styleOutputPath: path.join(config.get('source'), '_attachments', 'style'),
    isDebug: false,
    libraryModules: config.get("libraryModules"),
    externalUIJSDev: config.get("externalUIJSDev"),
    externalUICSSDev: config.get("externalUICSSDev")
};

if (config.has("_docs")) {
    settings._docs = config.get("_docs");
}

// Setup globs for watching file changes.
settings.globs = {
    'code': 'app/code/**/*.js',
    'templates': 'app/code/**/*.html',
    'ui': path.join(config.get('source'), '_attachments') + '/**/*.html', 
    'couchdbViews': path.join(config.get('source'), 'views') + '/**/*.js', 
    'sass': 'app/styles/*.scss'
};
settings.globsAll = _.values(settings.globs);

/**
 * Helper function: bundle application code.
 **/
var appBundlerFn = function(isDebug) {
    // set up the browserify instance on a task basis
    var b = browserify({
        entries: 'app/code/main.js',
        debug: isDebug,
        transform: stringify({<commit_msg>Build when rewrites.json changes<commit_after>var gulp = require('gulp'),
    _ = require('lodash'),
    browserify = require('browserify'),
    concat = require('gulp-concat'),
    del = require('del'),
    exec = require('child_process').exec,
    globby = require('globby'),
    gutil = require('gulp-util'),
    merge = require('merge-stream'),
    path = require('path'),
    Promise = require('bluebird'),
    push = require('couchdb-push'),
    sass = require('gulp-sass'),
    source = require('vinyl-source-stream'),
    stringify = require('stringify'),
    notify = require("gulp-notify"),
    notifier = require("node-notifier");

// Check for NODE_ENV; if doesn't exist, use 'personal'.
// Usage (BEFORE launching gulp): export NODE_ENV=somevalue
if (_.isEmpty(process.env.NODE_ENV)) {
    process.env.NODE_ENV = "personal";
}

// Must be loaded *after* NODE_ENV is set.
var config = require('config');

var settings = {
    source: path.resolve(config.get('source')),
    sourceWatch: config.get('sourceWatch'),
    destination: config.get('destination'),
    codeOutputPath: path.join(config.get('source'), '_attachments', 'code'),
    styleOutputPath: path.join(config.get('source'), '_attachments', 'style'),
    isDebug: false,
    libraryModules: config.get("libraryModules"),
    externalUIJSDev: config.get("externalUIJSDev"),
    externalUICSSDev: config.get("externalUICSSDev")
};

if (config.has("_docs")) {
    settings._docs = config.get("_docs");
}

// Setup globs for watching file changes.
settings.globs = {
    'code': 'app/code/**/*.js',
    'templates': 'app/code/**/*.html',
    'ui': path.join(config.get('source'), '_attachments') + '/**/*.html', 
    'couchdbViews': path.join(config.get('source'), 'views') + '/**/*.js', 
    'couchdbSettings': [
        config.get('source') + '/rewrites.json'
    ],
    'sass': 'app/styles/*.scss'
};
settings.globsAll = _.flattenDeep(_.values(settings.globs));

/**
 * Helper function: bundle application code.
 **/
var appBundlerFn = function(isDebug) {
    // set up the browserify instance on a task basis
    var b = browserify({
        entries: 'app/code/main.js',
        debug: isDebug,
        transform: stringify({
{'fraction_non_alphanumeric': 0.18292113859076062, 'fraction_numerical': 0.0, 'mean_word_length': 3.855039637599094, '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': '5161682', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1355, 'n_words': 283}