balderdashy/sails — pull request #1118 by t3chnoboy (2013-11-18 18:52:40+00:00)
Title: Added generator --coffee option + ability to set language in configs

Added:
* ability to generate models, controllers and adapters in CoffeeScript
* separate templates for CoffeeScript
* ability to set controllers and adapters generation language in configs

**Examples:**
`sails generate model User --coffee`
generates: [User.coffee](https://gist.github.com/t3chnoboy/7512688)
`sails generate model User name:string password:string email:email age:number --coffee`
generates: [User.coffee](https://gist.github.com/t3chnoboy/7512645)
`sails generate controller User --coffee`
generates: [UserController.coffee](https://gist.github.com/t3chnoboy/7512718)
`sails generate controller User comment like create --coffee`
generates: [UserController.coffee](https://gist.github.com/t3chnoboy/7512751)

*note:* Indent looks broken in some gists. Probably a gist or vim-gist plugin issue. Generated files are properly indented.
![scrot](https://f.cloud.github.com/assets/2552790/1558378/4776efb8-4f88-11e3-9319-a51f2e68cd7a.png)

You can also set default generation language for controllers in config/controllers.js.

**Example:**
In new sails project `sails generate controller User` will generate User.js.
But if you add `language: 'coffee'` to config/controllers.js
`sails generate controller User` will generate [UserController.coffee](https://gist.github.com/t3chnoboy/7512718)
Removing `language: 'coffee'` or setting it to `language: 'js'` in config/controllers.js will restore default behavior.
For example `sails generate controller User`will generate UserController.js written in JavaScript.

*note:* You can't set default generation language for models because there is no config for models in config/