2019-08-30 20:50:20 +00:00
|
|
|
import DeploymentChecks from "./deploymentChecks";
|
|
|
|
import TrackingFunctions from "./trackingFunctions";
|
2016-09-25 01:10:47 +00:00
|
|
|
|
2017-03-30 11:12:39 +00:00
|
|
|
class DeployTracker {
|
2018-05-19 02:40:47 +00:00
|
|
|
|
2019-10-29 16:14:26 +00:00
|
|
|
constructor(embark, {trackContracts, plugins}) {
|
2019-08-30 20:50:20 +00:00
|
|
|
const {logger, events, fs, config} = embark;
|
2018-08-20 21:25:30 +00:00
|
|
|
this.embark = embark;
|
2018-05-19 02:40:47 +00:00
|
|
|
|
2019-10-29 16:14:26 +00:00
|
|
|
const trackingFunctions = new TrackingFunctions({config, fs, logger, events, trackContracts});
|
2020-01-07 13:41:35 +00:00
|
|
|
const deploymentChecks = new DeploymentChecks({trackingFunctions, logger, events, plugins, contractsConfig: config.contractsConfig});
|
2018-05-19 02:40:47 +00:00
|
|
|
|
2019-08-30 20:50:20 +00:00
|
|
|
this.embark.registerActionForEvent("deployment:contract:deployed", trackingFunctions.trackAndSaveContract.bind(trackingFunctions));
|
|
|
|
this.embark.registerActionForEvent("deployment:contract:shouldDeploy", deploymentChecks.checkContractConfig.bind(deploymentChecks));
|
|
|
|
this.embark.registerActionForEvent("deployment:contract:shouldDeploy", deploymentChecks.checkIfAlreadyDeployed.bind(deploymentChecks));
|
2018-05-19 02:40:47 +00:00
|
|
|
}
|
2017-03-30 11:12:39 +00:00
|
|
|
}
|
2016-09-25 01:10:47 +00:00
|
|
|
|
|
|
|
module.exports = DeployTracker;
|