mirror of https://github.com/embarklabs/embark.git
Use global in repl
This commit is contained in:
parent
87396c9882
commit
9c5cb35d3b
|
@ -23,13 +23,8 @@ function registerVar(varName, code) {
|
|||
__mainContext[varName] = code;
|
||||
}
|
||||
|
||||
function getContext() {
|
||||
return __mainContext;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
doEval: doEval,
|
||||
registerVar: registerVar,
|
||||
initContext: initContext,
|
||||
getContext: getContext
|
||||
initContext: initContext
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const repl = require("repl");
|
||||
const RunCode = require('../coderunner/runCode');
|
||||
|
||||
class REPL {
|
||||
constructor(options) {
|
||||
|
@ -8,9 +7,9 @@ class REPL {
|
|||
|
||||
start(done) {
|
||||
this.replServer = repl.start({
|
||||
prompt: "Embark (" + this.env + ") > "
|
||||
prompt: "Embark (" + this.env + ") > ",
|
||||
useGlobal: true
|
||||
});
|
||||
this.initializeContext(this.replServer.context);
|
||||
|
||||
this.replServer.on("exit", () => {
|
||||
process.exit();
|
||||
|
@ -19,9 +18,6 @@ class REPL {
|
|||
done();
|
||||
}
|
||||
|
||||
initializeContext(context) {
|
||||
context.embark = RunCode.getContext();
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = REPL;
|
||||
|
|
|
@ -267,6 +267,7 @@ class Embark {
|
|||
engine.startService("libraryManager");
|
||||
engine.startService("codeRunner");
|
||||
engine.startService("web3");
|
||||
engine.startService("pipeline");
|
||||
engine.startService("deployment", {onlyCompile: false});
|
||||
engine.startService("storage");
|
||||
engine.startService("codeGenerator");
|
||||
|
@ -280,7 +281,10 @@ class Embark {
|
|||
},
|
||||
function waitForWriteFinish(callback) {
|
||||
engine.logger.info("Finished deploying".underline);
|
||||
callback();
|
||||
engine.events.on('outputDone', (err) => {
|
||||
engine.logger.info(__("finished building").underline);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function startREPL(callback) {
|
||||
let repl = new REPL({env: engine.env});
|
||||
|
|
Loading…
Reference in New Issue