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; __mainContext[varName] = code;
} }
function getContext() {
return __mainContext;
}
module.exports = { module.exports = {
doEval: doEval, doEval: doEval,
registerVar: registerVar, registerVar: registerVar,
initContext: initContext, initContext: initContext
getContext: getContext
}; };

View File

@ -1,5 +1,4 @@
const repl = require("repl"); const repl = require("repl");
const RunCode = require('../coderunner/runCode');
class REPL { class REPL {
constructor(options) { constructor(options) {
@ -8,9 +7,9 @@ class REPL {
start(done) { start(done) {
this.replServer = repl.start({ this.replServer = repl.start({
prompt: "Embark (" + this.env + ") > " prompt: "Embark (" + this.env + ") > ",
useGlobal: true
}); });
this.initializeContext(this.replServer.context);
this.replServer.on("exit", () => { this.replServer.on("exit", () => {
process.exit(); process.exit();
@ -19,9 +18,6 @@ class REPL {
done(); done();
} }
initializeContext(context) {
context.embark = RunCode.getContext();
}
} }
module.exports = REPL; module.exports = REPL;

View File

@ -267,6 +267,7 @@ class Embark {
engine.startService("libraryManager"); engine.startService("libraryManager");
engine.startService("codeRunner"); engine.startService("codeRunner");
engine.startService("web3"); engine.startService("web3");
engine.startService("pipeline");
engine.startService("deployment", {onlyCompile: false}); engine.startService("deployment", {onlyCompile: false});
engine.startService("storage"); engine.startService("storage");
engine.startService("codeGenerator"); engine.startService("codeGenerator");
@ -280,7 +281,10 @@ class Embark {
}, },
function waitForWriteFinish(callback) { function waitForWriteFinish(callback) {
engine.logger.info("Finished deploying".underline); engine.logger.info("Finished deploying".underline);
callback(); engine.events.on('outputDone', (err) => {
engine.logger.info(__("finished building").underline);
callback(err);
});
}, },
function startREPL(callback) { function startREPL(callback) {
let repl = new REPL({env: engine.env}); let repl = new REPL({env: engine.env});