Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

<WARN> name is not defined... in initializer example #20

Closed
robdodson opened this Issue Sep 16, 2012 · 1 comment

Comments

Projects
None yet
2 participants
Member

robdodson commented Sep 16, 2012

From the docs:

And now let’s change the generator to copy this template when invoked:

var util = require('util'),
    yeoman = require('../../../');

module.exports = Generator;

function Generator() {
  yeoman.generators.NamedBase.apply(this, arguments);
  // if your templates/ location differ, feel free to set it with sourceRoot()
}

util.inherits(Generator, yeoman.generatos.NamedBase);

Generator.prototype.copyInitializerFile = function() {
  this.copy('initializer.js', 'config/initializers/' + name + '.js');
};

And let’s execute our generator:

$ yeoman generate initializer core_extensions

Problems

  • yeoman = require('../../../'); doesn't seem to work
  • $ yeoman generate initializer core_extensions generate command doesn't exist. should be init?
  • name is not defined

I'm guessing the offending line is:

Generator.prototype.copyInitializerFile = function() {
  this.copy('initializer.js', 'config/initializers/' + name + '.js');
};

@robdodson robdodson referenced this issue in yeoman/yeoman Sep 16, 2012

Merged

Fix initializer example #477

Member

ericduran commented Oct 4, 2012

It seems this was fixed in the yeoman repo.

@ericduran ericduran closed this Oct 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment