-
Notifications
You must be signed in to change notification settings - Fork 2
/
Cakefile
46 lines (34 loc) · 1.21 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
45
46
{spawn, exec} = require "child_process"
watch = require "nodewatch"
task "spec", "Runs the Jasmine specs.", ->
header()
jasmine = spawn "node", ["node_modules/jasmine-node/lib/jasmine-node/cli.js", "--coffee", "spec"]
jasmine.stdout.on "data", (data) ->
process.stdout.write data
jasmine.stderr.on "data", (data) ->
process.stderr.write data
jasmine.stdin.end()
task "watch", "Watches for file changes, recompiling CoffeeScript and running the Jasmine specs.", ->
console.log "Watching Bang for changes...\n"
invoke "spec"
watch.add("src").add("spec").onChange (file, prev, cur) ->
exec "coffee -co lib src", (error, stdout, stderr) ->
throw error if error
invoke "spec"
task "docs", "Regenerate the Docco annotated source.", ->
exec "docco -l classic -o docs src/*", (error, stdout, stderr) ->
throw error if error
header = ->
divider = "------------"
console.log divider, dateString(), divider
dateString = ->
d = new Date
h = d.getHours()
m = d.getMinutes()
s = d.getSeconds()
meridiem = if h >= 12 then "PM" else "AM"
h -= 12 if h > 12
h = 12 if h is 0
m = "0" + m if m < 10
s = "0" + s if s < 10
"#{d.toLocaleDateString()} #{h}:#{m}:#{s} #{meridiem}"