<commit_before>var yeoman = require('yeoman-generator');
var pkg = require('./../../package.json');
var join = require('path').join;
var globby = require('globby');
var rimraf = require('rimraf');
var fs = require('fs');

function ifEmpty(errorMessage, val) {
  return val.length > 0 ? true : errorMessage;
}

function rm(paths) {
  paths.map(function map(item) {
    rimraf.sync(item);
  });
}

module.exports = yeoman.generators.Base.extend({
  prompting: function prompting() {
    var done = this.async();

    var prompts = [{
      name: 'underhoodName',
      message: 'underhood username:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide name'),
    }, {
      name: 'underhoodDesc',
      message: 'underhood description:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide description'),
    }, {
      name: 'underhoodSite',
      message: 'underhood site:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide site'),
    }, {
      name: 'githubUser',
      message: 'github user:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide github user'),
    }, {
      name: 'githubRepo',
      message: 'github repo:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide github repo'),
    }, {
      name: 'curatorEmail',
      message: 'curator email:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide email'),
    }, {
      name: 'curatorTwitter',
      message: 'curator twitter:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide twitter'),
    }];

    this.prompt(prompts, function prompt(props) {
      props.creatorTwitter = 'iamstarkov';
      props.creatorCreds = '<EMAIL> (<NAME>)';
      props.gauges = '56742cb6c88d9046da0016f5';
      props.underhoodVersion = pkg.version;

      this.props = props;
      done();
    }.bind(this));
  },

  writing: function writing() {
    var copy = function copy(from, to) {
      this.fs.copyTpl(this.templatePath(from), this.destinationPath(to), this.props);
    }.bind(this);

    globby(['*', '!node_modules', '!authors.js', '!.git', '!dump']).then(rm);
    globby(['dump/*-stats.json']).then(rm);

    fs.stat(this.destinationPath('authors.js'), function stat(err) {
      if (err) {
        copy('authors.js', 'authors.js');
      }
    });

    copy('underhoodrc.json', '.underhoodrc.json');
    copy('css', 'css');
    copy('js', 'js');
    copy('static/CNAME', 'static/CNAME');
    copy('static/nojekyll', 'static/.nojekyll');
    copy('dump', 'dump');
    copy('helpers', 'helpers');
    copy('layouts', 'layouts');
    copy('pages', 'pages');
    copy('editorconfig', '.editorconfig');<commit_msg>remove removing shit<commit_after>var yeoman = require('yeoman-generator');
var pkg = require('./../../package.json');
var join = require('path').join;
var globby = require('globby');
var rimraf = require('rimraf');
var fs = require('fs');

function ifEmpty(errorMessage, val) {
  return val.length > 0 ? true : errorMessage;
}

function rm(paths) {
  paths.map(function map(item) {
    rimraf.sync(item);
  });
}

module.exports = yeoman.generators.Base.extend({
  prompting: function prompting() {
    var done = this.async();

    var prompts = [{
      name: 'underhoodName',
      message: 'underhood username:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide name'),
    }, {
      name: 'underhoodDesc',
      message: 'underhood description:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide description'),
    }, {
      name: 'underhoodSite',
      message: 'underhood site:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide site'),
    }, {
      name: 'githubUser',
      message: 'github user:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide github user'),
    }, {
      name: 'githubRepo',
      message: 'github repo:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide github repo'),
    }, {
      name: 'curatorEmail',
      message: 'curator email:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide email'),
    }, {
      name: 'curatorTwitter',
      message: 'curator twitter:',
      store: true,
      validate: ifEmpty.bind(null, 'You have to provide twitter'),
    }];

    this.prompt(prompts, function prompt(props) {
      props.creatorTwitter = 'iamstarkov';
      props.creatorCreds = '<EMAIL> (<NAME>)';
      props.gauges = '56742cb6c88d9046da0016f5';
      props.underhoodVersion = pkg.version;

      this.props = props;
      done();
    }.bind(this));
  },

  writing: function writing() {
    var copy = function copy(from, to) {
      this.fs.copyTpl(this.templatePath(from), this.destinationPath(to), this.props);
    }.bind(this);

    fs.stat(this.destinationPath('authors.js'), function stat(err) {
      if (err) {
        copy('authors.js', 'authors.js');
      }
    });

    copy('underhoodrc.json', '.underhoodrc.json');
    copy('css', 'css');
    copy('js', 'js');
    copy('static/CNAME', 'static/CNAME');
    copy('static/nojekyll', 'static/.nojekyll');
    copy('dump', 'dump');
    copy('helpers', 'helpers');
    copy('layouts', 'layouts');
    copy('pages', 'pages');
    copy('editorconfig', '.editorconfig');
{'fraction_non_alphanumeric': 0.17168898809523808, 'fraction_numerical': 0.006696428571428571, 'mean_word_length': 3.0519969856819893, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '3589867', 'n_tokens_mistral': 1759, 'n_tokens_neox': 1695, 'n_words': 399}