Skip to content

Commit

Permalink
meta-join script updates
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Oct 25, 2012
1 parent 94b86a1 commit 5f72e94
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/loader/scripts/meta_join.js
Expand Up @@ -11,6 +11,12 @@ var fs = require('fs'),
crypto = require('crypto'),
md5sum = crypto.createHash('md5');

var md5 = function(str) {
md5sum.update(str);
var sum = md5sum.digest('hex');
return sum;
};

var dirs = fs.readdirSync(base);

var metaFiles = [];
Expand Down Expand Up @@ -96,8 +102,7 @@ fs.writeFileSync(jsonOut, jsonStr, 'utf8');

console.log('Done, processing conditionals.');

md5sum.update(jsonStr);
var sum = md5sum.digest('hex');
var sum = md5(jsonStr);

console.log('Using MD5:', sum);

Expand All @@ -118,9 +123,9 @@ Object.keys(out).forEach(function(name) {
file = conds[cName];
if (exists(file)) {
var test = fs.readFileSync(file, 'utf8');
mod.condition.test = file;
mod.condition.test = md5(file);
cond.test = test;
tests.push({ key: file, test: test });
tests.push({ key: md5(file), test: test });
} else {
console.error('Failed to locate test file: ', file);
process.exit(1);
Expand Down

0 comments on commit 5f72e94

Please sign in to comment.