<commit_before>'use strict';

var _ = require("lodash");
var utils = require("../../../utils.js");

module.exports = function (AngularATGenerator) {

    AngularATGenerator.prototype.copyCopmFiles = function copyFiles() {
      var data = {'directiveName': this.props.directiveName, 'directiveNameCamel': _.camelCase(this.props.directiveName), 'needsPartial': this.props.needsPartial};
      if(this.props.needsPartial){
      this.fs.copyTpl(
      this.templatePath('directive.html'),
      this.destinationPath(this.destinationRoot()+'/src/app/core/directives/'+data.directiveName+'/'+data.directiveName+'.html'),
      data
    );
      this.fs.copyTpl(
      this.templatePath('directive.scss'),
      this.destinationPath(this.destinationRoot()+'/src/app/core/directives/'+data.directiveName+'/'+data.directiveName+'.scss'),
      data
    );
    }
      this.fs.copyTpl(
      this.templatePath('directive.directive.js'),
      this.destinationPath(this.destinationRoot()+'/src/app/core/directives/'+data.directiveName+'/'+data.directiveName+'.directive'+'.js'),
      data
    );

    var coreModulesWriteLine = "require('./directives/"+data.directiveName+"/"+data.directiveName+".directive')(shared);";
    utils.addToFile("core.module.js",coreModulesWriteLine,utils.DIRECTIVE_MARKER,this.destinationRoot()+"/src/app/core");
    };
};
<commit_msg>added a checking condition in directive generator to know whether it is component nested and act accordingly<commit_after>'use strict';

var _ = require("lodash");
var utils = require("../../../utils.js");

module.exports = function (AngularATGenerator) {

    AngularATGenerator.prototype.copyCopmFiles = function copyFiles() {
      var itemRelPath = this.props.directiveName;
      var relPathAsArray = itemRelPath.split('/');
      var directiveName = relPathAsArray[relPathAsArray.length-1];

      var data = {'directiveName': directiveName, 'directiveNameCamel': _.camelCase(directiveName), 'needsPartial': this.props.needsPartial};

      if(relPathAsArray.length===1) {
        var appRelPath = '/src/app/core/directives';

        if(this.props.needsPartial){
        this.fs.copyTpl(
        this.templatePath('directive.html'),
        this.destinationPath(this.destinationRoot()+appRelPath+'/'+data.directiveName+'/'+data.directiveName+'.html'),
        data
      );
        this.fs.copyTpl(
        this.templatePath('directive.scss'),
        this.destinationPath(this.destinationRoot()+appRelPath+'/'+data.directiveName+'/'+data.directiveName+'.scss'),
        data
      );
      }
        this.fs.copyTpl(
        this.templatePath('directive.directive.js'),
        this.destinationPath(this.destinationRoot()+appRelPath+'/'+data.directiveName+'/'+data.directiveName+'.directive'+'.js'),
        data
      );

      var coreModulesWriteLine = "require('./directives/"+data.directiveName+"/"+data.directiveName+".directive')(shared);";
      utils.addToFile("core.module.js",coreModulesWriteLine,utils.DIRECTIVE_MARKER,this.destinationRoot()+"/src/app/core");

    }else{
      var parentComponentName = pathAsArray[relPathAsArray.length-2];
    }



    };
};

{'fraction_non_alphanumeric': 0.16353203697800447, 'fraction_numerical': 0.000956327701625757, 'mean_word_length': 3.880248833592535, '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': '343735', 'n_tokens_mistral': 976, 'n_tokens_neox': 959, 'n_words': 109}