diff --git a/core/modules/utils/repository.js b/core/modules/utils/repository.js index 643f3f483..3e7cb664a 100644 --- a/core/modules/utils/repository.js +++ b/core/modules/utils/repository.js @@ -14,8 +14,11 @@ Utilities for working with the TiddlyWiki repository file structure /* Get an object containing all the plugins as a hashmap by title of the JSON representation of the plugin +Options: + +ignoreEnvironmentVariables: defaults to false */ -exports.getAllPlugins = function() { +exports.getAllPlugins = function(options) { var fs = require("fs"), path = require("path"), tiddlers = {}; @@ -39,9 +42,9 @@ exports.getAllPlugins = function() { } } }; - $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,$tw.config.pluginsEnvVar),collectPublisherPlugins); - $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,$tw.config.themesEnvVar),collectPublisherPlugins); - $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,$tw.config.languagesEnvVar),collectPlugins); + $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.pluginsPath,options.ignoreEnvironmentVariables ? "" : $tw.config.pluginsEnvVar),collectPublisherPlugins); + $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.themesPath,options.ignoreEnvironmentVariables ? "" : $tw.config.themesEnvVar),collectPublisherPlugins); + $tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,options.ignoreEnvironmentVariables ? "" : $tw.config.languagesEnvVar),collectPlugins); return tiddlers; }; diff --git a/editions/test/tiddlers/tests/test-plugins.js b/editions/test/tiddlers/tests/test-plugins.js index 29ba4a829..663192a9c 100644 --- a/editions/test/tiddlers/tests/test-plugins.js +++ b/editions/test/tiddlers/tests/test-plugins.js @@ -17,7 +17,7 @@ if($tw.node) { describe("Plugin tests", function() { // Get all the plugins as a hashmap by title of a JSON string with the plugin content - var tiddlers = $tw.utils.getAllPlugins(); + var tiddlers = $tw.utils.getAllPlugins({ignoreEnvironmentVariables: true}); // console.log(JSON.stringify(Object.keys(tiddlers),null,4)); describe("every plugin should have the required standard fields", function() { var titles = Object.keys(tiddlers);