public
Last active

  • Download Gist
Cakefile
CoffeeScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
fs = require 'fs'
{print} = require 'sys'
{spawn, exec} = require 'child_process'
{watchTree} = require 'watch-tree'
 
node = null
 
stream = (command, options, callback) ->
sub = spawn command, options
sub.stdout.on 'data', (data) -> print data.toString()
sub.stderr.on 'data', (data) -> print data.toString()
sub.on 'exit', (status) -> callback?() if status is 0
sub
 
build = (watch, callback) ->
if typeof watch is 'function'
callback = watch
watch = false
options = ['-c', '-o', 'lib', 'src']
options.unshift '-w' if watch
coffee = stream 'coffee', options, callback
 
start = ->
build ->
node?.kill()
options = ['lib/server.js']
node = stream 'node', options
 
task 'build', 'Compile CoffeeScript source files', ->
build()
 
task 'start', 'Run server', ->
start()
 
task 'dev', 'Run server and recompile when source is modified', ->
start()
watcher = watchTree 'src', 'sample-rate': 5
watcher.on 'fileModified', start
watcher.on 'fileCreated', start

why is it that i always run into this error

Error: ENOTDIR, not a directory 'src/server.coffee'

better when using 'fl-tree-watcher'

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.