Cakefile 658 B

123456789101112131415161718
  1. fs = require 'fs'
  2. CoffeeScript = require 'coffee-script'
  3. nodeunit = require 'nodeunit'
  4. UglifyJS = require 'uglify-js'
  5. task 'build', 'build the JavaScript files from CoffeeScript source', build = (cb) ->
  6. source = fs.readFileSync 'src/ipaddr.coffee', 'utf-8'
  7. fs.writeFileSync 'lib/ipaddr.js', CoffeeScript.compile source.toString()
  8. invoke 'test'
  9. invoke 'compress'
  10. task 'test', 'run the bundled tests', (cb) ->
  11. nodeunit.reporters.default.run ['test']
  12. task 'compress', 'uglify the resulting javascript', (cb) ->
  13. source = fs.readFileSync 'lib/ipaddr.js', 'utf-8'
  14. fs.writeFileSync('ipaddr.min.js', UglifyJS.minify(source).code)