1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add version information to log output

This commit is contained in:
Nick O'Leary 2014-04-21 21:55:28 +01:00
parent c39f4f9738
commit 6a17a7d4c2
3 changed files with 13 additions and 0 deletions

1
red.js
View File

@ -44,6 +44,7 @@ nopt.invalidHandler = function(k,v,t) {
var parsedArgs = nopt(knownOpts,shortHands,process.argv,2)
if (parsedArgs.help) {
console.log("Node-RED v"+RED.version());
console.log("Usage: node red.js [-v] [-?] [--settings settings.js] [flows.json]");
console.log("");
console.log("Options:");

View File

@ -18,6 +18,7 @@ var events = require("./events");
var server = require("./server");
var nodes = require("./nodes");
var library = require("./library");
var fs = require("fs");
var settings = null;
var path = require('path');
@ -35,6 +36,15 @@ var RED = {
return server.app;
},
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;
}
},
start: server.start,
stop: server.stop,
nodes: nodes,

View File

@ -63,10 +63,12 @@ function createServer(_server,_settings) {
}
function start() {
var RED = require("./red");
var defer = when.defer();
storage.init(settings).then(function() {
console.log("\nWelcome to Node-RED\n===================\n");
util.log("[red] Version: "+RED.version());
util.log("[red] Loading palette nodes");
var nodeErrors = redNodes.load(settings);
if (nodeErrors.length > 0) {