Skip to content

Commit

Permalink
Sync Thu Sep 04 2014 01:05:18 GMT+1000 (EST)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michieljoris committed Sep 3, 2014
1 parent affb286 commit e8f9f98
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/buildMonitor.js
Expand Up @@ -195,7 +195,7 @@ function init() {

console.log('Watching ' + monitoredDirs.toString());
filemon.watch(options);

console.log('going to build now...');
build().when(
function() {
if (websocketIsOpen) {
Expand Down
7 changes: 6 additions & 1 deletion src/utils.js
Expand Up @@ -3,6 +3,7 @@ var crypto = require('crypto');
var Path = require('path');

module.exports.saveFile = function saveFile(pathName, str, vow){

var oldHash, newHash;
try {
var sum = crypto.createHash('sha1');
Expand All @@ -16,7 +17,10 @@ module.exports.saveFile = function saveFile(pathName, str, vow){
sum.update(str);
newHash = sum.digest('hex');
// console.log(newHash, oldHash);
if (newHash === oldHash) return false;
if (newHash === oldHash) {
if (vow) vow.keep();
return true;
}
}
// console.log(orig.length, orig.toString());
// console.log('-=====================================');
Expand All @@ -25,6 +29,7 @@ module.exports.saveFile = function saveFile(pathName, str, vow){
try {
fs.outputFileSync(pathName, str, 'utf8');
if (vow) vow.keep();

} catch(e) {
console.log('Error in saveFile:', e);
if (vow) vow.breek('Error writing file '+ pathName + e.toString());
Expand Down

0 comments on commit e8f9f98

Please sign in to comment.