From 98054a2cbb6bf3be19e0f2722b8d247b5c206110 Mon Sep 17 00:00:00 2001 From: Gerbrand van DIeijen Date: Fri, 4 Sep 2015 10:55:19 +0200 Subject: [PATCH 1/2] Allowing to define chains file per environment/chain --- bin/embark | 5 +---- lib/config/blockchain.js | 1 + test/config.blockchain.js | 6 +++++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/embark b/bin/embark index 1ee8d2bc0..0442cdf87 100755 --- a/bin/embark +++ b/bin/embark @@ -17,15 +17,12 @@ var run = function(cmd) { var deploy = function(env, embarkConfig) { var contractFiles = grunt.file.expand(embarkConfig.contracts); var destFile = embarkConfig.output; - var chainFile = embarkConfig.chains; Embark.init(); Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig); Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig); - if (chainFile === undefined) { - chainFile = './chains.json'; - } + var chainFile = Embark.blockchainConfig.blockchainConfig[env].chains || embarkConfig.chains || './chains.json'; abi = Embark.deployContracts(env, contractFiles, destFile, chainFile); grunt.file.write(destFile, abi); diff --git a/lib/config/blockchain.js b/lib/config/blockchain.js index 368fa493f..15323a9a0 100644 --- a/lib/config/blockchain.js +++ b/lib/config/blockchain.js @@ -40,6 +40,7 @@ BlockchainConfig.prototype.config = function(env) { minerthreads: config.minerthreads, genesisBlock: config.genesis_block, datadir: config.datadir, + chains: config.chains, networkId: networkId, maxPeers: 4, port: config.port || "30303", diff --git a/test/config.blockchain.js b/test/config.blockchain.js index bf98b4bc4..d9db61295 100644 --- a/test/config.blockchain.js +++ b/test/config.blockchain.js @@ -43,6 +43,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesis_block: 'config/genesis.json', datadir: '/tmp/embark', + chains: 'chains_development.json', mine_when_needed: true, gas_limit: 123, gas_price: 100, @@ -67,6 +68,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesisBlock: 'config/genesis.json', datadir: '/tmp/embark', + chains: 'chains_development.json', networkId: 0, maxPeers: 4, port: "30303", @@ -88,12 +90,13 @@ describe('embark.config.blockchain', function() { network_id: 0, minerthreads: 1, datadir: '/tmp/embark', + chains: undefined, mine_when_needed: true, console: false, account: { init: true, password: 'config/password' - } + }, }, staging: {} }; @@ -110,6 +113,7 @@ describe('embark.config.blockchain', function() { minerthreads: 1, genesisBlock: undefined, datadir: '/tmp/embark', + chains: undefined, networkId: 0, maxPeers: 4, port: "30303", From a3464a4d8802d38efd8f0aa62e36524422efd699 Mon Sep 17 00:00:00 2001 From: Gerbrand van DIeijen Date: Fri, 4 Sep 2015 11:18:54 +0200 Subject: [PATCH 2/2] Added minor reference to chains specific chains file --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b5dd3bda0..4930ed01d 100644 --- a/README.md +++ b/README.md @@ -201,7 +201,7 @@ Tests You can run specs with ```embark spec```, it will run any files ending *_spec.js under ```spec/```. -Embark includes a testing lib to fastly run & test your contracts in a EVM. +Embark includes a testing lib to fastly run & test your contracts in a EVM. ```Javascript # spec/contracts/simple_storage_spec.js @@ -255,6 +255,7 @@ The environment is a specific blockchain configuration that can be managed at co rpc_port: 8101 rpc_whitelist: "*" datadir: default + chains: chains_staging.json network_id: 0 console: true account: @@ -323,4 +324,3 @@ $ echo 'export PATH="$PATH:$HOME/npm-global/bin"' >>~/.bashrc $ source ~/.bashrc $ npm install -g embark-framework grunt-cli ``` -