controller/index.js
'use strict';
var yo = require('yeoman-generator')
, utils = require('../lib/utils')
, NamedBase = yo.generators.NamedBase;
var ControllerGenerator = NamedBase.extend({
init: function () {
var self = this
, cb = this.async()
, base = this.dest._base()
, type = this.config.get('type');
var today = new Date();
this.year = today.getFullYear();
utils.getAddon(base, type, function (err, addon) {
self.addon = addon;
cb();
});
},
files: function () {
this.template(
'class.controller.php',
'controllers/class.' + this.name.toLowerCase() + 'controller.php'
);
}
});
module.exports = ControllerGenerator;