/
Cakefile
49 lines (39 loc) · 1.33 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
exec = require('shortcake').exec.interactive
option '-g', '--grep [filter]', 'test filter'
option '-v', '--version [<newversion> | major | minor | patch | build]', 'new version'
task 'clean', 'clean project', (options) ->
exec 'rm -rf lib'
exec 'rm -rf .test'
task 'build', 'build project', (options) ->
exec 'node_modules/.bin/coffee -bcm -o lib/ src/'
exec 'node_modules/.bin/coffee -bcm -o .test/ test/'
task 'build-min', 'build project', (options) ->
exec 'node_modules/.bin/coffee -bc -o lib/ src/'
task 'watch', 'watch for changes and recompile project', ->
exec 'node_modules/.bin/coffee -bcmw -o lib/ src/'
exec 'node_modules/.bin/coffee -bcmw -o .test test/'
task 'test', 'run tests', (options) ->
invoke 'build', ->
test = options.test ? '.test'
if options.grep?
grep = "--grep #{options.grep}"
else
grep = ''
exec "NODE_ENV=test ./node_modules/.bin/mocha
--colors
--reporter spec
--timeout 5000
--compilers coffee:coffee-script/register
--require postmortem/register
#{grep}
#{test}"
task 'gh-pages', 'Publish docs to gh-pages', ->
brief = require 'brief'
brief.update()
task 'publish', 'publish project', (options) ->
newVersion = options.version ? 'patch'
exec """
git push
npm version #{newVersion}
npm publish
""".split '\n'