Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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
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 ->
options = ['lib/server.js']
node = stream 'node', options
task 'build', 'Compile CoffeeScript source files', ->
task 'start', 'Run server', ->
task 'dev', 'Run server and recompile when source is modified', ->
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/'

zyll commented May 8, 2012

better when using 'fl-tree-watcher'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment