forked from cory/tildefriends
Made it possible to require() a script from another package. It's high time for some code reuse.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3191 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
10
core/core.js
10
core/core.js
@ -215,6 +215,11 @@ function getManifest(fileName) {
|
||||
return manifest.length ? JSON.parse(manifest.join("\n")) : null;
|
||||
}
|
||||
|
||||
function packageNameToPath(name) {
|
||||
var process = this;
|
||||
return "packages/" + process.packageOwner + "/" + name + "/";
|
||||
}
|
||||
|
||||
function getProcess(packageOwner, packageName, key, options) {
|
||||
var process = gProcesses[key];
|
||||
if (!process
|
||||
@ -342,6 +347,11 @@ function getProcess(packageOwner, packageName, key, options) {
|
||||
throw new Error(packageOwner + " does not have right to permission 'network'.");
|
||||
}
|
||||
}
|
||||
if (manifest && manifest.require) {
|
||||
print("manifest.require = ", manifest.require);
|
||||
print(manifest.require.map(packageNameToPath.bind(process)));
|
||||
process.task.addPath(manifest.require.map(packageNameToPath.bind(process)));
|
||||
}
|
||||
process.task.setImports(imports);
|
||||
print("Activating task");
|
||||
process.task.activate();
|
||||
|
Reference in New Issue
Block a user