-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
55 lines (42 loc) · 1.34 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Coffee-Mug
# Cakefile
child_process = require 'child_process'
say = console.log
build = (callback)->
child_process.exec 'coffee -c *.coffee', (err,stdout,stderr)->
if err
say stderr
else
say 'compiled coffeemug'
child_process.exec 'coffee -c test/*.coffee', (err,stdout,stderr)->
if err
say stderr
else
console.log 'compiled coffeemug tests'
if callback
if typeof callback is 'function'
callback()
task 'build', 'Compile all coffeescript into javascript', build
test = (callback)->
# run all tests, and only call the callback if they all pass
#mocha_proc = child_process.spawn 'mocha' ,['--compilers','coffee:coffee-script','--colors','-R','list']
say 'running tests...'
mocha_proc = child_process.spawn 'mocha' ,['--colors','-R','spec']
mocha_proc.stdout.pipe(process.stdout, end:false )
mocha_proc.stderr.pipe(process.stderr, end:false )
mocha_proc.on 'exit',(code)->
if code == 0
say 'all tests passed'
if callback
callback()
else
say 'TEST FAIL'
task 'test', 'Run all mocha tests', ->
build ->
test()
task 'doc','generate "coffeemug_docs.html" using tests as examples', ->
build ->
test ->
g = require './generate_docs'
g.generate_docs ->
say 'task "doc" is complete'