Cakefile 876 B

123456789101112131415161718192021222324252627
  1. {spawn, exec} = require 'child_process'
  2. fs = require 'fs'
  3. task 'build', 'build the whole jam', (cb) ->
  4. console.log "Building"
  5. files = fs.readdirSync 'src'
  6. files = ('src/' + file for file in files when file.match(/\.coffee$/))
  7. clearLibJs ->
  8. runIced ['-I', 'inline', '-c', '-o', 'lib/'].concat(files), ->
  9. runIced ['-I', 'inline', '-c', 'index.coffee'], ->
  10. console.log "Done building."
  11. cb() if typeof cb is 'function'
  12. runIced = (args, cb) ->
  13. proc = spawn 'iced', args
  14. console.log args
  15. proc.stderr.on 'data', (buffer) -> console.log buffer.toString()
  16. proc.on 'exit', (status) ->
  17. process.exit(1) if status != 0
  18. cb() if typeof cb is 'function'
  19. clearLibJs = (cb) ->
  20. files = fs.readdirSync 'lib'
  21. files = ("lib/#{file}" for file in files when file.match(/\.js$/))
  22. fs.unlinkSync f for f in files
  23. cb()