view modules.js @ 36:26eb015a7c40

Really should learn that “hg addremove” is good.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 10 Nov 2010 01:43:25 +0100
parents b2faacfefb90
children bc717575e66a
line wrap: on
line source

var modules = exports;

var files = require('fs').readdirSync('modules');
var regex = /^mod_.*\.js/;

for (var i in files) {
	var file = files[i];
	if (!regex.test(file))
		continue;

	var module = require('./modules/' + files[i]);
	for (var j in module) {
		if (typeof modules[j] != 'undefined')
			console.log('WARNING: module '+j+' already loaded.');

		modules[j] = module[j];
	}
}