forked from stripe-archive/jquery.payment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
38 lines (31 loc) · 1.09 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
{spawn} = require 'child_process'
path = require 'path'
binPath = (bin) -> path.resolve(__dirname, "./node_modules/.bin/#{bin}")
runExternal = (cmd, args, callback = process.exit) ->
child = spawn(binPath(cmd), args, stdio: 'inherit')
child.on('error', console.error)
child.on('close', callback)
runSequential = (cmds, status = 0) ->
process.exit status if status or !cmds.length
cmd = cmds.shift()
cmd.push (status) -> runSequential cmds, status
runExternal.apply null, cmd
task 'build', 'Build lib/ from src/', ->
runExternal 'coffee',
['-c', '-o', 'lib', 'src'],
-> invoke 'minify'
task 'minify', 'Minify lib/', ->
runExternal 'uglifyjs', [
'lib/jquery.payment.js',
'--mangle',
'--compress',
'--output',
'lib/jquery.payment.min.js'
]
task 'watch', 'Watch src/ for changes', ->
runExternal 'coffee', ['-w', '-c', '-o', 'lib', 'src']
task 'test', 'Run tests', ->
runSequential [
['mocha', ['--compilers', 'coffee:coffee-script/register', 'test/jquery.coffee']]
['mocha', ['--compilers', 'coffee:coffee-script/register', 'test/zepto.coffee']]
]