move runCode
This commit is contained in:
parent
592b4ed4fd
commit
3e9376138b
|
@ -0,0 +1,24 @@
|
||||||
|
let __mainContext;
|
||||||
|
|
||||||
|
class CodeRunner {
|
||||||
|
constructor(options) {
|
||||||
|
this.plugins = options.plugins;
|
||||||
|
this.logger = options.logger;
|
||||||
|
this.events = options.events;
|
||||||
|
}
|
||||||
|
|
||||||
|
registerVar(varName, code) {
|
||||||
|
__mainContext[varName] = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
doEval(code) {
|
||||||
|
try {
|
||||||
|
// TODO: add trace log here
|
||||||
|
return eval(code);
|
||||||
|
} catch(e) {
|
||||||
|
throw new Error(e + "\n" + code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = CodeRunner;
|
|
@ -2,7 +2,7 @@ let async = require('async');
|
||||||
//require("../utils/debug_util.js")(__filename, async);
|
//require("../utils/debug_util.js")(__filename, async);
|
||||||
let utils = require('../utils/utils.js');
|
let utils = require('../utils/utils.js');
|
||||||
|
|
||||||
let RunCode = require('../core/runCode.js');
|
let RunCode = require('../coderunner/runCode.js');
|
||||||
|
|
||||||
class Deploy {
|
class Deploy {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|
|
@ -12,6 +12,7 @@ const ServicesMonitor = require('./services_monitor.js');
|
||||||
const Pipeline = require('../pipeline/pipeline.js');
|
const Pipeline = require('../pipeline/pipeline.js');
|
||||||
const Watch = require('../pipeline/watch.js');
|
const Watch = require('../pipeline/watch.js');
|
||||||
const LibraryManager = require('../versions/library_manager.js');
|
const LibraryManager = require('../versions/library_manager.js');
|
||||||
|
const CodeRunner = require('../coderunner/codeRunner.js');
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
@ -162,6 +163,12 @@ class Engine {
|
||||||
codeGeneratorService(_options) {
|
codeGeneratorService(_options) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
|
this.codeRunner = new CodeRunner({
|
||||||
|
plugins: self.plugins,
|
||||||
|
events: self.events,
|
||||||
|
logger: self.logger
|
||||||
|
});
|
||||||
|
|
||||||
this.codeGenerator = new CodeGenerator({
|
this.codeGenerator = new CodeGenerator({
|
||||||
blockchainConfig: self.config.blockchainConfig,
|
blockchainConfig: self.config.blockchainConfig,
|
||||||
contractsConfig: self.config.contractsConfig,
|
contractsConfig: self.config.contractsConfig,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
let utils = require('../utils/utils.js');
|
let utils = require('../utils/utils.js');
|
||||||
let RunCode = require('../core/runCode.js');
|
let RunCode = require('../coderunner/runCode.js');
|
||||||
|
|
||||||
class Console {
|
class Console {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
let RunCode = require('../../core/runCode.js');
|
let RunCode = require('../../coderunner/runCode.js');
|
||||||
const stringReplaceAsync = require('string-replace-async');
|
const stringReplaceAsync = require('string-replace-async');
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ var async = require('async');
|
||||||
//require("../utils/debug_util.js")(__filename, async);
|
//require("../utils/debug_util.js")(__filename, async);
|
||||||
var Web3 = require('web3');
|
var Web3 = require('web3');
|
||||||
var Engine = require('../core/engine.js');
|
var Engine = require('../core/engine.js');
|
||||||
var RunCode = require('../core/runCode.js');
|
var RunCode = require('../coderunner/runCode.js');
|
||||||
var TestLogger = require('./test_logger.js');
|
var TestLogger = require('./test_logger.js');
|
||||||
|
|
||||||
var getSimulator = function() {
|
var getSimulator = function() {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue