-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCakefile
More file actions
51 lines (43 loc) · 2.25 KB
/
Cakefile
File metadata and controls
51 lines (43 loc) · 2.25 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
# build script adapted from ShareJ
{exec} = require 'child_process'
fs = require 'fs'
task 'build', 'Build the .js files', (options) ->
console.log('Compiling Coffee from coffee to source')
exec "coffee --compile --output source/ coffee/", (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
console.log('Compiling Coffee tests')
exec "coffee --compile --bare --output SpecRunner/ spec/", (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
exec "coffee --compile --bare --output SpecRunner/ SpecRunner/", (err, stdout, stderr) ->
throw err if err
console.log stdout + stderr
task 'docs', 'Build the doc files', (options) ->
console.log('Building docs to /docs')
exec "cp -rf ./coffee ./fields", (err, stdout, stderr) ->
throw err if err
# remove parts that throw errors, remove closures
data = fs.readFileSync("./fields/Fields.coffee", 'utf8').split("\n").slice(0, -6).join("\n")
fs.writeFileSync("./fields/Fields.coffee", data, "utf8")
data = fs.readFileSync("./fields/ContainerFields.coffee", 'utf8').split("\n").slice(6, -6)
data = data.map((x) -> x.slice(2))
fs.writeFileSync("./fields/ContainerFields.coffee", data.join("\n"), "utf8")
data = fs.readFileSync("./fields/localized/en/Fields.coffee", 'utf8').split("\n").slice(3, -6)
data = data.map((x) -> x.slice(2))
fs.writeFileSync("./fields/localized/en/Fields.coffee", data.join("\n"), "utf8")
exec "./node_modules/coffeedoc-lm/bin/coffeedoc --output ./api/fields --requirejs ./fields", (err, stdout, stderr) ->
throw err if err
exec "rm -rf ./fields"
task 'watch', 'Watch coffee directory and build the .js files', (options) ->
console.log('Watching Coffee in coffee and compiling to source')
cp = exec "coffee --watch --output source/ coffee/"
cp.stdout.on "data", (data) -> console.log(data)
cp.stderr.on "data", (data) -> console.log(data)
console.log('Watching Coffee in spec and compiling to SpecRunner')
cp2 = exec "coffee --watch --bare --output SpecRunner/ spec/"
cp2.stdout.on "data", (data) -> console.log(data)
cp2.stderr.on "data", (data) -> console.log(data)
cp3 = exec "coffee --watch --bare --output SpecRunner/ SpecRunner/"
cp3.stdout.on "data", (data) -> console.log(data)
cp3.stderr.on "data", (data) -> console.log(data)