feat: strategy for deployment

Allow implicit and explicit for deployment strategy
implicit: all contracts are deployed
explicit: only specified contracts are deployed

Default value: implicit
This commit is contained in:
Anthony Laibe 2018-11-07 11:35:51 +00:00
parent 0e7aad81aa
commit f9f4c28f72
7 changed files with 41 additions and 0 deletions

View File

@ -56,5 +56,9 @@
"logs": {
"logPath": ".embark/logs/",
"maxLogLength": 1500
},
"deploymentStrategy": {
"implicit": "implicit",
"explicit": "explicit"
}
}

View File

@ -276,6 +276,7 @@ Config.prototype.loadContractsConfigFile = function() {
"$WEB3",
"localhost:8545"
],
"strategy": constants.deploymentStrategy.implicit,
"gas": "auto",
"contracts": {
}

View File

@ -4,6 +4,7 @@ const cloneDeep = require('clone-deep');
const utils = require('../../utils/utils.js');
const fs = require('../../core/fs');
const constants = require('../../constants');
// TODO: create a contract object
@ -307,6 +308,10 @@ class ContractsManager {
contract.deploy = false;
}
if (!self.contractsConfig.contracts[className] && self.contractsConfig.strategy === constants.deploymentStrategy.explicit) {
contract.deploy = false;
}
if (contract.code === "") {
const message = __("assuming %s to be an interface", className);
if (contract.silent) {

View File

@ -31,7 +31,17 @@ module.exports = {
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
// Strategy for the deployment of the contracts:
// - implicit will try to deploy all the contracts located inside the contracts directory
// or the directory configured for the location of the contracts. This is default one
// when not specified
// - explicit will only attempt to deploy the contracts that are explicity specified inside the
// contracts section.
//strategy: 'implicit',
contracts: {
// example:
//SimpleStorage: {

View File

@ -31,7 +31,17 @@ module.exports = {
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
// Strategy for the deployment of the contracts:
// - implicit will try to deploy all the contracts located inside the contracts directory
// or the directory configured for the location of the contracts. This is default one
// when not specified
// - explicit will only attempt to deploy the contracts that are explicity specified inside the
// contracts section.
//strategy: 'implicit',
contracts: {
SimpleStorage: {
fromIndex: 0,

View File

@ -31,7 +31,17 @@ module.exports = {
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
// Strategy for the deployment of the contracts:
// - implicit will try to deploy all the contracts located inside the contracts directory
// or the directory configured for the location of the contracts. This is default one
// when not specified
// - explicit will only attempt to deploy the contracts that are explicity specified inside the
// contracts section.
//strategy: 'implicit',
contracts: {
// example:
//SimpleStorage: {

View File

@ -112,6 +112,7 @@ describe('embark.Config', function () {
deployment: {host: 'localhost', port: 8545, type: 'rpc', "accounts": [{"mnemonic": "12 word mnemonic", "balance": "5000000000"}]},
dappConnection: ['$WEB3', 'localhost:8545'],
"gas": "400000",
"strategy": "implicit",
"contracts": {
"SimpleStorage": {
"args": [100],