pluginLoader
Summary
Provides functions to load openveo plugins.
Item Index
Methods
- filterPluginsPaths static
- getPluginPaths static
- loadPlugin static
- loadPluginMetadata static
- loadPlugins static
Methods
filterPluginsPaths
Syntax
Summary
Filters the list of plugins paths in case the same plugin appears multiple time at different paths. Filters to keep only the most top level one.
Parameters:
-
pluginsPaths
ArrayThe list of plugins paths to analyze
Returns:
Array:
The filtered list of plugins paths
Example:
var pluginsPaths = [
'/openveo/node_modules/@openveo/plugin1',
'/openveo/node_modules/@openveo/plugin2/node_modules/@openveo/plugin1'
];
console.log(filterPluginsPaths(pluginsPaths));
// [ '/openveo/node_modules/@openveo/plugin1' ]
getPluginPaths
Syntax
getPluginPaths
(
static
-
startingPath
-
callback
Summary
Recursively and asynchronously analyze the given directory to get npm plugins.
There are two kinds of plugins : plugins maintained by the core team (under @openveo scope) and contributers' plugins which must be prefixed by openveo-.
Parameters:
Example:
getPluginPaths('/openveo', function(error, pluginsPaths){
console.log(pluginsPaths);
// [
// '/openveo/node_modules/@openveo/plugin',
// '/openveo/node_modules/openveo-contrib-plugin'
// ]
};
loadPlugin
Syntax
loadPlugin
(
static
async
-
pluginPath
-
callback
Summary
Loads a single plugin by its path.
Parameters:
Example:
var pluginLoader = process.require('app/server/loaders/pluginLoader.js');
// Load a plugin
pluginLoader.loadPlugin('/node_modules/@openveo/publish', function(error, loadedPlugin){
console.log(loadedPlugin);
}
loadPluginMetadata
Syntax
loadPluginMetadata
(
static
async
-
plugin
-
callback
Summary
Loads plugin's configuration.
loadPlugins
Syntax
loadPlugins
(
static
async
-
startingPath
-
callback
Summary
Recursively and asynchronously load all offical and contributed OpenVeo plugins under the given path.
If the same plugin (same name) is encountered several times, the top level one will be kept.
Parameters:
Example:
var pluginLoader = process.require('app/server/loaders/pluginLoader.js');
// Load all potential openveo plugins from directory /home/openveo/openveo
pluginLoader.loadPlugins('/home/openveo/openveo', function(error, plugins){
console.log(plugins);
};