Skip to content
Newer
Older
100644 35 lines (27 sloc) 1.07 KB
adf6ce8 @bergie Add documentation generator
bergie authored
1 {exec} = require 'child_process'
2 fs = require 'fs'
4427f30 @bergie Make the build process simpler
bergie authored
3
938dc82 @bergie Build only the coffeescript files we find
bergie authored
4 buildFile = (parentPath, dir, file) ->
5 exec "coffee -o #{parentPath}/#{dir} -c #{parentPath}/src/#{dir}/#{file}", (err, stdout, stderr) ->
6 console.log stderr if stderr
7
4427f30 @bergie Make the build process simpler
bergie authored
8 buildDir = (path) ->
9 console.log "Compiling CoffeeScript from 'src/#{path}' to '#{path}"
10
11 fs.readdir "#{__dirname}/src/#{path}", (err, files) ->
12 return console.log err if err
13 files.forEach (file) ->
14 fs.stat "#{__dirname}/src/#{path}/#{file}", (err, stats) ->
938dc82 @bergie Build only the coffeescript files we find
bergie authored
15 return buildFile __dirname, path, file if file.indexOf(".coffee") isnt -1
4427f30 @bergie Make the build process simpler
bergie authored
16 return unless stats.isDirectory()
17 buildDir "#{path}/#{file}"
18
adf6ce8 @bergie Add documentation generator
bergie authored
19 # deal with errors from child processes
20 exerr = (err, sout, serr) ->
21 console.log err if err
22 console.log sout if sout
23 console.log serr if serr
24
25 task 'build', 'transpile CoffeeScript sources to JavaScript', ->
4427f30 @bergie Make the build process simpler
bergie authored
26 buildDir "lib"
27 buildDir "components"
28 buildDir "bin"
1cf1ead @bergie Build command so NoFlo can be run as JS
bergie authored
29
adf6ce8 @bergie Add documentation generator
bergie authored
30 task 'test', 'run the unit tests', ->
31 exec 'npm test', exerr
32
33 task 'doc', 'generate documentation for *.coffee files', ->
34 exec "docco-husky src", exerr
Something went wrong with that request. Please try again.