Skip to content

Instantly share code, notes, and snippets.

@tuxracer
Last active December 21, 2015 16:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxracer/6332601 to your computer and use it in GitHub Desktop.
Save tuxracer/6332601 to your computer and use it in GitHub Desktop.
yeoman generator index file in coffeescript. Compare to https://gist.github.com/tuxracer/6336244 You can also use https://github.com/tuxracer/generator-generatorcs to get this
# Generated by https://github.com/tuxracer/generator-generatorcs
path = require 'path'
yeoman = require 'yeoman-generator'
module.exports = class ChaplinGenerator extends yeoman.generators.Base
constructor: (args, options, config) ->
yeoman.generators.Base.apply this, arguments
@on 'end', ->
@installDependencies skipInstall: options['skip-install']
@pkg = JSON.parse @readFileAsString path.join __dirname, '../package.json'
askFor: ->
cb = @async()
# have Yeoman greet the user.
console.log @yeoman
prompts = [
type: 'confirm'
name: 'someOption'
message: 'Would you like to enable this option?'
default: true
]
@prompt prompts, (props) =>
@someOption = props.someOption
cb()
app: ->
@mkdir 'app'
@mkdir 'app/templates'
@copy '_package.json', 'package.json'
@copy '_bower.json', 'bower.json'
projectfiles: ->
@copy 'editorconfig', '.editorconfig'
@copy 'jshintrc', '.jshintrc'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment