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

Renamed modules to plugins for CLI

This commit is contained in:
Anna Thomas 2014-11-06 10:59:34 +00:00
parent 2e7a97fb88
commit deeaa09360
4 changed files with 24 additions and 24 deletions

View File

@ -19,7 +19,7 @@ var util = require('util');
var ui = require("./ui"); var ui = require("./ui");
var nodes = require("./nodes"); var nodes = require("./nodes");
var modules = require("./modules"); var plugins = require("./plugins");
var flows = require("./flows"); var flows = require("./flows");
var library = require("./library"); var library = require("./library");
@ -56,9 +56,9 @@ function init(adminApp) {
adminApp.put("/nodes/:id",nodes.put); adminApp.put("/nodes/:id",nodes.put);
adminApp.delete("/nodes/:id",nodes.delete); adminApp.delete("/nodes/:id",nodes.delete);
// Modules // Plugins
adminApp.get("/modules",modules.getAll); adminApp.get("/plugins",plugins.getAll);
adminApp.get("/modules/:id",modules.get); adminApp.get("/plugins/:id",plugins.get);
// Library // Library
adminApp.post(new RegExp("/library/flows\/(.*)"),library.post); adminApp.post(new RegExp("/library/flows\/(.*)"),library.post);

View File

@ -18,11 +18,11 @@ var redNodes = require("../nodes");
module.exports = { module.exports = {
getAll: function(req,res) { getAll: function(req,res) {
res.json(redNodes.getModuleList()); res.json(redNodes.getPluginList());
}, },
get: function(req,res) { get: function(req,res) {
var id = req.params.id; var id = req.params.id;
var result = redNodes.getModule(id); var result = redNodes.getPluginInfo(id);
if (result) { if (result) {
res.send(result); res.send(result);
} else { } else {

View File

@ -114,9 +114,9 @@ module.exports = {
getType: registry.get, getType: registry.get,
getNodeInfo: registry.getNodeInfo, getNodeInfo: registry.getNodeInfo,
getNodeModuleInfo: registry.getNodeModuleInfo, getNodeModuleInfo: registry.getNodeModuleInfo,
getModule: registry.getModule, getPluginInfo: registry.getPluginInfo,
getNodeList: registry.getNodeList, getNodeList: registry.getNodeList,
getModuleList: registry.getModuleList, getPluginList: registry.getPluginList,
getNodeConfigs: registry.getNodeConfigs, getNodeConfigs: registry.getNodeConfigs,
getNodeConfig: registry.getNodeConfig, getNodeConfig: registry.getNodeConfig,
clearRegistry: registry.clear, clearRegistry: registry.clear,

View File

@ -33,7 +33,7 @@ function filterNodeInfo(n) {
name: n.name, name: n.name,
types: n.types, types: n.types,
enabled: n.enabled enabled: n.enabled
} };
if (n.hasOwnProperty("loaded")) { if (n.hasOwnProperty("loaded")) {
r.loaded = n.loaded; r.loaded = n.loaded;
} }
@ -164,13 +164,13 @@ var registry = (function() {
} }
return list; return list;
}, },
getModuleList: function() { getPluginList: function() {
var list = []; var list = [];
for (var module in nodeModules) { for (var plugin in nodeModules) {
if (nodeModules.hasOwnProperty(module)) { if (nodeModules.hasOwnProperty(plugin)) {
var nodes = nodeModules[module].nodes; var nodes = nodeModules[plugin].nodes;
var m = { var m = {
name: module, name: plugin,
nodes: [] nodes: []
}; };
for (var i = 0; i < nodes.length; ++i) { for (var i = 0; i < nodes.length; ++i) {
@ -181,10 +181,10 @@ var registry = (function() {
} }
return list; return list;
}, },
getModule: function(module) { getPluginInfo: function(plugin) {
var nodes = nodeModules[module].nodes; var nodes = nodeModules[plugin].nodes;
var m = { var m = {
name: module, name: plugin,
nodes: [] nodes: []
}; };
for (var i = 0; i < nodes.length; ++i) { for (var i = 0; i < nodes.length; ++i) {
@ -329,7 +329,7 @@ var registry = (function() {
saveNodeList(); saveNodeList();
} }
} }
} };
})(); })();
@ -368,7 +368,7 @@ function getNodeFiles(dir) {
} }
} }
} }
valid = valid && fs.existsSync(path.join(dir,fn.replace(/\.js$/,".html"))) valid = valid && fs.existsSync(path.join(dir,fn.replace(/\.js$/,".html")));
if (valid) { if (valid) {
result.push(path.join(dir,fn)); result.push(path.join(dir,fn));
@ -505,13 +505,13 @@ function loadNodeConfig(file,module,name) {
template: file.replace(/\.js$/,".html"), template: file.replace(/\.js$/,".html"),
enabled: isEnabled, enabled: isEnabled,
loaded:false loaded:false
} };
if (module) { if (module) {
node.name = module+":"+name; node.name = module+":"+name;
node.module = module; node.module = module;
} else { } else {
node.name = path.basename(file) node.name = path.basename(file);
} }
try { try {
var content = fs.readFileSync(node.template,'utf8'); var content = fs.readFileSync(node.template,'utf8');
@ -717,9 +717,9 @@ module.exports = {
get: registry.getNodeConstructor, get: registry.getNodeConstructor,
getNodeInfo: registry.getNodeInfo, getNodeInfo: registry.getNodeInfo,
getNodeModuleInfo: registry.getModuleInfo, getNodeModuleInfo: registry.getModuleInfo,
getModule: registry.getModule, getPluginInfo: registry.getPluginInfo,
getNodeList: registry.getNodeList, getNodeList: registry.getNodeList,
getModuleList: registry.getModuleList, getPluginList: registry.getPluginList,
getNodeConfigs: registry.getAllNodeConfigs, getNodeConfigs: registry.getAllNodeConfigs,
getNodeConfig: registry.getNodeConfig, getNodeConfig: registry.getNodeConfig,
addNode: addNode, addNode: addNode,
@ -730,4 +730,4 @@ module.exports = {
addModule: addModule, addModule: addModule,
removeModule: registry.removeModule, removeModule: registry.removeModule,
cleanNodeList: registry.cleanNodeList cleanNodeList: registry.cleanNodeList
} };