diff --git a/modules/htmlout/lib/htmlout.js b/modules/htmlout/lib/htmlout.js index 234898b74..8d72d8438 100644 --- a/modules/htmlout/lib/htmlout.js +++ b/modules/htmlout/lib/htmlout.js @@ -88,6 +88,11 @@ var fServerDebug = false; */ var logFile = null; +/* + * fPrivate determines the insertion of private.js + */ +var fPrivate = false; + /* * fRebuild controls the rebuilding of cached "index.html" files, assuming fCache is true; fRebuild is false * by default, and it can be set for all requests using the setOptions() 'rebuild' property, or for individual @@ -674,6 +679,7 @@ HTMLOut.logError = function(err, fForce) * 'console' fConsole * 'debug' fServerDebug * 'logfile' logFile + * 'private' fPrivate * 'rebuild' fRebuild * 'senddef' fSendDefault * 'sockets' fSockets @@ -698,6 +704,9 @@ HTMLOut.setOptions = function(options) logFile = options['logfile']; HTTPAPI.setLogFile(logFile); } + if (options['private'] !== undefined) { + fPrivate = options['private']; + } if (options['rebuild'] !== undefined) { fRebuild = options['rebuild']; } @@ -1872,15 +1881,19 @@ HTMLOut.prototype.processMachines = function(aMachines, buildOptions, done) */ if ((asFiles = aMachineFiles[sClass].slice())) { var i; - if (fNoDebug) { - /* - * We need to find the shared "defines.js" source file, and follow it with "nodebug.js". - */ - for (i = 0; i < asFiles.length; i++) { - if (asFiles[i].indexOf("shared/lib/defines.js") >= 0) { - asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebug.js")); - break; + /* + * We need to find the shared "defines.js" source file, because we may need to follow it + * with "nodebug.js" and/or "private.js". + */ + for (i = 0; i < asFiles.length; i++) { + if (asFiles[i].indexOf("shared/lib/defines.js") >= 0) { + if (fPrivate) { + asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "private.js")); } + if (fNoDebug) { + asFiles.splice(i + 1, 0, asFiles[i].replace("defines.js", "nodebug.js")); + } + break; } } if (!fDebugger) { diff --git a/server.js b/server.js index 1a2897ad7..0743fce79 100644 --- a/server.js +++ b/server.js @@ -59,6 +59,7 @@ var fCache = (args.argv['cache'] === undefined? true : args.argv['cache']); var fConsole = (args.argv['console'] === undefined? false : args.argv['console']); var fDebug = (args.argv['debug'] === undefined? false : args.argv['debug']); var fLogging = (args.argv['logging'] === undefined? false : args.argv['logging']); +var fPrivate = (args.argv['private'] === undefined? false : args.argv['private']); var fRebuild = (args.argv['rebuild'] === undefined? false : args.argv['rebuild']); var fSockets = (args.argv['sockets'] === undefined? false : args.argv['sockets']); @@ -72,7 +73,7 @@ HTMLOut.setRoot(sServerRoot); * 'debug' and 'rebuild' options OFF, which is why we warn if they're enabled. */ if (fConsole || fDebug || fRebuild) console.log("warning: non-production options enabled"); -HTMLOut.setOptions({'cache': fCache, 'console': fConsole, 'debug': fDebug, 'rebuild': fRebuild, 'sockets': fSockets}); +HTMLOut.setOptions({'cache': fCache, 'console': fConsole, 'debug': fDebug, 'private': fPrivate, 'rebuild': fRebuild, 'sockets': fSockets}); var app = express(); app.enable("strict routing");