Cakefile 624 B

12345678910111213141516171819
  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'
  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. result = UglifyJS.minify('lib/ipaddr.js')
  14. fs.writeFileSync('ipaddr.min.js', result.code)