-
Notifications
You must be signed in to change notification settings - Fork 1
/
Cakefile
53 lines (40 loc) · 1.48 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
fs = require 'fs'
path = require 'path'
childProc = require 'child_process'
verbose = true
colored = true
extendGlobalWith = (obj) ->
for key, val of obj
global[key] = val
checkAndRemoveFile = (filepath) ->
if path.existsSync(filepath)
return fs.unlinkSync(filepath)
task 'test', 'run the full spec test suite', ->
try
jasmine = require './third_party/jasmine-node/lib/jasmine-node'
catch requireError
console.log 'missing a development testing dependency:'
process.stderr.write(requireError + '\n')
process.exit 1
extendGlobalWith jasmine
for arg in process.argv
switch arg
when '--no-color' then colored = false
when '--silent' then verbose = false
specPath = path.join __dirname, 'spec'
afterSpecRun = (runner, log) ->
failures = runner.results().failedCount
if failures then process.exit 1 else process.exit 0
pattern = new RegExp "spec\.(js|coffee)$", "i"
jasmine.executeSpecsInFolder specPath, afterSpecRun, verbose, colored, pattern
task 'update', 'update the project repository', ->
checkAndRemoveFile './bin/cake'
checkAndRemoveFile './bin/coffee'
checkAndRemoveFile './bin/nave'
childProc.exec 'bin/init', (err, stdout, stderr) ->
if err
return process.stderr.write err.toString()
if stdout
return console.log stdout
if stderr
return process.stderr.write stderr.toString()