jashkenas/coffee-script — pull request #2733 by mahnunchik (2013-02-27 12:12:01+00:00)
Title: Cake 'invoke' callback

Hi, I know that this topic has already been discussed:
https://github.com/jashkenas/coffee-script/issues/2404
https://github.com/jashkenas/coffee-script/pull/1822
https://github.com/jashkenas/coffee-script/pull/1030

And your opinion is that *cake* should be a pretty simple.
But this small fix (2 lines of code) solves the previous issues and some more
*Cakefile* in this repository will be better:
```
task 'build', 'build the CoffeeScript language from source', (options, cb) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffee-script'].concat(files), cb

task 'build:full', 'rebuild the source twice, and run the tests', ->
invoke 'build', ->
invoke 'build', ->
csPath = './lib/coffee-script'
csDir = path.dirname require.resolve csPath

for mod of require.cache when csDir is mod[0 ... csDir.length]
delete require.cache[mod]

unless runTests require csPath
process.exit 1
```
instead:
```
task 'build', 'build the CoffeeScript language from source', build = (cb) ->
files = fs.readdirSync 'src'
files = ('src/' + file for file in files when file.match(/\.(lit)?coffee$/))
run ['-c', '-o', 'lib/coffee-script'].concat(files), cb

task 'build:full', 'rebuild the source twice, and run the tests', ->
build ->
build ->
csPath = './lib/coffee-script'
csDir = path.dirname require.resolve csPath

for mod of require.cache when csDir is mod[0 ... csDir.length]
delete require.cache[mod]

unless runTests require csPath
process.exit 1
```

*build = (cb) ->* - is not simply and breaks "option" argument