-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCakefile
44 lines (37 loc) · 1.32 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
{spawn, exec} = require 'child_process'
# Terminal colurs
bold = '\x1B[0;1m'
red = '\x1B[0;31m'
green = '\x1B[0;32m'
blue = '\x1B[0;36m'
reset = '\x1B[0m'
####################
# HELPER FUNCTIONS #
####################
log = (message, color, explanation) ->
console.log color + message + reset + ' ' + (explanation or '')
task 'build', 'Build javascript/map files', ->
log 'Building coffee files', blue
build = spawn "./node_modules/.bin/coffee", "-c -m ./src ./test".split(" ")
build.stdout.pipe process.stdout
build.stderr.pipe process.stderr
build.on 'exit', (code) ->
if code is 0
log '- Build complete', green
else
log '- Build failed', red
task 'test', 'Build and run test suite', ->
# Build the coffee files
log 'Building coffee files', blue
build = spawn "./node_modules/.bin/coffee", "-c -m ./src ./test".split(" ")
build.stdout.pipe process.stdout
build.stderr.pipe process.stderr
build.on 'exit', (code) ->
# Check for error
if code is 0
log 'Running test suite', blue
test = spawn "./node_modules/.bin/mocha", "--reporter spec --timeout 300000 ./test".split(" ")
test.stdout.pipe process.stdout
test.stderr.pipe process.stderr
else
log '- Build failed', red