-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cakefile
46 lines (38 loc) · 1.38 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
{exec} = require 'child_process'
findExecutable = (executable, callback) ->
exec "test `which #{executable}` || echo 'Missing #{executable}'", (err, stdout, stderr) ->
throw new Error(err) if err
callback() if callback
build = (callback) ->
exec 'mkdir -p js', (err, stdout, stderr) ->
throw new Error(err) if err
exec "coffee --compile --output js/ src/", (err, stdout, stderr) ->
throw new Error(err) if err
callback() if callback
removeJS = (callback) ->
exec 'rm -fr lib/', (err, stdout, stderr) ->
throw new Error(err) if err
callback() if callback
checkDependencies = (callback) ->
findExecutable 'coffee', ->
findExecutable 'vows', (err, stdout) ->
(callback or console.log) (stdout)
test = (callback = console.log) ->
checkDependencies ->
build ->
exec "vows --spec test/*", (err, stdout) ->
callback(stdout)
publish = (callback = console.log) ->
build ->
findExecutable 'npm', ->
exec 'npm publish', (err, stdout) ->
callback(stdout)
dev_install = (callback = console.log) ->
build ->
findExecutable 'npm', ->
exec 'npm link .', (err, stdout) ->
callback(stdout)
task 'build', 'Build lib from src', -> build()
task 'test', 'Test project', -> test()
task 'publish', 'Publish project to npm', -> publish()
task 'dev-install', 'Install developer dependencies', -> dev_install()