<commit_before>require('colors')

var path = require('path'),
    fs = require('fs'),
    shell = require('shelljs'),
    crypto = require('crypto'),
    os = require('os'),
    osenv = require('osenv'),
    run = require('child_process').exec,
    roots = require('../index'),
    config = require('../global_config');

var _new = function(args){
  if (args._.length < 2) {
    return roots.print.log('make sure to pass a name for your project!', 'red');
  }
  var name = args._[1];

  // get the correct template
  var template_name;
  for (var k in args){ if (k !== '_' && k !== '$0') { template_name = k; } }

  var source = get_template(template_name);
  if (source.error) return console.error('\n' + source.error.red + '\n');

  // copy the template into the current directory
  var destination = path.join(roots.project.rootDir, name);
  shell.cp('-r', source + '/*', destination);
  shell.cp('-r', source + '/.*', destination);

  // add current roots version to app.coffee
  var app_config_path = path.join(destination, 'app.coffee');
  fs.existsSync(app_config_path) && add_roots_version(app_config_path);

  // initialize git
  shell.exec("git init " + destination, { silent: true });

  // done!
  var tmpl_name = template_name || config.get('default_template');
  roots.print.log('\nnew project created at /' + name, 'green');
  roots.print.log('(using ' + tmpl_name + ' template)\n', 'grey')
};

module.exports = { execute: _new };

//
// @api private
//

function get_template(template_name){

  var templates = config.get('templates');
  var name = template_name ? template_name : config.get('default_template');<commit_msg>correct path in generator log<commit_after>require('colors')

var path = require('path'),
    fs = require('fs'),
    shell = require('shelljs'),
    crypto = require('crypto'),
    os = require('os'),
    osenv = require('osenv'),
    run = require('child_process').exec,
    roots = require('../index'),
    config = require('../global_config');

var _new = function(args){
  if (args._.length < 2) {
    return roots.print.log('make sure to pass a name for your project!', 'red');
  }
  var name = args._[1];

  // get the correct template
  var template_name;
  for (var k in args){ if (k !== '_' && k !== '$0') { template_name = k; } }

  var source = get_template(template_name);
  if (source.error) return console.error('\n' + source.error.red + '\n');

  // copy the template into the current directory
  var destination = path.join(roots.project.rootDir, name);
  shell.cp('-r', source + '/*', destination);
  shell.cp('-r', source + '/.*', destination);

  // add current roots version to app.coffee
  var app_config_path = path.join(destination, 'app.coffee');
  fs.existsSync(app_config_path) && add_roots_version(app_config_path);

  // initialize git
  shell.exec("git init " + destination, { silent: true });

  // done!
  var tmpl_name = template_name || config.get('default_template');
  roots.print.log('\nnew project created at ./' + name, 'green');
  roots.print.log('(using ' + tmpl_name + ' template)\n', 'grey')
};

module.exports = { execute: _new };

//
// @api private
//

function get_template(template_name){

  var templates = config.get('templates');
  var name = template_name ? template_name : config.get('default_template');
{'fraction_non_alphanumeric': 0.17561419472247497, 'fraction_numerical': 0.0018198362147406734, 'mean_word_length': 3.7385057471264367, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5282472', 'n_tokens_mistral': 1061, 'n_tokens_neox': 1038, 'n_words': 267}