<commit_before>'use strict';

var _ = require('lodash');
var fs = require('fs');
var path = require('path');
var inquirer = require('inquirer');
var exec = require('child_process').exec;

module.exports = function(folder) {
  inquirer.prompt([
    {
      name: 'name',
      message: 'What is the bundle name?',
      default: function() {
        return folder || path.basename(process.cwd());
      },
      validate: function(value) {
        return value.trim().length > 0 || 'Please enter a name for this bundle';
      }
    },
    {
      name: 'username',
      message: 'What is your GitHub username?',
      default: function() {
        var done = this.async();

        exec('git config --global user.name', function(error, stdout) {
          done(error ? '' : stdout.trim());
        });
      },
      validate: function(value) {
        return value.trim().length > 0 || 'Please enter your GitHub username';
      }
    }
  ], function(answers) {
    var pkg = asset('package.json')
      .replace(/\$name\$/g, _.kebabCase(answers.name))
      .replace(/\$username\$/g, answers.username);
    var readme = asset('README.md')
      .replace(/\$name\$/g, _.kebabCase(answers.name));
    var index = asset('index.js')
      .replace(/\$name\$/g, _.camelCase(answers.name));
    var components = asset('components.js')
      .replace(/\$name\$/g, _.camelCase(answers.name));
    var properties = asset('properties.js')
      .replace(/\$name\$/g, _.camelCase(answers.name));
    var states = asset('states.js')
      .replace(/\$name\$/g, _.camelCase(answers.name));

    if (folder) {
      fs.mkdirSync(folder);
      process.chdir(folder);
    }

    copy('../../.editorconfig', '.editorconfig');
    copy('../../.gitignore', '.gitignore');
    copy('../../.jscsrc', '.jscsrc');
    copy('../../.jshintrc', '.jshintrc');

    write('package.json', pkg);
    write('README.md', readme);

    fs.mkdirSync('lib');
    fs.mkdirSync('lib/components');
    fs.mkdirSync('lib/properties');
    fs.mkdirSync('lib/states');
    fs.mkdirSync('test');
    fs.mkdirSync('test/components');
    fs.mkdirSync('test/properties');
    fs.mkdirSync('test/states');

    copy('../../test/.jshintrc', 'test/.jshintrc');

    write('lib/index.js', index);

    console.log('New bundle "tinto-' + _.kebabCase(answers.name) + '" created');
  });

  function copy(source, destination) {
    write(destination, read(path.join(__dirname, source)));
  }

  function asset(filename) {
    return read(path.join(__dirname, 'assets', filename));
  }

  function read(filename) {
    return fs.readFileSync(filename, {
      encoding: 'utf8'
    });
  }

  function write(filename, data) {
    fs.writeFileSync(filename, data);
  }
};
<commit_msg>fixed bundle command<commit_after>'use strict';

var _ = require('lodash');
var fs = require('fs');
var path = require('path');
var inquirer = require('inquirer');
var exec = require('child_process').exec;

module.exports = function(folder) {
  inquirer.prompt([
    {
      name: 'name',
      message: 'What is the bundle name?',
      default: function() {
        return folder || path.basename(process.cwd());
      },
      validate: function(value) {
        return value.trim().length > 0 || 'Please enter a name for this bundle';
      }
    },
    {
      name: 'username',
      message: 'What is your GitHub username?',
      default: function() {
        var done = this.async();

        exec('git config --global user.name', function(error, stdout) {
          done(error ? '' : stdout.trim());
        });
      },
      validate: function(value) {
        return value.trim().length > 0 || 'Please enter your GitHub username';
      }
    }
  ], function(answers) {
    var pkg = asset('package.json')
      .replace(/\$name\$/g, _.kebabCase(answers.name))
      .replace(/\$username\$/g, answers.username);
    var readme = asset('README.md')
      .replace(/\$name\$/g, _.kebabCase(answers.name));
    var index = asset('index.js')
      .replace(/\$name\$/g, _.camelCase(answers.name));

    if (folder) {
      fs.mkdirSync(folder);
      process.chdir(folder);
    }

    copy('../../.editorconfig', '.editorconfig');
    copy('../../.gitignore', '.gitignore');
    copy('../../.jscsrc', '.jscsrc');
    copy('../../.jshintrc', '.jshintrc');

    write('package.json', pkg);
    write('README.md', readme);

    fs.mkdirSync('lib');
    fs.mkdirSync('lib/components');
    fs.mkdirSync('lib/properties');
    fs.mkdirSync('lib/states');
    fs.mkdirSync('test');
    fs.mkdirSync('test/components');
    fs.mkdirSync('test/properties');
    fs.mkdirSync('test/states');

    copy('../../test/.jshintrc', 'test/.jshintrc');

    write('lib/index.js', index);

    console.log('New bundle "tinto-' + _.kebabCase(answers.name) + '" created');
  });

  function copy(source, destination) {
    write(destination, read(path.join(__dirname, source)));
  }

  function asset(filename) {
    return read(path.join(__dirname, 'assets', filename));
  }

  function read(filename) {
    return fs.readFileSync(filename, {
      encoding: 'utf8'
    });
  }

  function write(filename, data) {
    fs.writeFileSync(filename, data);
  }
};

{'fraction_non_alphanumeric': 0.19428902180204516, 'fraction_numerical': 0.0011576307158016593, 'mean_word_length': 2.7811816192560177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4591713', 'n_tokens_mistral': 1732, 'n_tokens_neox': 1639, 'n_words': 315}