mirror of https://github.com/embarklabs/embark.git
nodashboard start a repl
This commit is contained in:
parent
d8a6987d37
commit
87396c9882
|
@ -23,8 +23,13 @@ function registerVar(varName, code) {
|
|||
__mainContext[varName] = code;
|
||||
}
|
||||
|
||||
function getContext() {
|
||||
return __mainContext;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
doEval: doEval,
|
||||
registerVar: registerVar,
|
||||
initContext: initContext
|
||||
initContext: initContext,
|
||||
getContext: getContext
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
const repl = require("repl");
|
||||
const RunCode = require('../coderunner/runCode');
|
||||
|
||||
class REPL {
|
||||
constructor(options) {
|
||||
|
@ -6,16 +7,21 @@ class REPL {
|
|||
}
|
||||
|
||||
start(done) {
|
||||
let replServer = repl.start({
|
||||
this.replServer = repl.start({
|
||||
prompt: "Embark (" + this.env + ") > "
|
||||
});
|
||||
this.initializeContext(this.replServer.context);
|
||||
|
||||
replServer.on('exit', () => {
|
||||
this.replServer.on("exit", () => {
|
||||
process.exit();
|
||||
});
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
initializeContext(context) {
|
||||
context.embark = RunCode.getContext();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = REPL;
|
||||
|
|
|
@ -152,7 +152,14 @@ class Embark {
|
|||
});
|
||||
}
|
||||
engine.startService("fileWatcher");
|
||||
callback();
|
||||
|
||||
if (!options.useDashboard) {
|
||||
const REPL = require('./dashboard/repl.js');
|
||||
let repl = new REPL({env: engine.env});
|
||||
repl.start(function () {
|
||||
callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
], function (err, _result) {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue