app/index.js
'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');
var cgUtils = require('../utils.js');
var CgangularGenerator = module.exports = function CgangularGenerator(args, options, config) {
yeoman.generators.Base.apply(this, arguments);
this.on('end', function () {
this.config.set('partialDirectory','partial/');
this.config.set('modalDirectory','partial/');
this.config.set('directiveDirectory','directive/');
this.config.set('filterDirectory','filter/');
this.config.set('serviceDirectory','service/');
var inject = {
js: {
file: 'app/index.html',
marker: cgUtils.JS_MARKER,
template: '<script src="<%= filename %>"></script>'
}
};
this.config.set('inject',inject);
this.config.save();
this.installDependencies({ skipInstall: options['skip-install'] });
});
this.pkg = JSON.parse(this.readFileAsString(path.join(__dirname, '../package.json')));
};
util.inherits(CgangularGenerator, yeoman.generators.Base);
CgangularGenerator.prototype.askFor = function askFor() {
var cb = this.async();
var prompts = [{
name: 'appname',
message: 'What would you like the angular app/module name to be?',
default: path.basename(process.cwd())
}];
this.prompt(prompts, function (props) {
this.appname = props.appname;
this.uirouter = true;
this.routerJs = 'bower_components/angular-ui-router/release/angular-ui-router.js';
this.routerModuleName = 'ui.router';
this.routerViewDirective = 'ui-view';
cb();
}.bind(this));
};
CgangularGenerator.prototype.app = function app() {
this.directory('skeleton/','./');
};