-
Notifications
You must be signed in to change notification settings - Fork 2
/
script-base-basic.js
32 lines (27 loc) · 1.22 KB
/
script-base-basic.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var Generator = module.exports = function Generator() {
yeoman.generators.Base.apply(this, arguments);
this.sourceRoot(path.join(__dirname, './templates/'));
this.namespace = function() {
return require('./configuration').getNamespace(this.fs);
}.bind(this);
};
util.inherits(Generator, yeoman.generators.Base);
Generator.prototype.generateStandardFile = function(sourceFile, targetFile) {
this.log('You called the aspnet subgenerator with the arg: ' + chalk.green(this.arguments[0] || targetFile));
this.fs.copy(this.templatePath(sourceFile), this.destinationPath(targetFile));
this.log(chalk.green(targetFile) + ' created.');
};
Generator.prototype.generateTemplateFile = function(templateFile, targetFile, templateData) {
this.log('You called the aspnet subgenerator with the arg ' + templateFile);
if (templateData !== null) {
this.fs.copyTpl(this.templatePath(templateFile), this.destinationPath(targetFile), templateData);
} else {
this.fs.copyTpl(this.templatePath(templateFile), this.destinationPath(targetFile));
}
this.log(targetFile + ' created.');
};