mde/jake — Issue #76: Coffeescript example doesn't work
Author: tauren
Created: 2011-10-11 00:21:36+00:00
State: open

The coffeescript example in the readme doesn't work. I create a `Jakefile.coffee` file with the following in it:

sys = require('sys')

desc 'This is the default task.'
task 'default', (params) ->
console.log 'Ths is the default task.'
console.log(sys.inspect(arguments))
invoke 'new', []

task 'new', ->
console.log 'ello from new'
invoke 'foo:next', ['param']

namespace 'foo', ->
task 'next', (param) ->
console.log 'ello from next with param: ' + param

Then I running `jake` in the same directory. This results in the following error: "ReferenceError: invoke is not defined"

I can't see how that sample would have ever worked, as there is nowhere in the code where `invoke` is defined as a global (unless I missed it). Did I miss a `with` somewhere?

Invoke exists on the Task object and can be used like the Javascript examples show. So the following `Jakefile.coffee` works:

sys = require('sys')

desc 'This is the default task.'
task 'default', (params) ->
console.log 'Ths is the default task.'
console.log(sys.inspect(arguments))
jake.Task['new'].invoke()

task 'new', ->
console.log 'ello from new'
jake.Task['foo:next'].invoke ['param']

namespace 'foo', ->
task 'next', (param) ->
console.log 'ello from next with param: ' + param

Am I just missing something, or is the README wrong? If it is correct, what should I do to get it working?