diff --git a/README.md b/README.md index ae29a399..7acffc93 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,6 @@ The environment is a specific blockchain configuration that can be managed at co See [Configuration](https://github.com/iurimatias/embark-framework/wiki/Configuration). - Deploying only contracts ====== Although embark run will automatically deploy contracts, you can choose to only deploy the contracts to a specific environment diff --git a/lib/config/contracts.js b/lib/config/contracts.js index ee962442..0e74e1d4 100644 --- a/lib/config/contracts.js +++ b/lib/config/contracts.js @@ -132,6 +132,11 @@ ContractsConfig.prototype.compileContracts = function(env) { contract.types.push('static'); } + contract.deploy = contractConfig.deploy; + if (contractConfig.deploy === undefined) { + contract.deploy = true; + } + if (this.all_contracts.indexOf(className) < 0) { this.all_contracts.push(className); } diff --git a/lib/deploy.js b/lib/deploy.js index d00b0c7b..e65a3625 100644 --- a/lib/deploy.js +++ b/lib/deploy.js @@ -58,6 +58,11 @@ Deploy.prototype.deploy_contracts = function(env) { className = all_contracts[k]; contract = this.contractDB[className]; + if (contract.deploy === false) { + console.log("skipping " + className); + continue; + } + var realArgs = []; for (var l = 0; l < contract.args.length; l++) { arg = contract.args[l]; diff --git a/test/deploy.js b/test/deploy.js index 7e7fd6b2..e5c1fc46 100644 --- a/test/deploy.js +++ b/test/deploy.js @@ -110,12 +110,13 @@ describe('embark.deploy', function() { deploy.deploy_contracts("development"); it("should deploy contracts", function() { - var all_contracts = ['SimpleStorage', 'BarStorage', 'FooStorage']; + var all_contracts = ['BarStorage', 'FooStorage']; for(var i=0; i < all_contracts.length; i++) { var className = all_contracts[i]; assert.equal(deploy.deployedContracts.hasOwnProperty(className), true); } + assert.notEqual(deploy.deployedContracts.hasOwnProperty('SimpleStorage'), true); }); }); diff --git a/test/support/instances.yml b/test/support/instances.yml index 04e15644..04172a48 100644 --- a/test/support/instances.yml +++ b/test/support/instances.yml @@ -1,5 +1,6 @@ development: SimpleStorage: + deploy: false args: - 100 BarStorage: