<commit_before>var gulp = require('gulp'),
    install = require('gulp-install'),
    conflict = require('gulp-conflict'),
    template = require('gulp-template'),
    rename = require('gulp-rename'),
    _ = require('underscore.string'),
    path = require('path'),
    chalk = require('chalk-log');

function createDomainFiles(type, filePath, answers) {
  var fileDestination = filePath + '/' + type;

  chalk.log('creating ' + type + ' domain files...' + fileDestination);
  gulp.src(__dirname + '/templates/' + type + '/**')
      .pipe(template(answers))
      .pipe(rename(function (file) {
      }))
      .pipe(conflict('./'))
      .pipe(gulp.dest('./' + fileDestination))
      .pipe(install())
      .on('end', function () {
          chalk.info('Remember:');
          chalk.log('git add .');
          done();
      });
}

function createRootDomainFiles(filePath, name, answers) {
  var fileDestination = filePath;

  chalk.log('creating root domain file ' + name + ' : ' + fileDestination);
  answers.type = name;
  gulp.src(__dirname + '/templates/_domain.cljs')
      .pipe(template(answers))
      .pipe(rename(function (file) {
          if (file.basename[0] === '_') {
              file.basename = name;
          }
      }))
      .pipe(conflict('./'))
      .pipe(gulp.dest('./' + fileDestination))
      .pipe(install())
      .on('end', function () {
          done();
      });
}

module.exports = function(answers) {
  answers.req = {};
  var domain = answers.domain;
  var domainTypes = answers.domainTypes;
  var namespace = answers.namespace;
  var files = answers.files;

  // Such as: src/cljs/app/todo
  var filePath = answers.location + '/' + answers.namespace + '/' + answers.domain;

  // build cljs require statements for insertion in domain root files
  for (file of files) {
    answers.req[file] = [];
    var temp = [];
    for (domainType of domainTypes) {
      temp.push('[' + namespace + '.' + domain + '.' + domainType + '.handlers]');
    }
    answers.req[file] = temp.join('\n            ')
  }

<commit_msg>fix async mutation error on answers<commit_after>var gulp = require('gulp'),
    install = require('gulp-install'),
    conflict = require('gulp-conflict'),
    template = require('gulp-template'),
    rename = require('gulp-rename'),
    _ = require('underscore.string'),
    path = require('path'),
    chalk = require('chalk-log');
    util = require('util');

function createDomainFiles(type, filePath, answers) {
  var fileDestination = filePath + '/' + type;

  chalk.log('creating ' + type + ' domain files...' + fileDestination);
  gulp.src(__dirname + '/templates/' + type + '/**')
      .pipe(template(answers))
      .pipe(rename(function (file) {
      }))
      .pipe(conflict('./'))
      .pipe(gulp.dest('./' + fileDestination))
      .pipe(install())
      .on('end', function () {
          chalk.info('Remember:');
          chalk.log('git add .');
          done();
      });
}

function createRootDomainFiles(filePath, name, answers) {
  var fileDestination = filePath;

  chalk.log('creating root domain file ' + name + ' : ' + fileDestination);
  var rootAnswers = Object.assign({}, answers);
  rootAnswers.type = name;

  chalk.log(util.inspect(rootAnswers));

  gulp.src(__dirname + '/templates/_domain.cljs')
      .pipe(template(rootAnswers))
      .pipe(rename(function (file) {
          if (file.basename[0] === '_') {
              file.basename = name;
          }
      }))
      .pipe(conflict('./'))
      .pipe(gulp.dest('./' + fileDestination))
      .pipe(install())
      .on('end', function () {
          done();
      });
}

module.exports = function(answers) {
  answers.req = {};
  var domain = answers.domain;
  var domainTypes = answers.domainTypes;
  var namespace = answers.namespace;
  var files = answers.files;

  // Such as: src/cljs/app/todo
  var filePath = answers.location + '/' + answers.namespace + '/' + answers.domain;

  // build cljs require statements for insertion in domain root files
  for (file of files) {
    answers.req[file] = [];
    var temp = [];
    for (domainType of domainTypes) {
      temp.push('[' + namespace + '.' + domain + '.' + domainType + '.' + file + ']');
    }
    answers.req[file] = temp.join('\n            ')
  }


{'fraction_non_alphanumeric': 0.17612570356472795, 'fraction_numerical': 0.00046904315196998124, 'mean_word_length': 2.6578044596912522, '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': '6485425', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1335, 'n_words': 266}