fixes due to bad rebase

This commit is contained in:
Iuri Matias 2018-08-22 18:36:34 -04:00
parent 0c25ae2bbf
commit 79360ae3c2
4 changed files with 1939 additions and 5320 deletions

View File

@ -206,7 +206,6 @@ class Engine {
// TODO: still need to redeploy contracts because the original contracts
// config is being corrupted
self.config.reloadConfig();
if (fileType === 'asset') {
// Throttle file changes so we re-write only once for all files
self.events.emit('asset-changed', self.contractsManager);
@ -259,7 +258,6 @@ class Engine {
codeCoverageService(_options) {
this.registerModule('coverage');
}
}
module.exports = Engine;

View File

@ -273,3 +273,4 @@ class BlockchainConnector {
}
module.exports = BlockchainConnector;

View File

@ -1,16 +1,16 @@
let async = require('async');
const utils = require('../utils/utils.js');
//require("../utils/debug_util.js")(__filename, async);
const ContractDeployer = require('./contract_deployer.js');
const cloneDeep = require('clone-deep');
class DeployManager {
constructor(options) {
constructor(embark, options) {
const self = this;
this.config = options.config;
this.logger = options.logger;
this.config = embark.config;
this.logger = embark.logger;
this.blockchainConfig = this.config.blockchainConfig;
this.events = options.events;
this.events = embark.events;
this.plugins = options.plugins;
this.blockchain = options.blockchain;
this.gasLimit = false;
@ -18,33 +18,61 @@ class DeployManager {
this.deployOnlyOnConfig = false;
this.onlyCompile = options.onlyCompile !== undefined ? options.onlyCompile : false;
this.contractDeployer = new ContractDeployer({
logger: this.logger,
events: this.events,
plugins: this.plugins
});
this.events.setCommandHandler('deploy:setGasLimit', (gasLimit) => {
self.gasLimit = gasLimit;
});
this.events.setCommandHandler('deploy:contracts', (cb) => {
self.deployContracts(cb);
});
this.events.setCommandHandler('deploy:contracts:test', (cb) => {
self.fatalErrors = true;
self.deployOnlyOnConfig = true;
self.deployContracts(cb);
});
}
deployAll(done) {
let self = this;
self.events.request('contracts:list', (err, contracts) => {
if (err) {
return done(err);
}
self.events.request('contracts:dependencies', (err, contractDependencies) => {
self.events.request('contracts:list', (err, contracts) => {
if (err) {
return done(err);
}
self.logger.info(__("deploying contracts"));
self.events.emit("deploy:beforeAll");
self.logger.info(__("deploying contracts"));
self.events.emit("deploy:beforeAll");
const contractsPerDependencyCount = utils.groupBy(contracts, 'dependencyCount');
async.eachSeries(contractsPerDependencyCount,
function (parallelGroups, callback) {
async.each(parallelGroups, (contract, eachCb) => {
const contractDeploys = {};
contracts.forEach(contract => {
function deploy(result, callback) {
if (typeof result === 'function') {
callback = result;
}
contract._gasLimit = self.gasLimit;
self.events.request('deploy:contract', contract, (err) => {
eachCb(err);
callback(err);
});
}, callback);
},
function (err, _results) {
}
const className = contract.className;
if (!contractDependencies[className] || contractDependencies[className].length === 0) {
contractDeploys[className] = deploy;
return;
}
contractDeploys[className] = cloneDeep(contractDependencies[className]);
contractDeploys[className].push(deploy);
});
async.auto(contractDeploys, function(err, _results) {
if (err) {
self.logger.error(__("error deploying contracts"));
self.logger.error(err.message);
@ -56,8 +84,8 @@ class DeployManager {
}
self.logger.info(__("finished deploying contracts"));
done(err);
}
);
});
});
});
}
@ -71,6 +99,13 @@ class DeployManager {
}
async.waterfall([
function requestBlockchainConnector(callback) {
self.events.request("blockchain:object", (blockchain) => {
self.blockchain = blockchain;
callback();
});
},
function buildContracts(callback) {
self.events.request("contracts:build", self.deployOnlyOnConfig, (err) => {
callback(err);
@ -78,11 +113,11 @@ class DeployManager {
},
// TODO: shouldn't be necessary
function checkCompileOnly(callback){
if(self.onlyCompile){
function checkCompileOnly(callback) {
if (self.onlyCompile) {
self.events.emit('contractsDeployed');
return done();
}
}
return callback();
},

7171
package-lock.json generated

File diff suppressed because it is too large Load Diff