-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript-base.js
More file actions
35 lines (28 loc) · 1.14 KB
/
Copy pathscript-base.js
File metadata and controls
35 lines (28 loc) · 1.14 KB
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
33
34
35
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var ngUtils = require('./util.js');
var Generator = module.exports = function Generator() {
yeoman.generators.NamedBase.apply(this, arguments);
try {
this.appname = require(path.join(process.cwd(), 'bower.json')).name;
} catch (e) {
this.appname = path.basename(process.cwd());
}
this.appname = this._.slugify(this._.humanize(this.appname));
this.scriptAppName = this.config.get('moduleName') || this._.camelize(this.appname) + ngUtils.appName(this);
this.cameledName = this._.camelize(this.name);
this.classedName = this._.classify(this.name);
this.hasFilter = function(filter) {
return this.config.get('filters').indexOf(filter) !== -1;
}.bind(this);
if (typeof this.env.options.appPath === 'undefined') {
try {
this.env.options.appPath = require(path.join(process.cwd(), 'bower.json')).appPath;
} catch (e) {}
this.env.options.appPath = this.env.options.appPath || 'app';
}
this.sourceRoot(path.join(__dirname, '/templates'));
};
util.inherits(Generator, yeoman.generators.NamedBase);