<commit_before>'use strict';

var chalk   = require('chalk');
var crypto  = require('crypto');
var fs      = require('fs-extra');
var path    = require('path');
var keygen  = require('ssh-keygen');
var latest  = require('github-latest');
var request = require('request');
var yeoman  = require('yeoman-generator');
var util    = require('util');

var WordpressGenerator = yeoman.generators.Base.extend({
  init: function() {
    this.pkg      = JSON.parse(this.readFileAsString(path.join(__dirname, '../../package.json')));
    this.prompts  = [];

    this.option('dev', {
      desc: 'Dev-mode for localized development of the generator',
      defaults: false,
    });

    this.on('end', function() {
      this.installDependencies({
        bower:        true,
        npm:          false,
        skipInstall:  this.options['skip-install'],
        skipMessage:  true,
        callback:     function() {
          this.log.write();
          this.log.ok('All done! Run ' + chalk.yellow('vagrant up') + ' to get started!');
        }.bind(this)
      });
    });

    this.sourceRoot(path.join(__dirname, 'templates'));
  },

  welcome: function() {
    var message = this.readFileAsString(path.join(__dirname, 'welcome.txt'));

    message = message.replace(/./g, function(match) {
      return /\w/.test(match) ? chalk.yellow(match) : chalk.cyan(match);
    });

    this.log.writeln(message);
  },

  checkDeps: function() {
    var done    = this.async();
    var deps    = ['sshpass', 'bundler', 'ansible', 'bower', 'npm'];
    var missing = [];
    var exited  = function(dependency, err) {
      deps.pop();

      if (err) { missing.push(dependency); }

      if (!deps.length) {
        if (missing.length) {
          err = new Error('Missing prerequisites');
          this.log.error('Could not find dependencies:' + chalk.red("\n\t- "+missing.join("\n\t- ")) );
        }
        done(err);
      }
    }

    this.log.info('Checking for installed prerequisites...');
    deps.forEach(function (dependency) {
      this.emit('dependencyCheck'+dependency);

      this
        .spawnCommand('command', ['-v', dependency], {cwd: process.cwd(), env: process.env})
        .on('error', exited.bind(this, dependency))
        .on('exit', this.emit.bind(this, 'dependencyCheck'+dependency+':end'))
        .on('exit', exited.bind(this, dependency))
      ;
    }.bind(this));
  },<commit_msg>Skip dep checking for CI environment<commit_after>'use strict';

var chalk   = require('chalk');
var crypto  = require('crypto');
var fs      = require('fs-extra');
var path    = require('path');
var keygen  = require('ssh-keygen');
var latest  = require('github-latest');
var request = require('request');
var yeoman  = require('yeoman-generator');
var util    = require('util');

var WordpressGenerator = yeoman.generators.Base.extend({
  init: function() {
    this.pkg      = JSON.parse(this.readFileAsString(path.join(__dirname, '../../package.json')));
    this.prompts  = [];

    this.option('dev', {
      desc: 'Dev-mode for localized development of the generator',
      defaults: false,
    });

    this.on('end', function() {
      this.installDependencies({
        bower:        true,
        npm:          false,
        skipInstall:  this.options['skip-install'],
        skipMessage:  true,
        callback:     function() {
          this.log.write();
          this.log.ok('All done! Run ' + chalk.yellow('vagrant up') + ' to get started!');
        }.bind(this)
      });
    });

    this.sourceRoot(path.join(__dirname, 'templates'));
  },

  welcome: function() {
    var message = this.readFileAsString(path.join(__dirname, 'welcome.txt'));

    message = message.replace(/./g, function(match) {
      return /\w/.test(match) ? chalk.yellow(match) : chalk.cyan(match);
    });

    this.log.writeln(message);
  },

  checkDeps: function() {
    if(process.env.CI) {
      return true;
    }

    var done    = this.async();
    var deps    = ['sshpass', 'bundler', 'ansible', 'bower', 'npm'];
    var missing = [];
    var exited  = function(dependency, err) {
      deps.pop();

      if (err) { missing.push(dependency); }

      if (!deps.length) {
        if (missing.length) {
          err = new Error('Missing prerequisites');
          this.log.error('Could not find dependencies:' + chalk.red("\n\t- "+missing.join("\n\t- ")) );
        }
        done(err);
      }
    }

    this.log.info('Checking for installed prerequisites...');
    deps.forEach(function (dependency) {
      this.emit('dependencyCheck'+dependency);

      this
        .spawnCommand('command', ['-v', dependency], {cwd: process.cwd(), env: process.env})
        .on('error', exited.bind(this, dependency))
        .on('exit', this.emit.bind(this, 'dependencyCheck'+dependency+':end'))
        .on('exit', exited.bind(this, dependency))
      ;
    }.bind(this));
  },
{'fraction_non_alphanumeric': 0.17684426229508196, 'fraction_numerical': 0.0, 'mean_word_length': 2.6534431137724552, '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': '1313546', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1480, 'n_words': 308}