-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
44 lines (35 loc) · 1.14 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
{print} = require 'util'
{spawn, exec} = require 'child_process'
mocha = require 'mocha'
build = (watch, callback) ->
if typeof watch is 'function'
callback = watch
watch = false
options = ['-c', '-o', 'lib', 'src']
options.unshift '-w' if watch
coffee = spawn 'coffee', options
coffee.stdout.on 'data', (data) -> print data.toString()
coffee.stderr.on 'data', (data) -> print data.toString()
coffee.on 'exit', (status) -> callback?() if status is 0
files = [
"ss-cucumber.coffee"
]
buildDocs = (callback) ->
for file in files
exec "node_modules/docco/bin/docco src/#{file}",
(err, stdout, stderr) ->
print stdout if stdout?
print stderr if stderr?
test = (callback) ->
Mocha = new mocha
for file in files
Mocha.addFile "test/#{file.replace('.coffee','_test.coffee')}"
Mocha.run()
task 'build', 'Compiles source files in src directory, and outputs to the lib directory', ->
build()
task 'docs', 'Generates docs for all the source files', ->
buildDocs()
task 'watch', 'Recompile CoffeeScript source files when modified', ->
build true
task 'test', 'Run mocha specs', ->
test()