How to use the yeoman-generator.NamedBase function in yeoman-generator

To help you get started, we’ve selected a few yeoman-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infinitered / ignite / ignite-generator / component / index.js View on Github external
_createClass(ComponentGenerator, [{
    key: 'generateApp',
    value: function generateApp() {
      // Copy over component files.
      copyOverCompoment(this);
    }
  }, {
    key: 'end',
    value: function end() {
      console.log('Time to get cooking! 🍽 ');
    }
  }]);

  return ComponentGenerator;
}(_yeomanGenerator.NamedBase);

module.exports = ComponentGenerator;
github abiee / generator-backbone-amd / collection / index.js View on Github external
function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = this.options.coffee ? '../templates/coffeescript/' : '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));
  this.argument('model', { type: String, required: false });
  this.option('create-model', { desc: 'Create a new model for this collection' });
  this.option('coffee', { desc: 'CoffeeScript instead standard JavaScript' });

  if (this.model && this.options['create-model']) {
    // TODO: pass --coffee option to model if coffee was enabled
    this.hookFor('backbone-amd', { as: 'model', args: [this.model], options: this.options })
  }
}
github abiee / generator-backbone-amd / view / index.js View on Github external
/*jshint latedef:false */
var generator  = require('yeoman-generator');
var util       = require('util');
var path       = require('path');

module.exports = Generator;

function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = this.options.coffee ? '../templates/coffeescript/' : '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));
  this.option('coffee', { desc: 'CoffeeScript instead standard JavaScript' });
}

util.inherits(Generator, generator.NamedBase);

Generator.prototype.createViewFiles = function createViewFiles() {
  // TODO: Add template
  var ext = this.options.coffee ? 'coffee' : 'js';
  this.template('view.' + ext, path.join('app/scripts/views', this.name + '.' + ext));
};
github abiee / generator-backbone-amd / collection / index.js View on Github external
function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = this.options.coffee ? '../templates/coffeescript/' : '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));
  this.argument('model', { type: String, required: false });
  this.option('create-model', { desc: 'Create a new model for this collection' });
  this.option('coffee', { desc: 'CoffeeScript instead standard JavaScript' });

  if (this.model && this.options['create-model']) {
    // TODO: pass --coffee option to model if coffee was enabled
    this.hookFor('backbone-amd', { as: 'model', args: [this.model], options: this.options })
  }
}

util.inherits(Generator, generator.NamedBase);

Generator.prototype.createViewFiles = function createViewFiles() {
  var ext = this.options.coffee ? 'coffee' : 'js';
  this.template('collection.' + ext, path.join('app/scripts/collections', this.name + '.' + ext));
};
github mrichard / generator-marionette / controller / index.js View on Github external
function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));

  this.argument('inherit', { type: String, required: false });

  // invoke  mocha
  this.hookFor('mocha-amd', { 
    as: 'unitTest', 
    args: [this.name, 'controller', 'controllers']
  });
}
github mrichard / generator-marionette / region / index.js View on Github external
function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));

  this.argument('inherit', { type: String, required: false });

  // invoke  mocha
  this.hookFor('mocha-amd', { 
    as: 'unitTest', 
    args: [this.name, 'region', 'regions']
  });
}

util.inherits(Generator, generator.NamedBase);

Generator.prototype.createRegionFiles = function createRegionFiles() {
  var ext = 'js';
  var baseDir = validDir.getValidatedFolder( 'app/' );

  this.template('region.' + ext, path.join(baseDir + 'scripts/regions', this.name + '.' + ext));
};
github mrichard / generator-marionette / layout / index.js View on Github external
this.tmplOrig = this.name;
  this.tmpl = this.name + '_tmpl';
  this.tmplLocation = 'layout';

  if ( this.tmplOrig && this.options['create-all'] ) {
    this.hookFor('marionette', { as: 'tmpl', args: [this.tmplOrig, this.tmplLocation], options: this.options });
  }

  // invoke  mocha
  this.hookFor('mocha-amd', { 
    as: 'unitTest', 
    args: [this.name, 'layout', 'views/layout']
  });
}

util.inherits(Generator, generator.NamedBase);

Generator.prototype.createLayoutFiles = function createLayoutFiles() {
  var ext = 'js';
  var baseDir = validDir.getValidatedFolder( 'app/' );

  this.template('layout.' + ext, path.join(baseDir + 'scripts/views/layout', this.name + '.' + ext));
};
github mrichard / generator-marionette / approuter / index.js View on Github external
module.exports = Generator;

function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));

  // invoke  mocha
  this.hookFor('mocha-amd', { 
    as: 'unitTest', 
    args: [this.name, 'approuter', 'approuters']
  });
  
}

util.inherits(Generator, generator.NamedBase);

// prompts
Generator.prototype.askFor = function askFor() {
  var cb = this.async();

  // ask about inheriting, controller, and are we creating the contoller
  var prompts = [{
    name: 'inherit',
    message: 'AppRouter to inherit from?',
    default: 'none'
  },
  {
    name: 'contoller',
    message: 'What is the ' + this.name + ' AppRouter\'s Controller?',
    validate: function( input ) {
      if( !input ) {
github angular-fullstack / generator-angular-fullstack / src / generators / openshift / index.js View on Github external
var spawn = childProcess.spawn;

var Generator = module.exports = function Generator() {
  yeoman.Base.apply(this, arguments);
  this.sourceRoot(path.join(__dirname, './templates'));

  try {
    this.appname = require(path.join(process.cwd(), 'bower.json')).name;
  } catch (e) {
    this.appname = path.basename(process.cwd());
  }
  this.appname = s.slugify(this.appname).split('-').join('');
  this.filters = this.config.get('filters') || {};
};

util.inherits(Generator, yeoman.NamedBase);

Generator.prototype.askForName = function askForName() {
  var done = this.async();

  var prompts = [{
    name: 'deployedName',
    message: 'Name to deploy as:',
    default: this.appname
  }];

  this.prompt(prompts, function (props) {
    this.deployedName = s.slugify(props.deployedName).split('-').join('');
    done();
  }.bind(this));
};
github abiee / generator-backbone-amd / router / index.js View on Github external
/*jshint latedef:false */
var generator  = require('yeoman-generator');
var util       = require('util');
var path       = require('path');

module.exports = Generator;

function Generator() {
  generator.NamedBase.apply(this, arguments);
  var dirPath = this.options.coffee ? '../templates/coffeescript/' : '../templates/javascript';
  this.sourceRoot(path.join(__dirname, dirPath));
  this.argument('model', { type: String, required: false });
  this.option('coffee', { desc: 'CoffeeScript instead standard JavaScript' });
}

util.inherits(Generator, generator.NamedBase);

Generator.prototype.createViewFiles = function createViewFiles() {
  var ext = this.options.coffee ? 'coffee' : 'js';
  this.template('router.' + ext, path.join('app/scripts/routers', this.name + '.' + ext));
};