-
Notifications
You must be signed in to change notification settings - Fork 1
/
client-workspace-maple.js
68 lines (60 loc) · 1.91 KB
/
client-workspace-maple.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var join = require("path").join;
var fs = require("fs");
function readRunners(base, path) {
var results = {};
var runnersPath = base + "/" + path + "/";
fs.readdirSync(runnersPath).forEach(function (name) {
var runner = fs.readFileSync(runnersPath + name, "utf8");
try {
// handle symlinks on windows
if (/^..\//.test(runner))
runner = fs.readFileSync(runnersPath + runner.trim(), "utf8");
var json = JSON.parse(runner.replace(/(^|\n)\s*\/\/.*$/mg, ""));
json.caption = name.replace(/\.run$/, "");
json.$builtin = true;
results[json.caption] = json;
} catch (e) {
console.error("Syntax error in runner", runnersPath + name, e);
}
});
return results;
}
module.exports = function(options) {
options.collab = false;
var config = require("./client-default")(options);
return module.exports.makeLocal(config, options);
};
module.exports.makeLocal = function(config, options) {
// Add maple runner
var extRunners = readRunners(__dirname + "/../plugins/c9.ide.maple", "runners");
for (var name in extRunners) {
options.runners[name] = extRunners[name];
}
// Add local modules
var includes = [
{
packagePath: "plugins/c9.ide.maple/maple",
staticPrefix: options.staticPrefix + "/plugins/c9.ide.maple"
}, {
packagePath: "plugins/c9.ide.maple/maple.manager",
options: options
}, {
packagePath: "plugins/c9.ide.maple/magellan",
options: options
}, {
packagePath: "plugins/c9.ide.maple/panelMininet",
staticPrefix: options.staticPrefix
}, {
packagePath: "plugins/c9.ide.maple/panelNetwork",
options: options
}, {
packagePath: "plugins/c9.ide.maple/panelTracetree",
options: options
}
].filter(Boolean);
excludes = {};
config = config.concat(includes).filter(function (p) {
return !excludes[p] && !excludes[p.packagePath];
});
return config;
};