'use strict';
var util = require('util');
var path = require('path');
var yeoman = require('yeoman-generator');

var PageGenerator = module.exports = function PageGenerator(args, options, config) {
    // By calling `NamedBase` here, we get the argument to the subgenerator call
    // as `this.name`.
    yeoman.generators.NamedBase.apply(this, arguments);
    this.controllerName = this._.capitalize(this._.camelize(this._.slugify(this.name))) || 'Page';
    this.pkg = JSON.parse(this.readFileAsString(path.join(process.cwd(), '/package.json')));
    console.log(this.pkg);
    this.slug = this.pkg.name;
    this.appTitle = this.pkg.title;
};

util.inherits(PageGenerator, yeoman.generators.NamedBase);

PageGenerator.prototype.files = function files() {
    this.copy('_styles.scss', 'app/public/controllers/pages/' + this.controllerName + '/_' + this.controllerName + '.scss');
    this.copy('_view.jade', 'app/public/controllers/pages/' + this.controllerName + '/_' + this.controllerName + 'View.jade');
    this.copy('script.js', 'app/public/controllers/pages/' + this.controllerName + '/' + this.controllerName + 'Controller.js');
};

@@ -104,16 +104,58 @@
 rator');
+%0Avar angularUtils = require('../util.js');
 %0A%0Avar Pa
@@ -589,35 +589,8 @@
 ));%0A
-    console.log(this.pkg);%0A
     
@@ -716,16 +716,392 @@
 Base);%0A%0A
+PageGenerator.prototype.askFor = function askFor() %7B%0A    var cb = this.async();%0A%0A    var prompts = %5B%7B%0A        type: 'confirm',%0A        name: 'addToNav',%0A        message: 'Do you wish to add a link to the navbar template?',%0A        default: true%0A    %7D%5D;%0A%0A    this.prompt(prompts, function (props) %7B%0A        this.addToNav = props.addToNav;%0A%0A        cb();%0A    %7D.bind(this));%0A%7D;%0A%0A
 PageGene
@@ -1346,33 +1346,32 @@
 trollerName + '/
-_
 ' + this.control
@@ -1523,11 +1523,1602 @@
 r.js');%0A
+%0A    // add route to app.js%0A    angularUtils.rewriteFile(%7B%0A        path: process.cwd(),%0A        file: '/app/public/scripts/app.js',%0A        needle: '.otherwise',%0A        splicable: %5B%0A            '.when(%5C'/' + this.name + '%5C', %7B',%0A            '    templateUrl: %5C'controllers/pages/' + this.controllerName + '/' + this.controllerName + 'View%5C',',%0A            '    controller: %5C'AppController%5C'',%0A            '%7D)'%0A        %5D%0A    %7D);%0A%0A    // add script tag to index.jade%0A    angularUtils.rewriteFile(%7B%0A        path: process.cwd(),%0A        file: '/app/public/index.jade',%0A        needle: '//- page controllers',%0A        spliceAfter: true,%0A        splicable: %5B%0A            'script(src=%22controllers/pages/' + this.controllerName + '/' + this.controllerName + 'Controller.js%22)'%0A        %5D%0A    %7D);%0A%0A    // add stylesheet reference to app.scss%0A    angularUtils.rewriteFile(%7B%0A        path: process.cwd(),%0A        file: '/app/public/styles/app.scss',%0A        needle: '// Angular Controller Styles',%0A        spliceAfter: true,%0A        splicable: %5B%0A            '@import %22../controllers/pages/' + this.controllerName + '/_' + this.controllerName + '%22;'%0A        %5D%0A    %7D);%0A%0A    if (this.addToNav) %7B%0A        // add navigation item to navbar.jade%0A        angularUtils.rewriteFile(%7B%0A            path: process.cwd(),%0A            file: '/app/public/components/navbar/navbar.jade',%0A            needle: '//- angular pages',%0A            spliceAfter: true,%0A            splicable: %5B%0A                'li',%0A                '  a(href=%22#/' + this.name + '%22) ' + this._.capitalize(this.name)%0A            %5D%0A        %7D);%0A    %7D%0A%0A
 %7D;%0A

Add prompts to page sub-generator