-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCakefile
More file actions
22 lines (19 loc) · 752 Bytes
/
Copy pathCakefile
File metadata and controls
22 lines (19 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{spawn} = require 'child_process'
#Find the coffee executable
findCoffee = (cb) ->
proc = spawn '/bin/which', ['coffee']
buf = ''
proc.stdout.on 'data', (buffer) -> buf += buffer.toString()
proc.on 'exit', (status) ->
cb(buf.trim()) if cb?
#Stolen from the Coffeescript cakefile.
compileCoffeeScript = (coffee, args, cb) ->
console.log "spawn '#{coffee}', [#{args.join(',')}]"
proc = spawn coffee, args
proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
proc.on 'exit', (status) ->
process.exit(1) if status != 0
cb() if typeof cb is 'function'
task 'build', 'Build WebShell', (cb) ->
findCoffee (coffee)->
compileCoffeeScript coffee, ['-c', '-o', 'lib', 'src/client.coffee', 'src/server.coffee'], cb