mirror of https://github.com/embarklabs/embark.git
redeploy with right config on config change
This commit is contained in:
parent
5aa05c8094
commit
94c493e854
|
@ -13,6 +13,7 @@
|
||||||
"any": "any"
|
"any": "any"
|
||||||
},
|
},
|
||||||
"events": {
|
"events": {
|
||||||
"contractFilesChanged": "contractFilesChanged"
|
"contractFilesChanged": "contractFilesChanged",
|
||||||
|
"contractConfigChanged": "contractConfigChanged"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,11 @@ class ContractsManager {
|
||||||
this.deployOnlyOnConfig = false;
|
this.deployOnlyOnConfig = false;
|
||||||
this.events = options.events;
|
this.events = options.events;
|
||||||
|
|
||||||
this.events.on(constants.events.contractFilesChanged, (newContracts) => {
|
this.events.on(constants.events.contractFilesChanged, (newContractFiles) => {
|
||||||
this.contractFiles = newContracts;
|
this.contractFiles = newContractFiles;
|
||||||
|
});
|
||||||
|
this.events.on(constants.events.contractConfigChanged, (newContracts) => {
|
||||||
|
this.contractsConfig = newContracts;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,12 @@ Config.prototype.loadContractsConfigFile = function() {
|
||||||
|
|
||||||
let configFilePath = this._getFileOrOject(this.configDir, 'contracts.json', 'contracts');
|
let configFilePath = this._getFileOrOject(this.configDir, 'contracts.json', 'contracts');
|
||||||
|
|
||||||
this.contractsConfig = this._mergeConfig(configFilePath, configObject, this.env);
|
const newContractsConfig = this._mergeConfig(configFilePath, configObject, this.env);
|
||||||
|
|
||||||
|
if (!deepEqual(newContractsConfig, this.contractsConfig)) {
|
||||||
|
this.events.emit(constants.events.contractConfigChanged, newContractsConfig);
|
||||||
|
this.contractsConfig = newContractsConfig;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Config.prototype.loadExternalContractsFiles = function() {
|
Config.prototype.loadExternalContractsFiles = function() {
|
||||||
|
@ -220,7 +225,7 @@ Config.prototype.loadWebServerConfigFile = function() {
|
||||||
Config.prototype.loadEmbarkConfigFile = function() {
|
Config.prototype.loadEmbarkConfigFile = function() {
|
||||||
const contracts = this.embarkConfig.contracts;
|
const contracts = this.embarkConfig.contracts;
|
||||||
const newContractsFiles = this.loadFiles(contracts);
|
const newContractsFiles = this.loadFiles(contracts);
|
||||||
if (newContractsFiles.length !== this.contractFiles || deepEqual(newContractsFiles, this.contractFiles)) {
|
if (!this.contractFiles || newContractsFiles.length !== this.contractFiles.length || !deepEqual(newContractsFiles, this.contractFiles)) {
|
||||||
this.events.emit(constants.events.contractFilesChanged, newContractsFiles);
|
this.events.emit(constants.events.contractFilesChanged, newContractsFiles);
|
||||||
this.contractsFiles = newContractsFiles;
|
this.contractsFiles = newContractsFiles;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue