Use global in repl

This commit is contained in:
Anthony Laibe 2018-07-24 09:40:48 +01:00 committed by Iuri Matias
parent 87396c9882
commit 9c5cb35d3b
3 changed files with 8 additions and 13 deletions

View File

@ -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
};

View File

@ -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;

View File

@ -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});