mirror of https://github.com/embarklabs/embark.git
Use global in repl
This commit is contained in:
parent
3e328801db
commit
2d7876146b
|
@ -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
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -270,6 +270,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");
|
||||||
|
@ -283,7 +284,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});
|
||||||
|
|
Loading…
Reference in New Issue