implement deploy field

This commit is contained in:
Iuri Matias 2015-08-31 20:53:17 -04:00
parent 44583f525f
commit e1ae6dae0c
5 changed files with 13 additions and 2 deletions

View File

@ -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). See [Configuration](https://github.com/iurimatias/embark-framework/wiki/Configuration).
Deploying only contracts Deploying only contracts
====== ======
Although embark run will automatically deploy contracts, you can choose to only deploy the contracts to a specific environment Although embark run will automatically deploy contracts, you can choose to only deploy the contracts to a specific environment

View File

@ -132,6 +132,11 @@ ContractsConfig.prototype.compileContracts = function(env) {
contract.types.push('static'); contract.types.push('static');
} }
contract.deploy = contractConfig.deploy;
if (contractConfig.deploy === undefined) {
contract.deploy = true;
}
if (this.all_contracts.indexOf(className) < 0) { if (this.all_contracts.indexOf(className) < 0) {
this.all_contracts.push(className); this.all_contracts.push(className);
} }

View File

@ -58,6 +58,11 @@ Deploy.prototype.deploy_contracts = function(env) {
className = all_contracts[k]; className = all_contracts[k];
contract = this.contractDB[className]; contract = this.contractDB[className];
if (contract.deploy === false) {
console.log("skipping " + className);
continue;
}
var realArgs = []; var realArgs = [];
for (var l = 0; l < contract.args.length; l++) { for (var l = 0; l < contract.args.length; l++) {
arg = contract.args[l]; arg = contract.args[l];

View File

@ -110,12 +110,13 @@ describe('embark.deploy', function() {
deploy.deploy_contracts("development"); deploy.deploy_contracts("development");
it("should deploy contracts", function() { 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++) { for(var i=0; i < all_contracts.length; i++) {
var className = all_contracts[i]; var className = all_contracts[i];
assert.equal(deploy.deployedContracts.hasOwnProperty(className), true); assert.equal(deploy.deployedContracts.hasOwnProperty(className), true);
} }
assert.notEqual(deploy.deployedContracts.hasOwnProperty('SimpleStorage'), true);
}); });
}); });

View File

@ -1,5 +1,6 @@
development: development:
SimpleStorage: SimpleStorage:
deploy: false
args: args:
- 100 - 100
BarStorage: BarStorage: