File: lib/commands/generate/controller.js
// Generated by CoffeeScript 1.7.1
"use strict";
var Controller, Helpers, LineUp, Promise, helpers, lineup, _;
_ = require("lodash");
Promise = require("bluebird");
Helpers = require("../../util/Helpers");
helpers = new Helpers();
LineUp = require("lineup");
lineup = new LineUp();
/**
* Class to fetch and run hooks registered for generate:controller process/command
* @class Controller
* @constructor
*/
Controller = (function() {
function Controller() {}
/**
* @method run
* @param args {Object} accept arguments passed with generate:controller command
* @description Entry point to generate:controller command and run all registered hooks
*/
Controller.prototype.run = function(args) {
helpers.sortModules("generate:controller").then(function(hooks_to_proccess) {
if (_.size(hooks_to_proccess) > 0) {
helpers.getConfig(function(err, ngconfig) {
if (err) {
lineup.log.error(err);
process.exit(1);
} else {
helpers.run("generate:controller", hooks_to_proccess, ngconfig, args);
}
});
} else {
lineup.log.warn("0 hooks configured for this proccess");
process.exit(1);
}
});
};
return Controller;
})();
module.exports = Controller;
