<commit_before>#!/usr/bin/env node
'use strict';
var fs = require('fs');
var path = require('path');
var nopt = require('nopt');
var chalk = require('chalk');
var pkg = require('../package.json');
var _ = require('lodash');
var updateNotifier = require('update-notifier');
var sudoBlock = require('sudo-block');
var isRoot = require('is-root');
var Insight = require('insight');
var yosay = require('yosay');
var stringLength = require('string-length');
var Router = require('./router');

var opts = nopt({
  help: Boolean,
  version: Boolean
});

var args = opts.argv.remain;
var cmd = args[0];

function rootCheck() {
  if (isRoot() && process.setuid) {
    try {
      // Try to force yo to run on a safe uid
      process.setuid(501);
    } catch (err) {}
  }

  /*jshint multistr:true */
  var msg = chalk.red('Easy with the "sudo"; Yeoman is the master around here.') + '\n\n\
Since yo is a user command, there is no need to execute it with superuser\n\
permissions. If you\'re having permission errors when using yo without sudo,\n\
please spend a few minutes learning more about how your system should work\n\
and make any necessary repairs.\n\n\
A quick solution would be to change where npm stores global packages by\n\
putting ~/npm/bin in your PATH and running:\n' + chalk.blue('npm config set prefix ~/npm') + '\n\n\
See: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md\
\n';

  sudoBlock(msg);
}

function pre() {
  if (opts.version) {
    console.log(pkg.version);
    return;
  }

  // debugging helper
  if (cmd === 'doctor') {
    require('yeoman-doctor').run();
    return;
  }

  // easteregg
  if (cmd === 'yeoman' || cmd === 'yo') {
    console.log(require('yeoman-character'));
    return;
  }

  init();
}

function init() {
  var env = require('yeoman-environment').createEnv();

  // alias any single namespace to `*:all` and `webapp` namespace specifically
  // to webapp:app.
  env.alias(/^([^:]+)$/, '$1:all');
  env.alias(/^([^:]+)$/, '$1:app');

  env.on('error', function (err) {
    console.error('Error', process.argv.slice(2).join(' '), '\n');
    console.error(opts.debug ? err.stack : err.message);
    process.exit(err.code || 1);
  });

  // lookup for every namespaces, within the environments.paths and lookups<commit_msg>remove env.alias for `app` as it's already defined in yeoman-environment<commit_after>#!/usr/bin/env node
'use strict';
var fs = require('fs');
var path = require('path');
var nopt = require('nopt');
var chalk = require('chalk');
var pkg = require('../package.json');
var _ = require('lodash');
var updateNotifier = require('update-notifier');
var sudoBlock = require('sudo-block');
var isRoot = require('is-root');
var Insight = require('insight');
var yosay = require('yosay');
var stringLength = require('string-length');
var Router = require('./router');

var opts = nopt({
  help: Boolean,
  version: Boolean
});

var args = opts.argv.remain;
var cmd = args[0];

function rootCheck() {
  if (isRoot() && process.setuid) {
    try {
      // Try to force yo to run on a safe uid
      process.setuid(501);
    } catch (err) {}
  }

  /*jshint multistr:true */
  var msg = chalk.red('Easy with the "sudo"; Yeoman is the master around here.') + '\n\n\
Since yo is a user command, there is no need to execute it with superuser\n\
permissions. If you\'re having permission errors when using yo without sudo,\n\
please spend a few minutes learning more about how your system should work\n\
and make any necessary repairs.\n\n\
A quick solution would be to change where npm stores global packages by\n\
putting ~/npm/bin in your PATH and running:\n' + chalk.blue('npm config set prefix ~/npm') + '\n\n\
See: https://github.com/sindresorhus/guides/blob/master/npm-global-without-sudo.md\
\n';

  sudoBlock(msg);
}

function pre() {
  if (opts.version) {
    console.log(pkg.version);
    return;
  }

  // debugging helper
  if (cmd === 'doctor') {
    require('yeoman-doctor').run();
    return;
  }

  // easteregg
  if (cmd === 'yeoman' || cmd === 'yo') {
    console.log(require('yeoman-character'));
    return;
  }

  init();
}

function init() {
  var env = require('yeoman-environment').createEnv();

  // DEPRECATED
  // TODO: remove in the future
  env.alias(/^([^:]+)$/, '$1:all');

  env.on('error', function (err) {
    console.error('Error', process.argv.slice(2).join(' '), '\n');
    console.error(opts.debug ? err.stack : err.message);
    process.exit(err.code || 1);
  });

  // lookup for every namespaces, within the environments.paths and lookups
{'fraction_non_alphanumeric': 0.17112768758227292, 'fraction_numerical': 0.003290917068889864, 'mean_word_length': 3.56813627254509, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '41800', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1474, 'n_words': 452}