From 7abae51b42e220b4c0973bc1b555d71d8d474ee9 Mon Sep 17 00:00:00 2001 From: Mark Hindess Date: Thu, 28 Aug 2014 13:59:56 +0100 Subject: [PATCH] Fix --help so it doesn't crash. --- red/red.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/red/red.js b/red/red.js index e119e483b..a97c153d3 100644 --- a/red/red.js +++ b/red/red.js @@ -33,15 +33,8 @@ var RED = { init: function(httpServer,userSettings) { settings = userSettings; - - var p = require(path.join(process.env.NODE_RED_HOME,"package.json")); - if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) { - settings.version = p.version+".git"; - } else { - settings.version = p.version; - } - - + settings.version = this.version(); + server.init(httpServer,settings); library.init(); return server.app; @@ -54,7 +47,15 @@ var RED = { credentials: credentials, events: events, log: log, - comms:comms + comms: comms, + version: function () { + var p = require(path.join(process.env.NODE_RED_HOME,"package.json")); + if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) { + return p.version+".git"; + } else { + return p.version; + } + } }; RED.__defineGetter__("app", function() { console.log("Deprecated use of RED.app - use RED.httpAdmin instead"); return server.app });