-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCakefile
40 lines (32 loc) · 1.19 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
{spawn, exec} = require 'child_process'
call = (command, args = [], fn = null) ->
exec "#{command} #{args.join(' ')}", (err, stdout, stderr) ->
if err?
console.error "Error :"
return console.dir err
fn err if fn
system = (command, args) ->
spawn command, args, stdio: "inherit"
build = (fn = null) ->
call 'coffee', ['-c', '-o', 'lib', 'src']
call 'coffee', ['-c', '-o', 'examples', 'examples']
call 'coffee', ['-c', '-o', 'tests', 'tests']
do fn if fn
docgen = (fn = null) ->
system './node_modules/doxx/bin/doxx', ['--source', 'lib/', '--target', 'docs/', '--template', 'docgen/template.jade']
do fn if fn
watch = (fn = null) ->
system 'coffee', ['-w', '-c', '-o', 'lib', 'src']
system 'coffee', ['-w', '-c', '-o', 'examples', 'examples']
system 'coffee', ['-w', '-c', '-o', 'tests', 'tests']
do fn if fn
task 'watch', 'continually build the JavaScript code', ->
watch ->
console.log "Done !"
task 'build', 'build the JavaScript code', ->
build ->
console.log "Done !"
task 'docs', 'build the docs', ->
build ->
docgen ->
console.log "Done !"