Skip to content

@TrevorBurnham /Cakefile
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
@sanandnarayan

why is it that i always run into this error

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

@zyll

better when using 'fl-tree-watcher'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.