Skip to content
Browse files

Synched Cakefile with zappa.

  • Loading branch information...
1 parent 380abd1 commit bbcdc312d0db76feffdcde18ab0cb5dbdf8224b7 @mauricemach committed Aug 7, 2011
Showing with 23 additions and 4 deletions.
  1. +23 −4 Cakefile
View
27 Cakefile
@@ -1,9 +1,28 @@
-exec = require('child_process').exec
+{spawn, exec} = require 'child_process'
+log = console.log
task 'build', ->
- exec 'coffee -o lib -c src/*.coffee', (err) ->
- console.log err if err
+ run 'coffee -o lib -c src/*.coffee'
task 'test', -> require('./test').run()
-task 'benchmark', -> require('./benchmark').run()
+task 'bench', -> require('./benchmark').run()
+
+task 'docs', ->
+ run 'docco src/coffeekup.coffee'
+
+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) -> log data.toString()
+ cmd.stderr.on 'data', (data) -> log data.toString()
+ process.on 'SIGHUP', -> cmd.kill()
+ cmd.on 'exit', (code) -> callback() if callback? and code is 0

0 comments on commit bbcdc31

Please sign in to comment.
Something went wrong with that request. Please try again.