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

Store version in settings

This commit is contained in:
Anna Thomas 2014-12-08 09:43:59 +00:00
parent 6d0dffcdf7
commit bb0e48f271

View File

@ -68,9 +68,18 @@ var registry = (function() {
for (var module in moduleConfigs) { for (var module in moduleConfigs) {
if (moduleConfigs.hasOwnProperty(module)) { if (moduleConfigs.hasOwnProperty(module)) {
if (!moduleList[module]) { if (!moduleList[module]) {
moduleList[module] = {}; var version;
moduleList[module].name = module; if (module === "node-red") {
moduleList[module].nodes = {}; version = settings.version;
} else {
version = moduleConfigs[module].version;
}
moduleList[module] = {
name: module,
version: version,
nodes: {}
};
} }
var nodes = moduleConfigs[module].nodes; var nodes = moduleConfigs[module].nodes;
for(var node in nodes) { for(var node in nodes) {
@ -114,21 +123,21 @@ var registry = (function() {
nodeSetName = nodeConfig.name.split(":")[1]; nodeSetName = nodeConfig.name.split(":")[1];
} else { } else {
moduleName = "node-red"; moduleName = "node-red";
nodeSetName = nodeConfig.name.replace(/^\d+-/,"").replace(/\.js$/,"") nodeSetName = nodeConfig.name.replace(/^\d+-/,"").replace(/\.js$/,"");
} }
if (!newConfigs[moduleName]) { if (!newConfigs[moduleName]) {
newConfigs[moduleName] = { newConfigs[moduleName] = {
name: moduleName, name: moduleName,
nodes:{} nodes:{}
} };
} }
newConfigs[moduleName].nodes[nodeSetName] = { newConfigs[moduleName].nodes[nodeSetName] = {
name: nodeSetName, name: nodeSetName,
types: nodeConfig.types, types: nodeConfig.types,
enabled: nodeConfig.enabled, enabled: nodeConfig.enabled,
module: moduleName module: moduleName
} };
} }
} }
settings.set("nodes",newConfigs); settings.set("nodes",newConfigs);
@ -625,6 +634,7 @@ function loadNodeConfig(file,module,name,version) {
node.err = err.toString(); node.err = err.toString();
} }
} }
registry.addNodeSet(id,node,version); registry.addNodeSet(id,node,version);
return node; return node;
} }