<commit_before>'use strict';

require('chalk');

var yeoman = require('yeoman-generator');
var path = require('path');
var glob = require('glob');
var util = require('util');
var rimraf = require('rimraf');
var async = require('async');
var objectAssign = require('object-assign');
var validateNpmPackageName = require('validate-npm-package-name');
var gitConfig = require('git-config');
var githubApi = require('octonode');
var updateNotifier = require('update-notifier');
var pkg = require('../package.json');

updateNotifier({pkg: pkg}).notify();

module.exports = yeoman.generators.Base.extend({

  initializing: function () {

    this.pkg = pkg;

    this.branches = [{
      name: 'master',
      promptText: 'None'
    }, {
      name: 'feature/react-router',
      promptText: 'react-router'
    }, {
      name: 'feature/material-ui',
      promptText: 'material-ui'
    }];

    this.on('end', function() {
      this.log('Finished generating the project!'.green);
      this.log('Run `npm start` to start the application.');
    });

    this.log('Welcome to the ' + 'React-Seed'.green + ' generator!');
  },

  prompting: function () {
    var done = this.async();

    async.waterfall([
      getGithubUsername.bind(this),
      runPrompts.bind(this)
    ], done);

    function getGithubUsername(next) {

      this.log('Loading github user data...'.yellow);

      var config = gitConfig.sync();
      var email = config.user.email;

      var clientApi = githubApi.client();
      var ghSearchApi = clientApi.search();

      ghSearchApi.users({
        q: email
      }, function(err, users) {
        this.log('done.'.yellow + '\n');
        next(null,
          !err && users.items.length > 0 ?
          users.items[0].login :
          'your-github-user'
        );
      }.bind(this));
    }

    function runPrompts(username, next) {
      var prompts = [{
        type: 'input',
        name: 'name',
        message: 'Name of the project',<commit_msg>Better logging<commit_after>'use strict';

require('chalk');

var yeoman = require('yeoman-generator');
var path = require('path');
var glob = require('glob');
var util = require('util');
var rimraf = require('rimraf');
var async = require('async');
var objectAssign = require('object-assign');
var validateNpmPackageName = require('validate-npm-package-name');
var gitConfig = require('git-config');
var githubApi = require('octonode');
var updateNotifier = require('update-notifier');
var pkg = require('../package.json');

module.exports = yeoman.generators.Base.extend({

  initializing: function () {

    this.branches = [{
      name: 'master',
      promptText: 'None'
    }, {
      name: 'feature/react-router',
      promptText: 'react-router'
    }, {
      name: 'feature/material-ui',
      promptText: 'material-ui'
    }];

    this.log('Welcome to the ' + 'React-Seed'.green + ' generator!');

    this.on('end', function() {
      this.log('Finished generating the project!'.green);
      this.log('Run `npm start` to start the application.');
    });

    this.checkForUpdates();
  },

  checkForUpdates: function() {
    var notifier = updateNotifier({
      pkg: pkg
    });
    notifier.notify({ defer: false });
  },

  prompting: function () {
    var done = this.async();

    async.waterfall([
      getGithubUsername.bind(this),
      runPrompts.bind(this)
    ], done);

    function getGithubUsername(next) {

      this.log.write('Loading github user data...'.yellow);

      var config = gitConfig.sync();
      var email = config.user.email;

      var clientApi = githubApi.client();
      var ghSearchApi = clientApi.search();

      ghSearchApi.users({
        q: email
      }, function(err, users) {
        this.log('done.'.yellow);
        next(null,
          !err && users.items.length > 0 ?
          users.items[0].login :
          'your-github-user'
        );
      }.bind(this));
    }

    function runPrompts(username, next) {
      var prompts = [{
        type: 'input',
        name: 'name',
        message: 'Name of the project',
{'fraction_non_alphanumeric': 0.1623152709359606, 'fraction_numerical': 0.0009852216748768472, 'mean_word_length': 2.7847157502329916, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1114044', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1213, 'n_words': 272}