diff --git a/resources/celerity/map.php b/resources/celerity/map.php index e850d81944..b4db8c453f 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -167,7 +167,7 @@ return array( 'rsrc/externals/javelin/core/__tests__/stratcom.js' => '88bf7313', 'rsrc/externals/javelin/core/__tests__/util.js' => 'e251703d', 'rsrc/externals/javelin/core/init.js' => '76e1fd61', - 'rsrc/externals/javelin/core/init_node.js' => 'd7dde471', + 'rsrc/externals/javelin/core/init_node.js' => '7212f324', 'rsrc/externals/javelin/core/install.js' => '05270951', 'rsrc/externals/javelin/core/util.js' => 'bdcfee9e', 'rsrc/externals/javelin/docs/Base.js' => '74676256', diff --git a/support/aphlict/server/aphlict_server.js b/support/aphlict/server/aphlict_server.js index 6b8795d41b..7d222d3b1c 100644 --- a/support/aphlict/server/aphlict_server.js +++ b/support/aphlict/server/aphlict_server.js @@ -4,9 +4,6 @@ var https = require('https'); var util = require('util'); var fs = require('fs'); -JX.require('lib/AphlictListenerList', __dirname); -JX.require('lib/AphlictLog', __dirname); - function parse_command_line_arguments(argv) { var config = { 'client-port': 22280, @@ -37,6 +34,8 @@ function parse_command_line_arguments(argv) { return config; } +require('./lib/AphlictLog'); + var debug = new JX.AphlictLog() .addConsole(console); @@ -71,6 +70,12 @@ try { 'documentation for instructions. ' + ex.toString()); } +// NOTE: Require these only after checking for the "ws" module, since they +// depend on it. + +require('./lib/AphlictAdminServer'); +require('./lib/AphlictClientServer'); + var ssl_config = { enabled: (config['ssl-key'] || config['ssl-cert']) }; @@ -94,9 +99,6 @@ if (config.test) { process.exit(0); } -JX.require('lib/AphlictAdminServer', __dirname); -JX.require('lib/AphlictClientServer', __dirname); - var server; if (ssl_config.enabled) { server = https.createServer({ diff --git a/support/aphlict/server/lib/AphlictAdminServer.js b/support/aphlict/server/lib/AphlictAdminServer.js index a36841dacd..0166475a55 100644 --- a/support/aphlict/server/lib/AphlictAdminServer.js +++ b/support/aphlict/server/lib/AphlictAdminServer.js @@ -1,6 +1,6 @@ -var JX = require('javelin').JX; +var JX = require('./javelin').JX; -JX.require('AphlictListenerList', __dirname); +require('./AphlictListenerList'); var http = require('http'); diff --git a/support/aphlict/server/lib/AphlictClientServer.js b/support/aphlict/server/lib/AphlictClientServer.js index b4fcbd7353..da139cc221 100644 --- a/support/aphlict/server/lib/AphlictClientServer.js +++ b/support/aphlict/server/lib/AphlictClientServer.js @@ -1,7 +1,7 @@ -var JX = require('javelin').JX; +var JX = require('./javelin').JX; -JX.require('AphlictListenerList', __dirname); -JX.require('AphlictLog', __dirname); +require('./AphlictListenerList'); +require('./AphlictLog'); var util = require('util'); var WebSocket = require('ws'); diff --git a/support/aphlict/server/lib/AphlictListener.js b/support/aphlict/server/lib/AphlictListener.js index d330274520..809a244a8e 100644 --- a/support/aphlict/server/lib/AphlictListener.js +++ b/support/aphlict/server/lib/AphlictListener.js @@ -1,4 +1,4 @@ -var JX = require('javelin').JX; +var JX = require('./javelin').JX; JX.install('AphlictListener', { construct: function(id, socket) { diff --git a/support/aphlict/server/lib/AphlictListenerList.js b/support/aphlict/server/lib/AphlictListenerList.js index 23e36a6285..9edefcdd5d 100644 --- a/support/aphlict/server/lib/AphlictListenerList.js +++ b/support/aphlict/server/lib/AphlictListenerList.js @@ -1,5 +1,6 @@ -var JX = require('javelin').JX; -JX.require('AphlictListener', __dirname); +var JX = require('./javelin').JX; + +require('./AphlictListener'); JX.install('AphlictListenerList', { construct: function() { diff --git a/support/aphlict/server/lib/AphlictLog.js b/support/aphlict/server/lib/AphlictLog.js index b9ee12459e..654f98f308 100644 --- a/support/aphlict/server/lib/AphlictLog.js +++ b/support/aphlict/server/lib/AphlictLog.js @@ -1,4 +1,4 @@ -var JX = require('javelin').JX; +var JX = require('./javelin').JX; var fs = require('fs'); var util = require('util'); diff --git a/webroot/rsrc/externals/javelin/core/init_node.js b/webroot/rsrc/externals/javelin/core/init_node.js index db32947302..cb53555ff3 100644 --- a/webroot/rsrc/externals/javelin/core/init_node.js +++ b/webroot/rsrc/externals/javelin/core/init_node.js @@ -23,9 +23,8 @@ JX.onload = function(func) { func(); }; -JX.require = function(thing, relative) { - relative = relative || __dirname + '/..'; - var path = relative + '/' + thing + '.js'; +JX.require = function(thing) { + var path = __dirname + '/../' + thing + '.js'; var content = fs.readFileSync(path); var dir = pathModule.dirname(path); @@ -37,17 +36,10 @@ JX.require = function(thing, relative) { } var extra = { - JX : this, - __DEV__ : 0, - window : {}, - __dirname : dir, - require : function(thing) { - if (thing == 'javelin') { - return require(dir + '/' + thing); - } else { - return require(thing); - } - } + JX: this, + __DEV__: 0, + window: {}, + __dirname: dir }; for (k in extra) {