Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 39 lines (36 sloc) 1.14 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
var fs = require('fs');
var sys = require('sys');
var uglify = require('uglify');
var jsp = uglify.parser;
var pro = uglify.uglify;

desc("build restfulie into one file");
task('default',['clean', 'build'], function(){
  console.log('Building Restfulie...');
});

desc('do the bizness');
task('build', [], function(){
  var lib = fs.readdirSync('client/lib/');
  var originalJSContent = [];
  for(var i = 0; i < lib.length; i++){
    if(lib[i].match('.swp')) {continue}
    console.log("appending " + lib[i]);
    var data = fs.readFileSync('client/lib/' + lib[i]);
    fs.createWriteStream('restfulie.js', {'flags' : 'a'}).write(data);
    originalJSContent.push(data);
  }
  var js = originalJSContent.join('');
  var ast = jsp.parse(js);
  ast = pro.ast_mangle(ast);
  ast = pro.ast_squeeze(ast);
  var compressedJS = pro.gen_code(ast);
  fs.createWriteStream('restfulie.min.js', {'flags' : 'a'}).write(compressedJS);
});

desc('clean the artifacts');
task("clean", [], function(){
  try{
    fs.unlinkSync('restfulie.js');
    fs.unlinkSync('restfulie.min.js');
  }catch(e){
    console.log("couldn't clean the artifacts...");
  }
});
Something went wrong with that request. Please try again.