forked from noflo/noflo
/
Cakefile
27 lines (21 loc) · 822 Bytes
/
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
exec = require('child_process').exec
fs = require "fs"
buildFile = (parentPath, dir, file) ->
exec "coffee -o #{parentPath}/#{dir} -c #{parentPath}/src/#{dir}/#{file}", (err, stdout, stderr) ->
console.log stderr if stderr
buildDir = (path) ->
console.log "Compiling CoffeeScript from 'src/#{path}' to '#{path}"
fs.readdir "#{__dirname}/src/#{path}", (err, files) ->
return console.log err if err
files.forEach (file) ->
fs.stat "#{__dirname}/src/#{path}/#{file}", (err, stats) ->
return buildFile __dirname, path, file if file.indexOf(".coffee") isnt -1
return unless stats.isDirectory()
buildDir "#{path}/#{file}"
task 'build', ->
buildDir "lib"
buildDir "components"
buildDir "bin"
task 'test', ->
exec 'nodeunit test', (err) ->
console.log err if err