inclusion.js
Summary
No overview generated for 'inclusion.js'
var require = function(arg) {
arg = arg.replace(/(core\.|\(|\)|=)/g, "");
if (!eval(arg)) {
var msg = "Application requires " + arg;
app.log(msg);
throw msg;
}
return;
};
var include = function(fpath) {
var file = new File(fpath);
if (file.exists()) {
var content = file.readAll();
eval(content);
app.log("Included file " + fpath);
}
return;
};
var importModule = function(name) {
name = String(name);
if (name.indexOf(".") < 0) {
name = "core." + name;
}
var fpath = name.replace(".", "/");
app.addRepository("./modules/" + fpath + ".js");
app.log("Imported module " + name);
return;
};
var importAllModules = function() {
var recurse = function(dir) {
var files = dir.list();
var fname;
for (var i in files) {
f = new File(dir, files[i]);
if (f.isDirectory()) {
recurse(f);
} else {
fname = f.getName();
if (/\.js$/.test(fname) && fname != "all.js") {
app.addRepository(f.getAbsolutePath());
app.log("Imported module " + fname);
}
}
}
return;
};
var dir = new File("modules");
if (dir.exists()) {
recurse(dir);
}
return;
}
Documentation generated by
JSDoc on Sun Mar 4 00:51:24 2007