-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCakefile
More file actions
55 lines (47 loc) · 1.44 KB
/
Cakefile
File metadata and controls
55 lines (47 loc) · 1.44 KB
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
55
Promise = require "bluebird"
fs = Promise.promisifyAll require "fs"
{exec} = require "child-process-promise"
task "all", "Build source, generate documentation, and run tests", (opts) ->
Promise.join build(opts), codo(opts), mocha(opts)
.then ([b, c, m]) ->
console.log c.stdout
console.error c.stderr
console.log m.stdout
console.error m.stderr
.catch (err) ->
console.log "Error during build:"
console.log err.stdout
console.error err.stderr
task "build", "Compile source code", (opts) ->
build opts
.then ->
console.log "Build done."
task "docs", "Generate documentation", (opts) ->
codo opts
.then ->
console.log "Documentation complete."
task "test", "Test the code", (opts) ->
mocha opts
.then (res) ->
console.log res.stdout
console.log res.stderr
console.log "Testing complete."
build = (opts) ->
exec "$(npm bin)/coffee --compile --output dist/ src/"
.then ->
addShebang opts
.then ->
console.log "Built CoffeeScript source."
addShebang = (opts) ->
fs.readFileAsync "#{__dirname}/dist/console.js", "utf8"
.then (file) ->
"""
#!/usr/bin/env node
#{file}
"""
.then (file) ->
fs.writeFileAsync "#{__dirname}/dist/console.js", file
codo = (opts) ->
exec "FORCE_COLOR=1 $(npm bin)/codo"
mocha = (opts) ->
exec "FORCE_COLOR=1 PATH=\"$PATH:$(npm bin)\" mocha --compilers coffee:coffee-script/register"