mirror of https://github.com/embarklabs/embark.git
feature(@embark/deploytracker) support configuring deployment tracking file on a per environment basis; put default dev on temporary directory
This commit is contained in:
parent
37080c55ae
commit
2c2a09ca68
|
@ -99,7 +99,6 @@ Config.prototype.loadConfigFiles = function(options) {
|
|||
this.loadContractsConfigFile();
|
||||
this.loadExternalContractsFiles();
|
||||
this.loadWebServerConfigFile();
|
||||
this.loadChainTrackerFile();
|
||||
this.loadPluginContractFiles();
|
||||
|
||||
this._updateBlockchainCors();
|
||||
|
@ -116,7 +115,6 @@ Config.prototype.reloadConfig = function() {
|
|||
this.loadAssetFiles();
|
||||
this.loadContractsConfigFile();
|
||||
this.loadExternalContractsFiles();
|
||||
this.loadChainTrackerFile();
|
||||
|
||||
this._updateBlockchainCors();
|
||||
};
|
||||
|
@ -541,15 +539,6 @@ Config.prototype.loadAssetFiles = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Config.prototype.loadChainTrackerFile = function() {
|
||||
if (!fs.existsSync(this.chainsFile)) {
|
||||
this.logger.info(this.chainsFile + ' ' + __('file not found, creating it...'));
|
||||
fs.writeJSONSync(this.chainsFile, {});
|
||||
}
|
||||
|
||||
this.chainTracker = fs.readJSONSync(this.chainsFile);
|
||||
};
|
||||
|
||||
function findMatchingExpression(filename, filesExpressions) {
|
||||
for (let fileExpression of filesExpressions) {
|
||||
var matchingFiles = utils.filesMatchingPattern(fileExpression);
|
||||
|
|
|
@ -108,6 +108,10 @@ function writeJSONSync() {
|
|||
return restrictPath(fs.writeJSONSync, fs.writeJSONSync, 1, arguments);
|
||||
}
|
||||
|
||||
function outputJSONSync() {
|
||||
return restrictPath(fs.outputJSONSync, fs.outputJSONSync, 1, arguments);
|
||||
}
|
||||
|
||||
function writeJson() {
|
||||
return restrictPath(fs.writeJson, fs.writeJson, 1, arguments);
|
||||
}
|
||||
|
@ -219,6 +223,7 @@ module.exports = {
|
|||
move,
|
||||
moveSync,
|
||||
outputFileSync,
|
||||
outputJSONSync,
|
||||
pkgPath,
|
||||
readFile,
|
||||
readFileSync,
|
||||
|
|
|
@ -11,12 +11,26 @@ class DeployTracker {
|
|||
|
||||
// TODO: unclear where it comes from
|
||||
this.env = options.env;
|
||||
//this.chainConfig = options.chainConfig;
|
||||
this.chainConfig = embark.config.chainTracker;
|
||||
this.chainConfig = {};
|
||||
this.chainFile = embark.config.contractsConfig.tracking;
|
||||
this.loadChainTrackerFile();
|
||||
this.registerEvents();
|
||||
}
|
||||
|
||||
loadChainTrackerFile() {
|
||||
if (this.chainFile === false) return;
|
||||
if (this.chainFile === undefined) this.chainFile = ".embark/chains.json";
|
||||
this.chainFile = fs.dappPath(this.chainFile);
|
||||
if (!fs.existsSync(this.chainFile)) {
|
||||
this.logger.info(this.chainFile + ' ' + __('file not found, creating it...'));
|
||||
fs.outputJSONSync(this.chainFile, {});
|
||||
}
|
||||
|
||||
this.chainConfig = fs.readJSONSync(this.chainFile);
|
||||
}
|
||||
|
||||
registerEvents() {
|
||||
if (this.chainFile === false) return;
|
||||
const self = this;
|
||||
|
||||
this.embark.registerActionForEvent("deploy:beforeAll", this.setCurrentChain.bind(this));
|
||||
|
@ -91,7 +105,7 @@ class DeployTracker {
|
|||
if (this.chainConfig === false) {
|
||||
return;
|
||||
}
|
||||
fs.writeJSONSync("./chains.json", this.chainConfig, {spaces: 2});
|
||||
fs.writeJSONSync(this.chainFile, this.chainConfig, {spaces: 2});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
**/.embark
|
||||
**/chains.json
|
||||
**/config/production/password
|
||||
**/config/livenet/password
|
||||
**/coverage
|
||||
|
|
Loading…
Reference in New Issue