/
Cakefile
38 lines (31 loc) · 845 Bytes
/
Cakefile
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
fs = require 'fs'
{print} = require 'sys'
{exec, spawn} = require 'child_process'
REPORTER = "min"
task "test", "run tests", ->
test()
task 'clean', 'Remove lib/', ->
clean()
task 'build', 'Build lib/ from src/', ->
build()
build = (callback) ->
coffee = spawn 'coffee', ['-c', '-o', 'lib', 'src']
coffee.stderr.on 'data', (data) ->
process.stderr.write data.toString()
coffee.stdout.on 'data', (data) ->
print data.toString()
coffee.on 'exit', (code) ->
callback?() if code is 0
clean = (callback) ->
rm = spawn 'rm', ['-rf', 'lib']
rm.on 'exit', (code) ->
callback?() if code is 0
test = () ->
exec "NODE_ENV=test NODE_PATH=.
./node_modules/.bin/mocha
--compilers coffee:coffee-script
--reporter #{REPORTER}
--colors
", (err, output) ->
throw err if err
console.log output