-
Notifications
You must be signed in to change notification settings - Fork 44
/
Cakefile
34 lines (27 loc) · 1003 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
fs = require 'fs'
{print} = require 'util'
{spawn} = require 'child_process'
binPath = './node_modules/.bin/'
# Returns a string with the current time to print out.
timeNow = ->
today = new Date()
today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds()
# Spawns an application with `options` and calls `onExit`
# when it finishes.
run = (bin, options, onExit) ->
bin = binPath + bin
console.log timeNow() + ' - running: ' + bin + ' ' + (if options? then options.join(' ') else "")
cmd = spawn bin, options
cmd.stdout.on 'data', (data) -> print data.toString()
cmd.stderr.on 'data', (data) -> print data.toString()
cmd.on 'exit', (code) ->
console.log 'done.'
onExit?(code, options)
build = (callback) ->
options = ['-c', '-o', 'lib', 'src']
run('coffee', options)
task 'build', 'Build lib/ from src/', ->
build()
task 'watch', 'Watch src/ for changes', ->
options = ['-w', '-c', '-o', 'lib', 'src/bigbluebutton-api.coffee']
run('coffee', options)