-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCakefile
42 lines (29 loc) · 930 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
39
40
41
42
{print} = require 'util'
{spawn, exec} = require 'child_process'
path = require 'path'
option '-p', '--path [PATH]', 'Test path to run (from tests/)'
task 'test', (options) ->
testPath = ''
if options.path
testPath = path.join 'test/', "#{options.path}.coffee"
exec "NODE_ENV=test
./node_modules/.bin/mocha
#{testPath}
--compilers coffee:coffee-script
--require coffee-script/register
--colors
--reporter spec
--timeout 20000
", (err, output) ->
throw err if err
console.log output
task 'build', 'Compile CoffeeScript source files', ->
build false
task 'watch', 'Watch CoffeeScript files for changes', ->
build true
build = (watch) ->
options = ['-b', '-c', '-o', 'lib/', 'src/']
if watch then options.unshift '-w'
coffee = spawn 'coffee', options
coffee.stdout.on 'data', (data) -> print data
coffee.stderr.on 'data', (data) -> print data