Skip to content

Instantly share code, notes, and snippets.

@tuxracer
Last active December 21, 2015 16:19
Show Gist options
  • 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