1 | fs = require 'fs'
|
2 | {exec} = require 'child_process'
|
3 |
|
4 | task 'tests', 'run tests through mocha', ->
|
5 | console.log "Run tests with Mocha..."
|
6 | command = "mocha tests.coffee --reporter spec "
|
7 | command += "--compilers coffee:coffee-script --colors"
|
8 | exec command, (err, stdout, stderr) ->
|
9 | console.log stdout
|
10 | if err
|
11 | console.log "Running mocha caught exception: \n" + err
|
12 | process.exit 1
|
13 | else
|
14 | process.exit 0
|
15 |
|
16 | task "build", "Compile coffee files to JS", ->
|
17 | console.log "Compile main file..."
|
18 | command = "coffee -c main.coffee"
|
19 | exec command, (err, stdout, stderr) ->
|
20 | if err
|
21 | console.log "Running coffee-script compiler caught exception: \n" + err
|
22 | process.exit 1
|
23 | else
|
24 | console.log "Compilation succeeded."
|
25 |
|
26 | console.log stdout
|
27 |
|
28 | task "lint", "Run coffeelint on source files", ->
|
29 | command = "coffeelint -f coffeelint.json main.coffee"
|
30 | exec command, (err, stdout, stderr) ->
|
31 | console.log stdout
|