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