forked from ysmood/nokit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nofile.coffee
70 lines (56 loc) · 1.44 KB
/
nofile.coffee
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
###
For help info run "npm run no -- -h"
###
kit = require './lib/kit'
module.exports = (task, option) ->
option '-a, --all', 'rebuild with dependencies, such as rebuild lodash.'
task 'default build b', ['clean'], 'build project', (opts) ->
kit.require 'drives'
buildLodash = ->
if opts.all
kit.spawn 'lodash', [
'strict', '-p'
'-o', 'lib/lodash.js'
]
buildJs = ->
kit.warp 'lib/**/*.js'
.run 'dist'
buildCoffee = ->
kit.warp 'lib/**/*.coffee'
.load kit.drives.coffee()
.run 'dist'
buildDoc = ->
kit.warp 'lib/*.coffee'
.load kit.drives.comment2md
h: 2, tpl: 'doc/readme.jst.md'
.run()
start = kit.flow [
buildLodash
buildJs
buildCoffee
buildDoc
]
start().catch (err) ->
kit.err err.stack
process.exit 1
option '-d, --debug', 'enable node debug mode'
option '-p, --port [8283]', 'node debug mode', 8283
task 'lab l', 'run and monitor "test/lab.coffee"', (opts) ->
args = ['test/lab.coffee']
if opts.debug
args.splice 0, 0, '--nodejs', 'debug'
kit.monitorApp { bin: 'coffee', args, watchList: ['test/*', 'lib/**'] }
task 'clean', 'clean dist & cache', (opts) ->
if opts.all
kit.all [
kit.remove 'dist'
kit.remove '.nokit'
]
option '-g, --grep <pattern>', 'test pattern', ''
task 'test t', ['build'], 'unit tests', (opts) ->
kit.spawn('junit', [
'-r', 'coffee-script/register'
'-g', opts.grep
'-t', 1000 * 20
'test/basic.coffee'
])