I'm trying to develop a custom generator for Yeoman using CoffeeScript but I'm facing a problem. When I use the hookFor
method in the constructor of my class Generator
, I get a warning hookFor must be used within the constructor when I try to init my project with Yeoman and my custom generator. Here is the code of my generator in index.coffee :
path = require 'path'
util = require 'util'
yeoman = require '../../../../'
module.exports = class Generator extends yeoman.generators.Base
constructor: ->
super()
@directories = ['controllers', 'helpers', 'models', 'templates', 'views']
@hookFor 'artefact:controller', args: ['App']
deploy: ->
@directory '.', '.'
@mkdir path.join 'dev', directory for directory in @directories
Any help will be appreciated. Thanks.