Example #1
0
        raptor.forEach(samples, function(sample, i) {

            if (sample.templates) {
                raptor.forEach(sample.templates, function(templatePath, j) {
                    sample.templates[j] = {
                        source: readResource(templatePath),
                        path: templatePath
                    };
                }, this);
            }
            
            if (sample.path) {
                sample.template = readResource(sample.path + ".rhtml", '');
                sample.data = readResource(sample.path + "-data.json", '{}');
                sample.options = readResource(sample.path + "-options.json");
            }
            
            if (!sample.options) {
                sample.options = defaultOptionsJson;
            }

            if (sample.samples) {
                convertSamples(sample.samples);
            }
        });
Example #2
0
 getThisObjs: function() {
     var thisObjs = [];
     raptor.forEach(this.getEvents(), function(event) {
         thisObjs.push(this.eventLookup[event].thisObj);
     }, this);
     
     return thisObjs;
 },
 _convertEvents = function(events) {
     var convertedEvents = {};
     raptor.forEach(events, function(event) {
         convertedEvents[event[0]] = {
             target: event[1],
             props: event[2]
         };
     }, this);
     return convertedEvents;
 };
 discoverTaglibs: function() {
     if (discoveryComplete) {
         return;
     }
     discoveryComplete = true;
     
     var taglibPaths = $rget("rtld");
     
     raptor.forEach(taglibPaths, function(path) {
         var resource = require('raptor/resources').findResource(path);
         if (resource && resource.exists()) {
             this.loadTaglibXml(resource.readAsString(), resource.getPath());    
         }
         
     }, this);
 }
 loadPackageTaglibs: function(manifest) {
     var taglibs = manifest.getRaptorProp('taglibs');
     if (taglibs) {
         raptor.forEach(taglibs, function(rtldPath) {
             var key = manifest.getURL() + ':' + rtldPath;
             if (!loadedTaglibPaths[key]) {
                 loadedTaglibPaths[key] = true;
                 
                 var rtldResource = manifest.resolveResource(rtldPath);
                 if (!rtldResource || !rtldResource.exists()) {
                     throw raptor.createError(new Error('Raptor TLD "' + rtldPath + '" not found for manifest "' + manifest.getURL() + '"'));
                 }
                 this.loadTaglib(rtldResource);    
             }
         }, this);
     }
 },
Example #6
0
        addSearchPathsFromManifest: function(packageManifest) {
            var packageSearchPath = packageManifest.getRaptorProp('search-path');
            if (packageSearchPath != null) {
                var moduleName = packageManifest.name;
                raptor.forEach(packageSearchPath, function(searchPathConfig) {
                    if (typeof searchPathConfig === 'string') {
                        searchPathConfig = {
                            dir: searchPathConfig
                        };
                    }

                    if (searchPathConfig.dir) {
                        var dirResource = packageManifest.resolveResource(searchPathConfig.dir);
                        if (dirResource && dirResource.exists()) {
                            if (dirResource.isFileResource()) {
                                if (!dirResource.isDirectory()) {
                                    throw raptor.createError(new Error("Only file system directories can be added to the resource search path. Search path is a file: " + dirResource.getURL()));    
                                }

                                // see if the search path is a module that has it's own search path...
                                var modulePackage = dirResource.resolve('./package.json');
                                if (modulePackage.exists()) {

                                    var nestedPackage = require('raptor/packaging').getPackageManifest(modulePackage);
                                    var nestedSearchPath = nestedPackage.getRaptorProp('search-path');
                                    if (nestedSearchPath) {
                                        this.addSearchPathsFromManifest(nestedPackage);
                                        return;
                                    }
                                }
                                var searchPathEntry = this.addSearchPathDir(dirResource.getFilePath());
                                raptor.setModuleSearchPath(moduleName, searchPathEntry);
                            }
                            else {
                                throw raptor.createError(new Error("Only file system directories can be added to the resource search path. Search path: " + dirResource.getURL()));
                            }
                        }
                    }
                }, this);
            }
        }