red/nodes/registry.js
/**
 * Loads all palette nodes
 * @param defaultNodesDir optional parameter, when set, it overrides the default
 *                        location of nodeFiles - used by the tests
 * @return a promise that resolves on completion of loading
 */
Loads all palette nodes
@param defaultNodesDir optional parameter, when set, it overrides the default
location of nodeFiles - used by the tests
@return a promise that resolves on completion of loading
Loads all palette nodes @param defaultNodesDir optional parameter when set it overrides the default location of nodeFiles - used by the tests @return a promise that resolves on completion of loading
function load(defaultNodesDir,disableNodePathScan) {
    return when.promise(function(resolve,reject) {
        var nodeFiles;
        if(defaultNodesDir) {
            nodeFiles = getNodeFiles(path.resolve(defaultNodesDir));
        } else {
            nodeFiles = getNodeFiles(__dirname+"/../../nodes");
        }
        if (settings.nodesDir) {
            var dir = settings.nodesDir;
            if (typeof settings.nodesDir == "string") {
                dir = [dir];
            }
            for (var i=0;i<dir.length;i++) {
                nodeFiles = nodeFiles.concat(getNodeFiles(dir[i]));
            }
        }
        var nodes = [];
        nodeFiles.forEach(function(file) {
            try {
                nodes.push(loadNodeConfig(file));
            } catch(err) {
            }
        });
        TODO: disabling npm module loading if defaultNodesDir set
              This indicates a test is being run - don't want to pick up
              unexpected nodes.
              Urgh.
        if (!disableNodePathScan) {
            Find all of the modules containing nodes
            var moduleFiles = scanTreeForNodesModules();
            moduleFiles.forEach(function(moduleFile) {
                nodes = nodes.concat(loadNodesFromModule(moduleFile.dir,moduleFile.package));
            });
        }
        var promises = [];
        nodes.forEach(function(node) {
            promises.push(loadNodeModule(node));
        });
        when.settle(promises).then(function(results) {
            Trigger a load of the configs to get it precached
            registry.getAllNodeConfigs();
            resolve();
        }); 
    });
}
function load ( defaultNodesDir , disableNodePathScan ) { return when . promise ( function ( resolve , reject ) { var nodeFiles ; if ( defaultNodesDir ) { nodeFiles = getNodeFiles ( path . resolve ( defaultNodesDir ) ) ; } else { nodeFiles = getNodeFiles ( __dirname + "/../../nodes" ) ; } if ( settings . nodesDir ) { var dir = settings . nodesDir ; if ( typeof settings . nodesDir == "string" ) { dir = [ dir ] ; } for ( var i = 0 ; i < dir . length ; i ++ ) { nodeFiles = nodeFiles . concat ( getNodeFiles ( dir [ i ] ) ) ; } } var nodes = [ ] ; nodeFiles . forEach ( function ( file ) { try { nodes . push ( loadNodeConfig ( file ) ) ; } catch ( err ) { } } ) ; if ( ! disableNodePathScan ) { var moduleFiles = scanTreeForNodesModules ( ) ; moduleFiles . forEach ( function ( moduleFile ) { nodes = nodes . concat ( loadNodesFromModule ( moduleFile . dir , moduleFile . package ) ) ; } ) ; } var promises = [ ] ; nodes . forEach ( function ( node ) { promises . push ( loadNodeModule ( node ) ) ; } ) ; when . settle ( promises ) . then ( function ( results ) { registry . getAllNodeConfigs ( ) ; resolve ( ) ; } ) ; } ) ; }
Loads all palette nodes
 @param defaultNodesDir optional parameter, when set, it overrides the default
                        location of nodeFiles - used by the tests
 @return a promise that resolves on completion of loading
Loads all palette nodes @param defaultNodesDir optional parameter when set it overrides the default location of nodeFiles - used by the tests @return a promise that resolves on completion of loading
// Find all of the nodes to load //  // TODO: disabling npm module loading if defaultNodesDir set //       This indicates a test is being run - don't want to pick up //       unexpected nodes. //       Urgh. // Find all of the modules containing nodes //resolve([]); // Trigger a load of the configs to get it precached