-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
59 lines (41 loc) · 1.53 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
47
48
49
50
51
52
53
54
55
56
57
58
59
{exec} = require 'child_process'
task 'test', 'Runs all Jasmine specs in spec/ folder', ->
test()
task 'compile', 'Compiles coffee in source/ to js in bin/', ->
compile()
# task 'stitch', 'Stitches all app .js files', ->
# stitch()
task 'compress', 'Runs UglifyJS on stitched file in order to compress it', ->
compress()
task 'build', 'Does the full build magic', ->
# compile -> test -> stitch -> compress()
compile -> test -> compress()
task 'develop', 'Only compile and stitch, don\'t test or compress', ->
# compile -> stitch()
compile()
test = (callback) ->
console.log "Running Jasmine specs"
exec 'jasmine-node --noStack --coffee spec/', (err, stdout, stderr) =>
console.log stdout + stderr
# hack to work around jasmine-node's bad return vals:
# throw "Tests fail. Build fails. You fail." if ~stdout.indexOf "Expected"
callback?()
compile = (callback) ->
exec 'coffee -o bin/ -c source/', (err, stdout, stderr) ->
throw err if err
console.log "Compiled coffee files"
callback?()
# stitch = (callback) ->
# stitch = require 'stitch'
# fs = require 'fs'
# myPackage = stitch.createPackage paths: [__dirname + '/bin', __dirname + '/vendor']
# myPackage.compile (err, source) ->
# fs.writeFile 'app.js', source, (err) ->
# throw err if err
# console.log "Stitched js files"
# callback?()
compress = (callback) ->
exec 'uglifyjs bin/ra.js -o bin/ra.min.js', (err, stdout, stderr) ->
throw err if err
console.log "Compressed ra.js to ra.min.js"
callback?()