Skip to content

Commit

Permalink
Building fine... having some issues with built Aloha Editor though.
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Mar 25, 2011
1 parent 608c812 commit 852869f
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 8 deletions.
23 changes: 17 additions & 6 deletions lib/buildr.js
Expand Up @@ -281,26 +281,29 @@

// JS
config.files.js.each(function(key,value){
config.files.js[key] = me.shrinkPath(value);
value = me.shrinkPath(value);
if ( isIgnored(config.ignore.js, value) ) {
config.src.img[key] = false;
value = false;
}
config.files.js[key] = value;
});

// CSS
config.files.css.each(function(key,value){
config.files.css[key] = me.shrinkPath(value);
value = me.shrinkPath(value);
if ( isIgnored(config.ignore.css, value) ) {
config.src.css[key] = false;
value = false;
}
config.files.css[key] = value;
});

// IMG
config.files.img.each(function(key,value){
config.files.img[key] = me.shrinkPath(value);
value = me.shrinkPath(value);
if ( isIgnored(config.ignore.img, value) ) {
config.src.img[key] = false;
value = false;
}
config.files.img[key] = value;
});

// ----------------------------------------------------------------------
Expand Down Expand Up @@ -336,6 +339,14 @@
// Compress
this.compress();

// Compare
var
srcStats = util.dirstatsSync(config.directories.src),
outStats = util.dirstatsSync(config.directories.out);

// Output Compare
console.log("\nReduced source from\n\t["+srcStats.files+"] files and ["+srcStats.size+"] bytes to\n\t["+outStats.files+"] files and ["+outStats.size+"] bytes");

// Log
console.log("\nCompilation Complete :)");
},
Expand Down
51 changes: 49 additions & 2 deletions lib/util.js
Expand Up @@ -16,11 +16,58 @@
* @param {Path} dst
*/
cpSync: function(src,dst){
var txt = fs.readFileSync(src).toString();
fs.writeFileSync(dst,txt);
var txt = fs.readFileSync(src,'binary');
fs.writeFileSync(dst,txt,'binary');

// Done
return true;
},

/**
* Return a directories size recursively synchronously
* @param {String} path
* @return {Integer} size
*/
dirstatsSync: function(path){
// Prepare
var
me = this,
stats = {
size: 0,
files: 0
};

// Check
try {
fs.statSync(path);
}
catch ( e ) { }

// Cycle
fs.readdirSync(path).each(function(key,file){
// Prepare
var
filePath = path+'/'+file,
fileStat = fs.statSync(filePath);

// Handle
if ( fileStat.isDirectory() ) {
// Recurse
var dirStats = me.dirstatsSync(filePath);
stats.files += dirStats.files;
stats.size += dirStats.size;
}
else {
// Copy
stats.files++;
stats.size += fileStat.size;
}
});

// Return
return stats;
},

/**
* Recursively remove a directory
* @param {Path} src
Expand Down

0 comments on commit 852869f

Please sign in to comment.