lib/controller.js
function(resName, opts) {

    // TODO ensure resName is always snake case
    this.contrFile = this.controllerPath + resName + '.js';
    this.resName = resName;
    this.opts = opts;

    // if no args passed in, created all routes
    if (!opts.index && !opts.new && !opts.show && !opts.edit &&
        !opts.create && !opts.update && !opts.destroy) {
      this.opts.all = true;
    }

    this._createBaseController();

    // add a comment line before adding new routes
    require('./router').appendRoute(resName, 'comment_line');

    // print 'created' if file doesn't exist yet (created on first append)
    if (!fs.existsSync(this.contrFile)) {
      console.log('    Created: ' + this.contrFile);
    }

    // Append Iron Router Controllers

    if (opts.index || opts.all) {
      this._appendController('index');
      require('./page').run(this.resName, {index: true});
    }

    if (opts.new || opts.all) {
      this._appendController('new');
      require('./page').run(resName, {'new': true});
    }

    if (opts.show || opts.all) {
      this._appendController('show');
      require('./page').run(resName, {show: true});
    }

    if (opts.edit || opts.all) {
      this._appendController('edit');
      require('./page').run(resName, {edit: true});
    }

    // Append data Controllers

    if (opts.create || opts.all) {
      this._appendController('create');
    }

    if (opts.update || opts.all) {
      this._appendController('update');
    }

    if (opts.destroy || opts.all) {
      this._appendController('destroy');
    }

    // add blank line to routes.js after controller routes
    require('./router').appendRoute(null, 'blank_line');

    // instantiate and add namespace for this resource if needed
    new (require('./namespace'))().add(resName);
  }
function(resName, opts) {

    // TODO ensure resName is always snake case
    this.contrFile = this.controllerPath + resName + '.js';
    this.resName = resName;
    this.opts = opts;

    // if no args passed in, created all routes
    if (!opts.index && !opts.new && !opts.show && !opts.edit &&
        !opts.create && !opts.update && !opts.destroy) {
      this.opts.all = true;
    }

    this._createBaseController();

    // add a comment line before adding new routes
    require('./router').appendRoute(resName, 'comment_line');

    // print 'created' if file doesn't exist yet (created on first append)
    if (!fs.existsSync(this.contrFile)) {
      console.log('    Created: ' + this.contrFile);
    }

    // Append Iron Router Controllers

    if (opts.index || opts.all) {
      this._appendController('index');
      require('./page').run(this.resName, {index: true});
    }

    if (opts.new || opts.all) {
      this._appendController('new');
      require('./page').run(resName, {'new': true});
    }

    if (opts.show || opts.all) {
      this._appendController('show');
      require('./page').run(resName, {show: true});
    }

    if (opts.edit || opts.all) {
      this._appendController('edit');
      require('./page').run(resName, {edit: true});
    }

    // Append data Controllers

    if (opts.create || opts.all) {
      this._appendController('create');
    }

    if (opts.update || opts.all) {
      this._appendController('update');
    }

    if (opts.destroy || opts.all) {
      this._appendController('destroy');
    }

    // add blank line to routes.js after controller routes
    require('./router').appendRoute(null, 'blank_line');

    // instantiate and add namespace for this resource if needed
    new (require('./namespace'))().add(resName);
  }
function ( resName , opts ) { // TODO ensure resName is always snake case this . contrFile = this . controllerPath + resName + '.js' ; this . resName = resName ; this . opts = opts ; // if no args passed in, created all routes if ( ! opts . index && ! opts . new && ! opts . show && ! opts . edit && ! opts . create && ! opts . update && ! opts . destroy ) { this . opts . all = true ; } this . _createBaseController ( ) ; // add a comment line before adding new routes require ( './router' ) . appendRoute ( resName , 'comment_line' ) ; // print 'created' if file doesn't exist yet (created on first append) if ( ! fs . existsSync ( this . contrFile ) ) { console . log ( '    Created: ' + this . contrFile ) ; } // Append Iron Router Controllers if ( opts . index || opts . all ) { this . _appendController ( 'index' ) ; require ( './page' ) . run ( this . resName , { index : true } ) ; } if ( opts . new || opts . all ) { this . _appendController ( 'new' ) ; require ( './page' ) . run ( resName , { 'new' : true } ) ; } if ( opts . show || opts . all ) { this . _appendController ( 'show' ) ; require ( './page' ) . run ( resName , { show : true } ) ; } if ( opts . edit || opts . all ) { this . _appendController ( 'edit' ) ; require ( './page' ) . run ( resName , { edit : true } ) ; } // Append data Controllers if ( opts . create || opts . all ) { this . _appendController ( 'create' ) ; } if ( opts . update || opts . all ) { this . _appendController ( 'update' ) ; } if ( opts . destroy || opts . all ) { this . _appendController ( 'destroy' ) ; } // add blank line to routes.js after controller routes require ( './router' ) . appendRoute ( null , 'blank_line' ) ; // instantiate and add namespace for this resource if needed new ( require ( './namespace' ) ) ( ) . add ( resName ) ; }
Public: Creates a controller file & appends any type of controller needed. If no options are passed in it will create all router and CRUD controllers  resName - The {String} name of the resource passed in from command line opts -    The options generated from a Commander command entry.
Public : Creates a controller file & appends any type of controller needed . If no options are passed in it will create all router and CRUD controllers resName - The { String } name of the resource passed in from command line opts - The options generated from a Commander command entry .