-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSakefile
103 lines (83 loc) · 2.68 KB
/
Sakefile
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use 'sake-bundle'
use 'sake-outdated'
use 'sake-publish'
use 'sake-version'
option '-b', '--browser [browser]', 'browser to use for tests'
option '-g', '--grep [filter]', 'test filter'
option '-t', '--test [test]', 'specify test to run'
option '-v', '--verbose', 'enable verbose test logging'
task 'clean', 'clean project', ->
exec 'rm -rf lib'
task 'build', 'build js', ['build:static'], ->
bundle.write
entry: 'src/index.coffee'
compilers:
coffee:
version: 1
task 'build:min', 'build js for production', ['build'], ->
yield bundle.write
entry: 'src/index.coffee'
format: 'web'
external: false
sourceMap: false
browser: false
commonjs: true
compilers:
coffee:
version: 1
yield exec 'mv -f elcontrols.js el-controls.js'
yield exec 'uglifyjs el-controls.js -o el-controls.min.js'
yield exec 'cp lib/theme.css theme.css'
task 'build:static', 'build static assets', ->
exec '''
mkdir -p lib
bebop compile'
'''
server = do require 'connect'
task 'server', 'Run static server for tests', (cb) ->
port = process.env.PORT ? 3333
server.use (require 'serve-static') './test/fixtures'
server = require('http').createServer(server).listen port, cb
task 'test', 'Run tests', ['build', 'server'], (opts) ->
bail = opts.bail ? true
coverage = opts.coverage ? false
grep = opts.grep ? ''
test = opts.test ? 'test/'
verbose = opts.verbose ? ''
bail = '--bail' if bail
grep = "--grep #{opts.grep}" if grep
verbose = 'DEBUG=nightmare VERBOSE=true CROWDSTART_DEBUG=1' if verbose
if coverage
bin = 'istanbul --print=none cover _mocha --'
else
bin = 'mocha'
{status} = yield exec.interactive "NODE_ENV=test CROWDSTART_KEY='' CROWDSTART_ENDPOINT='' #{verbose}
#{bin}
--colors
--reporter spec
--timeout 10000000
--compilers coffee:coffee-script/register
--require co-mocha
--require postmortem/register
#{bail}
#{grep}
#{test}"
server.close()
process.exit status
task 'test:ci', 'Run tests', (opts) ->
invoke 'test', bail: true, coverage: true
task 'coverage', 'Process coverage statistics', ->
exec '''
cat ./coverage/lcov.info | coveralls
cat ./coverage/coverage.json | codecov
rm -rf coverage/
'''
task 'watch', 'watch for changes and recompile project', ['build'], ->
watch 'src/*', -> invoke 'build'
task 'watch:test', 'watch for changes and re-run tests', ->
invoke 'watch'
require('vigil').watch __dirname, (filename, stats) ->
if /^src/.test filename
invoke 'test'
if /^test/.test filename
invoke 'test', test: filename