Permalink
Browse files

Make the build process simpler

  • Loading branch information...
1 parent e4e646b commit 4427f30a0a08e17572b17717d7f05b9c4503eded @bergie bergie committed Sep 5, 2011
Showing with 18 additions and 8 deletions.
  1. +18 −8 Cakefile
View
@@ -1,13 +1,23 @@
exec = require('child_process').exec
+
+fs = require "fs"
+
+buildDir = (path) ->
+ console.log "Compiling CoffeeScript from 'src/#{path}' to '#{path}"
+ exec "coffee -o #{__dirname}/#{path} -c #{__dirname}/src/#{path}/*.coffee", (err, stdout, stderr) ->
+ console.log stderr if stderr
+
+ 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 unless stats.isDirectory()
+ buildDir "#{path}/#{file}"
+
task 'build', ->
- exec 'coffee -o lib -c src/lib/*.coffee', (err) ->
- console.log err if err
- exec 'coffee -o components -c src/components/*.coffee', (err) ->
- console.log err if err
- exec 'coffee -o components/HTTP -c src/components/HTTP/*.coffee', (err) ->
- console.log err if err
- exec 'coffee -o bin -c src/bin/*.coffee', (err) ->
- console.log err if err
+ buildDir "lib"
+ buildDir "components"
+ buildDir "bin"
task 'test', ->
exec 'nodeunit test', (err) ->

0 comments on commit 4427f30

Please sign in to comment.