Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (19 sloc) 743 Bytes
{spawn, exec} = require 'child_process'
task 'build', ->
run 'coffee -o lib -c src/*.coffee'
task 'test', ->
run './node_modules/.bin/mocha ./test/* --require should --reporter spec'
run = (args...) ->
for a in args
switch typeof a
when 'string' then command = a
when 'object'
if a instanceof Array then params = a
else options = a
when 'function' then callback = a
command += ' ' + params.join ' ' if params?
cmd = spawn '/bin/sh', ['-c', command], options
cmd.stdout.on 'data', (data) -> process.stdout.write data
cmd.stderr.on 'data', (data) -> process.stderr.write data
process.on 'SIGHUP', -> cmd.kill()
cmd.on 'exit', (code) -> callback() if callback? and code is 0