<commit_before>var path = require('path');
var util = require('util');
var yeoman = require('yeoman-generator');

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

  this.on('end', function() {
    if (options['skip-install']) {
      this.installDependencies({skipInstall: true});
    } else {
      this.installDependencies({bower: false, npm: true, skipInstall: false});
    }
  });

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

util.inherits(ComponentGenerator, yeoman.generators.NamedBase);

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

  var welcome =
  '\n     _-----_' +
  '\n    |       |' +
  '\n    |' + '--(o)--'.red + '|   .--------------------------.' +
  '\n   `---------´  |    ' + 'Welcome to Yeoman,'.yellow.bold + '    |' +
  '\n    ' + '( '.yellow + '_' + '´U`'.yellow + '_' + ' )'.yellow + '   |   ' + 'ladies and gentlemen!'.yellow.bold + '  |' +
  '\n    /___A___\\   \'__________________________\'' +
  '\n     |  ~  |'.yellow +
  '\n   __' + '\'.___.\''.yellow + '__' +
  '\n ´   ' + '`  |'.red + '° ' + '´ Y'.red + ' `\n';

  console.log(welcome);

  var prompts = [{
    name: 'componentRepo',
    message: 'repo:',
    default: 'username/project'
  },
  {
    name: 'componentDescription',
    message: 'description:',
    default: 'A component.'
  },
  {
    name: 'componentHasJS',
    message: 'Does this component have JS?',
    default: 'Y/n'
  },
  {
    name: 'componentHasCSS',
    message: 'Does this component have CSS?',
    default: 'Y/n'
  },
  {
    name: 'componentHasHTML',
    message: 'Does this component have HTML?',
    default: 'Y/n'
  },
  {
    name: 'testScaffolding',
    message: 'Would you like tests?',
    default: 'Y/n'
  },
  {
    name: 'editorConfig',
    message: 'Would you like an .editorconfig file?',
    default: 'Y/n'
  },
  {
    name: 'npmPublishing',
    message: 'Would you like to publish this component to npm?',
    default: 'Y/n'
  }];

  this.prompt(prompts, function(err, props) {
    if (err) {
      return this.emit('error', err);
    }

    var repo = props.componentRepo.split('/');
    if (repo.length != 2) throw new Error('repo must be <username>/<project>');

    this.componentName = repo[1];
    this.componentRepo = props.componentFullName;
    this.componentDescription = props.componentDescription;
    this.testScaffolding = (/y/i).test(props.testScaffolding);
    this.editorConfig = (/y/i).test(props.editorConfig);
    this.npmPublishing = (/y/i).test(props.npmPublishing);

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

ComponentGenerator.prototype.testFolder = function testFolder() {
  if (this.testScaffolding) {
    this.directory('test', 'test');
  }
};

ComponentGenerator.prototype.dotfiles = function dotfiles() {
  this.copy('gitignore', '.gitignore');
  this.copy('gitattributes', '.gitattributes');

  if (this.editorConfig) {
    this.copy('editorconfig', '.editorconfig');
  }
  if (this.testScaffolding) {
    this.copy('travis.yml', '.travis.yml');
  }
};

ComponentGenerator.prototype.markdownFiles = function markdownFiles() {
  this.copy('HISTORY.md', 'HISTORY.md');
  this.template('README.md', 'README.md');
};

ComponentGenerator.prototype.jsonFiles = function jsonFiles() {
  this.template('_component.json', 'component.json');

  if (this.npmPublishing || this.testScaffolding) {
    this.template('_package.json', 'package.json');
  }
};

ComponentGenerator.prototype.app = function app() {
  this.template('index.js', 'index.js');
};

ComponentGenerator.name = 'component';
module.exports.description = 'Yeoman generator for components.';
module.exports.usage = 'Read the `README.md`';

module.exports = ComponentGenerator;<commit_msg>Move inherit<commit_after>var path = require('path');
var util = require('util');
var yeoman = require('yeoman-generator');

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

  this.on('end', function() {
    if (options['skip-install']) {
      this.installDependencies({skipInstall: true});
    } else {
      this.installDependencies({bower: false, npm: true, skipInstall: false});
    }
  });

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

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

  var welcome =
  '\n     _-----_' +
  '\n    |       |' +
  '\n    |' + '--(o)--'.red + '|   .--------------------------.' +
  '\n   `---------´  |    ' + 'Welcome to Yeoman,'.yellow.bold + '    |' +
  '\n    ' + '( '.yellow + '_' + '´U`'.yellow + '_' + ' )'.yellow + '   |   ' + 'ladies and gentlemen!'.yellow.bold + '  |' +
  '\n    /___A___\\   \'__________________________\'' +
  '\n     |  ~  |'.yellow +
  '\n   __' + '\'.___.\''.yellow + '__' +
  '\n ´   ' + '`  |'.red + '° ' + '´ Y'.red + ' `\n';

  console.log(welcome);

  var prompts = [{
    name: 'componentRepo',
    message: 'repo:',
    default: 'username/project'
  },
  {
    name: 'componentDescription',
    message: 'description:',
    default: 'A component.'
  },
  {
    name: 'componentHasJS',
    message: 'Does this component have JS?',
    default: 'Y/n'
  },
  {
    name: 'componentHasCSS',
    message: 'Does this component have CSS?',
    default: 'Y/n'
  },
  {
    name: 'componentHasHTML',
    message: 'Does this component have HTML?',
    default: 'Y/n'
  },
  {
    name: 'testScaffolding',
    message: 'Would you like tests?',
    default: 'Y/n'
  },
  {
    name: 'editorConfig',
    message: 'Would you like an .editorconfig file?',
    default: 'Y/n'
  },
  {
    name: 'npmPublishing',
    message: 'Would you like to publish this component to npm?',
    default: 'Y/n'
  }];

  this.prompt(prompts, function(err, props) {
    if (err) {
      return this.emit('error', err);
    }

    var repo = props.componentRepo.split('/');
    if (repo.length != 2) throw new Error('repo must be <username>/<project>');

    this.componentName = repo[1];
    this.componentRepo = props.componentFullName;
    this.componentDescription = props.componentDescription;
    this.testScaffolding = (/y/i).test(props.testScaffolding);
    this.editorConfig = (/y/i).test(props.editorConfig);
    this.npmPublishing = (/y/i).test(props.npmPublishing);

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

ComponentGenerator.prototype.testFolder = function testFolder() {
  if (this.testScaffolding) {
    this.directory('test', 'test');
  }
};

ComponentGenerator.prototype.dotfiles = function dotfiles() {
  this.copy('gitignore', '.gitignore');
  this.copy('gitattributes', '.gitattributes');

  if (this.editorConfig) {
    this.copy('editorconfig', '.editorconfig');
  }
  if (this.testScaffolding) {
    this.copy('travis.yml', '.travis.yml');
  }
};

ComponentGenerator.prototype.markdownFiles = function markdownFiles() {
  this.copy('HISTORY.md', 'HISTORY.md');
  this.template('README.md', 'README.md');
};

ComponentGenerator.prototype.jsonFiles = function jsonFiles() {
  this.template('_component.json', 'component.json');

  if (this.npmPublishing || this.testScaffolding) {
    this.template('_package.json', 'package.json');
  }
};

ComponentGenerator.prototype.app = function app() {
  this.template('index.js', 'index.js');
};

util.inherits(ComponentGenerator, yeoman.generators.NamedBase);

ComponentGenerator.name = 'component';
ComponentGenerator.description = 'Yeoman generator for components.';
ComponentGenerator.usage = 'Read the `README.md`';

module.exports = ComponentGenerator;
{'fraction_non_alphanumeric': 0.19365121530083676, 'fraction_numerical': 0.0005312790543232833, 'mean_word_length': 3.1419141914191417, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '212901', 'n_tokens_mistral': 2554, 'n_tokens_neox': 2476, 'n_words': 482}