don't redeploy if an asset has been changed and not a contract
This commit is contained in:
parent
ed530e8511
commit
41baca4b51
|
@ -1,7 +1,6 @@
|
|||
let async = require('async');
|
||||
//require("../utils/debug_util.js")(__filename, async);
|
||||
let Deploy = require('./deploy.js');
|
||||
let ContractsManager = require('./contracts.js');
|
||||
let RunCode = require('../core/runCode.js');
|
||||
|
||||
class DeployManager {
|
||||
|
@ -14,6 +13,7 @@ class DeployManager {
|
|||
this.plugins = options.plugins;
|
||||
this.web3 = options.web3;
|
||||
this.chainConfig = (options.trackContracts !== false) ? this.config.chainTracker : false;
|
||||
this.contractsManager = options.contractsManager;
|
||||
this.gasLimit = false;
|
||||
this.fatalErrors = false;
|
||||
}
|
||||
|
@ -29,14 +29,7 @@ class DeployManager {
|
|||
|
||||
async.waterfall([
|
||||
function buildContracts(callback) {
|
||||
let contractsManager = new ContractsManager({
|
||||
contractFiles: self.config.contractsFiles,
|
||||
contractsConfig: self.config.contractsConfig,
|
||||
logger: self.logger,
|
||||
plugins: self.plugins,
|
||||
gasLimit: self.gasLimit
|
||||
});
|
||||
contractsManager.build(callback);
|
||||
self.contractsManager.build(callback);
|
||||
},
|
||||
function checkWeb3IsConnected(contractsManager, callback) {
|
||||
if (!self.web3) {
|
||||
|
|
|
@ -2,6 +2,7 @@ let Web3 = require('web3');
|
|||
let Events = require('./events.js');
|
||||
let Logger = require('./logger.js');
|
||||
let Config = require('./config.js');
|
||||
let ContractsManager = require('../contracts/contracts.js');
|
||||
let DeployManager = require('../contracts/deploy_manager.js');
|
||||
let CodeGenerator = require('../contracts/code_generator.js');
|
||||
let ServicesMonitor = require('./services_monitor.js');
|
||||
|
@ -99,13 +100,11 @@ class Engine {
|
|||
});
|
||||
// TODO: still need to redeploy contracts because the original contracts
|
||||
// config is being corrupted
|
||||
//this.events.on('file-event', function(fileType, path) {
|
||||
// if (fileType === 'asset') {
|
||||
// self.config.reloadConfig();
|
||||
// pipeline.build(self.abi, self.contractsJSON, path);
|
||||
// self.events.emit('outputDone');
|
||||
// }
|
||||
//});
|
||||
this.events.on('file-event', function(fileType, _path) {
|
||||
if (fileType === 'asset') {
|
||||
self.events.emit('asset-changed', self.contractsManager);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
codeGeneratorService(_options) {
|
||||
|
@ -128,6 +127,7 @@ class Engine {
|
|||
};
|
||||
this.events.on('contractsDeployed', generateCode);
|
||||
this.events.on('blockchainDisabled', generateCode);
|
||||
this.events.on('asset-changed', generateCode);
|
||||
}
|
||||
|
||||
deploymentService(options) {
|
||||
|
@ -137,23 +137,32 @@ class Engine {
|
|||
contractDirectories: self.config.contractDirectories
|
||||
});
|
||||
|
||||
this.contractsManager = new ContractsManager({
|
||||
contractFiles: this.config.contractsFiles,
|
||||
contractsConfig: this.config.contractsConfig,
|
||||
logger: this.logger,
|
||||
plugins: this.plugins,
|
||||
gasLimit: false
|
||||
});
|
||||
|
||||
this.deployManager = new DeployManager({
|
||||
web3: options.web3 || self.web3,
|
||||
trackContracts: options.trackContracts,
|
||||
config: this.config,
|
||||
logger: this.logger,
|
||||
plugins: this.plugins,
|
||||
events: this.events
|
||||
events: this.events,
|
||||
contractsManager: this.contractsManager
|
||||
});
|
||||
|
||||
this.events.on('file-event', function (_fileType, _path) {
|
||||
this.events.on('file-event', function (fileType, _path) {
|
||||
// TODO: for now need to deploy on asset chanes as well
|
||||
// because the contractsManager config is corrupted after a deploy
|
||||
//if (fileType === 'contract' || fileType === 'config') {
|
||||
self.config.reloadConfig();
|
||||
self.deployManager.deployContracts(function () {
|
||||
});
|
||||
//}
|
||||
if (fileType === 'contract' || fileType === 'config') {
|
||||
self.config.reloadConfig();
|
||||
self.deployManager.deployContracts(function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ Test.prototype.deployAll = function(contractsConfig, cb) {
|
|||
});
|
||||
|
||||
self.engine.deployManager.gasLimit = 6000000;
|
||||
self.engine.contractsManager.gasLimit = 6000000;
|
||||
self.engine.deployManager.fatalErrors = true;
|
||||
self.engine.deployManager.deployContracts(function(err, _result) {
|
||||
if (err) {
|
||||
|
|
Loading…
Reference in New Issue