-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cakefile
31 lines (23 loc) · 1.17 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
option '-k', '--key [KEY]', 'Set asana client key for tests.'
option '-w', '--workspace [WORKSPACE]', 'Set asana workspace for tests.'
{exec} = require "child_process"
call = (command, fn) ->
exec command, (err, stdout, stderr) ->
if err?
console.error "Error :"
return console.dir err
fn err if fn?
build = (fn) ->
call "coffee -c -o lib/node/ src/node/*.coffee", ->
call "rm -rf tmp && mkdir tmp && cp src/node/*.coffee src/browser/*.coffee tmp && browserify tmp/entry.coffee -o lib/browser/asana.js", ->
call "minifyjs lib/browser/asana.js > lib/browser/asana.min.js", ->
call "rm -rf tmp && mkdir tmp && cp src/node/*.coffee test/*.coffee test/browser/wrapper.coffee tmp && browserify tmp/wrapper.coffee -o test/browser/files/bundle.js", fn
task 'build', 'Compile coffee scripts into plain Javascript files', ->
build ->
console.log "Done!"
task 'test', 'Run the tests', (args) ->
key = args.key || process.env["ASANA_KEY"]
workspace = args.workspace || process.env["ASANA_WORKSPACE"]
build ->
exec "rm -rf tmp && mkdir tmp && cp src/node/*.coffee test/*.coffee tmp", ->
require("./tmp/api")(key, workspace)