<commit_before>/* vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab : */
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');

var BeezGenerator = module.exports = function BeezGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.on('end', function () {
    this.installDependencies({ skipInstall: options['skip-install'] });
  });

  this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(BeezGenerator, yeoman.generators.Base);

BeezGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  // have Yeoman greet the user.
  console.log(this.yeoman);

  var prompts = [{
    name: 'name',
    message: 'Module Name',
    default: path.basename(process.cwd()),
    validate: function (w) {
      var done = this.async();

      if (!/[a-z-]/.test(w)) {
        done('You should put lowercase alphabet in module name.');
        return;
      }

      done(true);
    },
    filter: function (w) {
      var done = this.async();

      if (!/beez-[a-z]/.test(w)) {
        done('beez-' + w);
        return;
      }

      done(w);
    }
  }, {
    name: 'description',
    message: 'Description',
    default: 'The best module ever.'
  }, {
    name: 'homepage',
    message: 'Homepage'
  }, {
    name: 'license',
    message: 'License',
    default: 'MIT'
  }, {
    name: 'githubUsername',
    message: 'GitHub username'
  }, {
    name: 'authorName',
    message: 'Author\'s Name',
    validate: function (w) {
      var done = this.async();

      if (w.length === 0) {
        done('You should put your name.');
      }

      done(true);
    }
  }, {
    name: 'authorEmail',
    message: 'Author\'s Email',
    validate: function (w) {
      var done = this.async();

      if (w.length === 0) {
        done('You should put your email.');
      }

      done(true);
    }
  }, {
    name: 'authorUrl',
    message: 'Author\'s Homepage'
  }];

  this.prompt(prompts, function (props) {
    this.slugname = this._.slugify(props.name);
    this.safeSlugname = this.slugname.replace(
      /-([a-z])/g,
      function (g) { return g[1].toUpperCase(); }
    );
    this.methodName = this.slugname.replace(
      /([a-z])-([a-z])/g,
      function (w) { return w[0] + '.' + w[2]; }
    );
    this.versionName = this.slugname.replace(
      /(beez)-([a-z]+)/g,
      function (w, p1, p2, offset, s) {
        return p1.toUpperCase() + '_' + p2.toUpperCase() + '_VERSION';
      }
    );

    if (props.githubUsername) {
      this.repoUrl = 'https://github.com/' + props.githubUsername + '/' + this.slugname;
    } else {
      this.repoUrl = 'user/repo';
    }

    if (!props.homepage) {
      props.homepage = this.repoUrl;
    }

    this.props = props;

    cb();
  }.bind(this));
};

BeezGenerator.prototype.app = function app() {
  this.mkdir('deps');
  this.mkdir('vender');
  this.mkdir('spec');
  this.mkdir('deps');
  this.mkdir('s');
  this.mkdir('s/' + this.slugname);
  this.mkdir('s/' + this.slugname + '/model');
  this.mkdir('s/' + this.slugname + '/view');
  this.template('s/project/index.js', 's/' + this.slugname + '/index.js');
  this.template('s/project/model/index.js', 's/' + this.slugname + '/model/index.js');
  this.template('s/project/view/index.js', 's/' + this.slugname + '/view/index.js');
};

BeezGenerator.prototype.projectfiles = function projectfiles() {
  this.copy('jshintrc', '.jshintrc');
  this.copy('jshintignore', '.jshintignore');
  this.copy('Gruntfile.js');
  this.template('_package.json', 'package.json');
  this.template('setver');
};<commit_msg>copy license file when MIT<commit_after>/* vim: set tabstop=2 shiftwidth=2 softtabstop=2 expandtab : */
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');

var BeezGenerator = module.exports = function BeezGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.on('end', function () {
    this.installDependencies({ skipInstall: options['skip-install'] });
  });

  this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};

util.inherits(BeezGenerator, yeoman.generators.Base);

BeezGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  // have Yeoman greet the user.
  console.log(this.yeoman);

  var prompts = [{
    name: 'name',
    message: 'Module Name',
    default: path.basename(process.cwd()),
    validate: function (w) {
      var done = this.async();

      if (!/[a-z-]/.test(w)) {
        done('You should put lowercase alphabet in module name.');
        return;
      }

      done(true);
    },
    filter: function (w) {
      var done = this.async();

      if (!/beez-[a-z]/.test(w)) {
        done('beez-' + w);
        return;
      }

      done(w);
    }
  }, {
    name: 'description',
    message: 'Description',
    default: 'The best module ever.'
  }, {
    name: 'homepage',
    message: 'Homepage'
  }, {
    name: 'license',
    message: 'License',
    default: 'MIT'
  }, {
    name: 'githubUsername',
    message: 'GitHub username'
  }, {
    name: 'authorName',
    message: 'Author\'s Name',
    validate: function (w) {
      var done = this.async();

      if (w.length === 0) {
        done('You should put your name.');
      }

      done(true);
    }
  }, {
    name: 'authorEmail',
    message: 'Author\'s Email',
    validate: function (w) {
      var done = this.async();

      if (w.length === 0) {
        done('You should put your email.');
      }

      done(true);
    }
  }, {
    name: 'authorUrl',
    message: 'Author\'s Homepage'
  }];

  this.prompt(prompts, function (props) {
    this.slugname = this._.slugify(props.name);
    this.safeSlugname = this.slugname.replace(
      /-([a-z])/g,
      function (g) { return g[1].toUpperCase(); }
    );
    this.methodName = this.slugname.replace(
      /([a-z])-([a-z])/g,
      function (w) { return w[0] + '.' + w[2]; }
    );
    this.versionName = this.slugname.replace(
      /(beez)-([a-z]+)/g,
      function (w, p1, p2, offset, s) {
        return p1.toUpperCase() + '_' + p2.toUpperCase() + '_VERSION';
      }
    );

    if (props.githubUsername) {
      this.repoUrl = 'https://github.com/' + props.githubUsername + '/' + this.slugname;
    } else {
      this.repoUrl = 'user/repo';
    }

    if (!props.homepage) {
      props.homepage = this.repoUrl;
    }

    this.props = props;

    cb();
  }.bind(this));
};

BeezGenerator.prototype.app = function app() {
  this.mkdir('deps');
  this.mkdir('vender');
  this.mkdir('spec');
  this.mkdir('deps');
  this.mkdir('s');
  this.mkdir('s/' + this.slugname);
  this.mkdir('s/' + this.slugname + '/model');
  this.mkdir('s/' + this.slugname + '/view');
  this.template('s/project/index.js', 's/' + this.slugname + '/index.js');
  this.template('s/project/model/index.js', 's/' + this.slugname + '/model/index.js');
  this.template('s/project/view/index.js', 's/' + this.slugname + '/view/index.js');
};

BeezGenerator.prototype.projectfiles = function projectfiles() {
  this.copy('jshintrc', '.jshintrc');
  this.copy('jshintignore', '.jshintignore');
  if (this.props.license === 'MIT') {
    this.copy('LICENSE');
  }
  this.copy('Gruntfile.js');
  this.template('_package.json', 'package.json');
  this.template('setver');
};
{'fraction_non_alphanumeric': 0.19412636400377206, 'fraction_numerical': 0.003233194126364004, 'mean_word_length': 2.7213032581453636, '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': '5232723', 'n_tokens_mistral': 2632, 'n_tokens_neox': 2583, 'n_words': 500}