sys = require 'sys'
fs = require 'fs'
exec = require('child_process').exec
spawn = require('child_process').spawn
task 'watch', 'watches and compiles coffee file', ->
sys.puts "Spawning coffee watcher..."
coffee = spawn 'coffee', ['-cwl', '-o', "js", "coffee"]
[coffee].forEach (child) ->
child.stdout.on 'data', (data) ->
sys.print data
exec "notify-send Cakefile \"#{data}\""
child.stderr.on 'data', (data) ->
sys.print data
exec "notify-send \"Cakefile(fail)\" \#{data}\""