var fs = require('fs'),
_ = require('underscore'),
WebListener = require('./weblistener.js'),
- config = require('./configuration.js');
+ config = require('./configuration.js'),
+ rehash = require('./rehash.js');
break;
+
+ case 'rehash':
+ (function () {
+ rehash.rehashAll();
+ console.log('Rehashed');
+ })();
+
+ break;
+
default:
console.log('Unrecognised command: ' + data);
}
--- /dev/null
+var util = require('util'),\r
+ events = require('events'),\r
+ _ = require('underscore');\r
+\r
+\r
+\r
+function Rehash() {}\r
+util.inherits(Rehash, events.EventEmitter);\r
+\r
+Rehash.prototype.rehashAll = function () {\r
+ var files = [\r
+ './client.js',\r
+ './clientcommands.js',\r
+ //'./configuration.js',\r
+ './httphandler.js',\r
+ './irc/commands.js',\r
+ './irc/connection.js',\r
+ './weblistener.js'\r
+ ];\r
+ \r
+ _.each(files, function (file) {\r
+ delete require.cache[require.resolve(file)];\r
+ require(file);\r
+ });\r
+\r
+ this.emit('rehashed', [files]);\r
+};\r
+\r
+\r
+\r
+module.exports = new Rehash();
\ No newline at end of file
url = require('url'),
_ = require('underscore'),
config = require('./configuration.js'),
- Client = require('./client.js').Client,
+ Client = require('./client.js').Client,
+ HttpHandler = require('./httphandler.js').HttpHandler,
+ rehash = require('./rehash.js');
+
+
+
+rehash.on('rehashed', function (files) {
+ Client = require('./client.js').Client;
HttpHandler = require('./httphandler.js').HttpHandler;
+});
+
// Instance of HttpHandler
var http_handler;