<commit_before>'use strict';

var yeoman = require('yeoman-generator'),
  chalk = require('chalk'),
  _ = require('lodash'),
  jhipsterUtils = require('../../node_modules/generator-jhipster/generators/util'),
  packagejs = require(__dirname + '/../../package.json');

// Stores JHipster variables
var jhipsterVar = {moduleName: 'nav-element'};

// Stores JHipster functions
var jhipsterFunc = {};

module.exports = yeoman.Base.extend({

  initializing: {
    compose: function (args) {
      this.composeWith('jhipster:modules',
        {
          options: {
            jhipsterVar: jhipsterVar,
            jhipsterFunc: jhipsterFunc
          }
        },
        this.options.testmode ? {local: require.resolve('generator-jhipster/generators/modules')} : null
      );
    },
    displayLogo: function () {
      // Have Yeoman greet the user.
      this.log('Welcome to the ' + chalk.red('JHipster nav-element') + ' generator! ' + chalk.yellow('v' + packagejs.version + '\n'));
    }
  },

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

    var prompts = [
      {
        type: 'input',
        name: 'navElementKey',
        message: 'What would you like the nav element id to be? (e.g. aboutUs, about-us)',
        default: 'about-us'
      },
      {
        type: 'list',
        name: 'createDirective',
        message: 'Would you like me to create a sample directive for your nav element?',
        choices: [
          {value: true, name: 'Yes'},
          {value: false, name: 'No'}
        ],
        default: true
      }
    ];

    this.prompt(prompts, function (props) {
      this.props = props;
      // To access props later use this.props.someOption;

      done();
    }.bind(this));
  },

  writing: {
    writeTemplates: function () {
      this.baseName = jhipsterVar.baseName;
      this.packageName = jhipsterVar.packageName;
      this.angularAppName = jhipsterVar.angularAppName;
      this.enableTranslation = jhipsterVar.enableTranslation;

      this.message = this.props.message;
      this.navElementKey = this.props.navElementKey;
      this.createDirective = this.props.createDirective;

      if (!!this.navElementKey) {
        var s = this.navElementKey.trim().replace(' ', '-').replace('_', '-');
        this.navElementKeyCamelCased = _.camelCase(s);
        this.navElementKeyCapitalized = _.upperFirst(_.camelCase(s));
      } else {
        this.log('Invalid navElementKey provided');
        return;
      }

      this.log('------------------------------------------------------------\n');
      this.log('baseName=' + this.baseName);
      this.log('packageName=' + this.packageName);
      this.log('angularAppName=' + this.angularAppName);
      this.log('enableTranslation=' + this.enableTranslation);
      this.log('navElementKey=' + this.navElementKey);
      this.log('navElementKeyCamelCased=' + this.navElementKeyCamelCased);
      this.log('navElementKeyCapitalized=' + this.navElementKeyCapitalized);
      this.log('------------------------------------------------------------\n');

      var elementComponentName = this.navElementKeyCamelCased;


      var webappDir = jhipsterVar.webappDir;
      // HTML TEMPLATE
      this.template('src/main/webapp/app/element/element.html', webappDir + 'app/' + elementComponentName + '/' + elementComponentName + '.html');<commit_msg>removed redundant code<commit_after>'use strict';

var yeoman = require('yeoman-generator'),
  chalk = require('chalk'),
  _ = require('lodash'),
  jhipsterUtils = require('../../node_modules/generator-jhipster/generators/util'),
  packagejs = require(__dirname + '/../../package.json');

// Stores JHipster variables
var jhipsterVar = {moduleName: 'nav-element'};

// Stores JHipster functions
var jhipsterFunc = {};

module.exports = yeoman.Base.extend({

  initializing: {
    compose: function (args) {
      this.composeWith('jhipster:modules',
        {
          options: {
            jhipsterVar: jhipsterVar,
            jhipsterFunc: jhipsterFunc
          }
        });
    },
    displayLogo: function () {
      // Have Yeoman greet the user.
      this.log('Welcome to the ' + chalk.red('JHipster nav-element') + ' generator! ' + chalk.yellow('v' + packagejs.version + '\n'));
    }
  },

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

    var prompts = [
      {
        type: 'input',
        name: 'navElementKey',
        message: 'What would you like the nav element id to be? (e.g. aboutUs, about-us)',
        default: 'about-us'
      },
      {
        type: 'list',
        name: 'createDirective',
        message: 'Would you like me to create a sample directive for your nav element?',
        choices: [
          {value: true, name: 'Yes'},
          {value: false, name: 'No'}
        ],
        default: true
      }
    ];

    this.prompt(prompts, function (props) {
      this.props = props;
      // To access props later use this.props.someOption;

      done();
    }.bind(this));
  },

  writing: {
    writeTemplates: function () {
      this.baseName = jhipsterVar.baseName;
      this.packageName = jhipsterVar.packageName;
      this.angularAppName = jhipsterVar.angularAppName;
      this.enableTranslation = jhipsterVar.enableTranslation;

      this.message = this.props.message;
      this.navElementKey = this.props.navElementKey;
      this.createDirective = this.props.createDirective;

      var s = this.navElementKey.trim().replace(' ', '-').replace('_', '-');
      this.navElementKeyCamelCased = _.camelCase(s);
      this.navElementKeyCapitalized = _.upperFirst(_.camelCase(s));

      this.log('------------------------------------------------------------\n');
      this.log('baseName=' + this.baseName);
      this.log('packageName=' + this.packageName);
      this.log('angularAppName=' + this.angularAppName);
      this.log('enableTranslation=' + this.enableTranslation);
      this.log('navElementKey=' + this.navElementKey);
      this.log('navElementKeyCamelCased=' + this.navElementKeyCamelCased);
      this.log('navElementKeyCapitalized=' + this.navElementKeyCapitalized);
      this.log('------------------------------------------------------------\n');

      var elementComponentName = this.navElementKeyCamelCased;


      var webappDir = jhipsterVar.webappDir;
      // HTML TEMPLATE
      this.template('src/main/webapp/app/element/element.html', webappDir + 'app/' + elementComponentName + '/' + elementComponentName + '.html');
{'fraction_non_alphanumeric': 0.17464003715745471, 'fraction_numerical': 0.0, 'mean_word_length': 2.369848721961398, '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': '1169078', 'n_tokens_mistral': 1936, 'n_tokens_neox': 1886, 'n_words': 366}