l@271
|
1 fs = require 'fs'
|
l@271
|
2 child = require 'child_process'
|
l@271
|
3
|
l@271
|
4 task 'test', 'run tests (requires development install)', (options) ->
|
l@271
|
5 process.env['NODE_PATH'] = './lib/:$NODE_PATH'
|
l@271
|
6 test = child.spawn 'mocha', ['--compilers', 'coffee:coffee-script/register', '-u', 'tdd', 'test']
|
l@271
|
7 test.stdout.pipe process.stdout
|
l@271
|
8 test.stderr.pipe process.stderr
|
l@271
|
9 test.on 'exit', (num) ->
|
l@271
|
10 return process.exit num
|
l@271
|
11
|
l@271
|
12 spawnMochaCov = (reporter) ->
|
l@271
|
13 return child.spawn 'mocha', ['--compilers', 'coffee:coffee-script/register', '-r', 'blanket', '-R', reporter, '-u', 'tdd', 'test']
|
l@271
|
14
|
l@271
|
15 task 'coverage', 'run tests with coverage check (requires development install)', (options) ->
|
l@271
|
16 process.env['NODE_PATH'] = './lib/:$NODE_PATH'
|
l@271
|
17 test = spawnMochaCov 'html-cov'
|
l@271
|
18 file = fs.createWriteStream 'coverage.html'
|
l@271
|
19 test.stdout.pipe file
|
l@271
|
20 test.stderr.pipe process.stderr
|
l@271
|
21 test.on 'exit', (num) ->
|
l@271
|
22 child.exec 'open ./coverage.html'
|
l@271
|
23
|
l@271
|
24 task 'coveralls', 'report coveralls to travis', (options) ->
|
l@271
|
25 process.env['NODE_PATH'] = './lib/:$NODE_PATH'
|
l@271
|
26 test = spawnMochaCov 'mocha-lcov-reporter'
|
l@271
|
27 report = child.spawn './node_modules/coveralls/bin/coveralls.js'
|
l@271
|
28 test.stdout.pipe report.stdin
|
l@271
|
29 test.stderr.pipe process.stderr
|
l@271
|
30
|
l@271
|
31 task 'doc', 'create md and html doc files', (options) ->
|
l@271
|
32 child.exec 'coffee -b -c examples/*', ->
|
l@271
|
33 child.exec 'docket lib/* examples/* -m', ->
|
l@271
|
34 child.exec 'docket lib/* examples/* -d doc_html'
|
l@271
|
35
|
l@271
|
36 task 'browserify', 'build for a browser', (options)->
|
l@271
|
37 fs.mkdir './build', ->
|
l@271
|
38 child.exec './node_modules/browserify/bin/cmd.js ./lib/index.js --standalone osc -o ./build/osc-min.js', ->
|
l@271
|
39 child.exec './node_modules/uglify-js/bin/uglifyjs -o ./build/osc-min.min.js ./build/osc-min.js'
|