-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cakefile
40 lines (31 loc) · 1.03 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
{print} = require 'util'
{spawn} = require 'child_process'
async = require 'async'
PLUGIN_NAME = 'tree'
launch = (command, options = [], callback) ->
app = spawn command, options
app.stderr.on 'data', (data) ->
process.stderr.write data.toString()
app.stdout.on 'data', (data) ->
print data.toString()
app.on 'exit', (code) ->
callback?() if code is 0
compile = (callback) ->
launch 'coffee', ['-m', '-c', '-o', 'lib', 'src'], (callback or undefined)
watch = ->
launch 'coffee', ['-w', '-c', '-o', 'lib', 'src']
minify = (callback) ->
launch 'uglifyjs', ['-o', "lib/jquery.#{PLUGIN_NAME}.min.js", "lib/jquery.#{PLUGIN_NAME}.js", '-m'], (callback or undefined)
build = (callback) ->
async.series [
(callback) ->
compile ->
callback null
(callback) ->
minify ->
callback null
]
task 'compile', 'Compile lib/ from src/', compile
task 'watch', 'Watch src/ for changes', watch
task 'minify', 'Minify the script after build', minify
task 'build', 'Compile, minify, and run tests', build