From 03f0b07d8151e9466cf6bad8d0339b0e0c98e63c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 31 Mar 2018 19:35:20 -0400 Subject: [PATCH] support versions on embark json config --- lib/core/config.js | 5 +++-- templates/boilerplate/config/contracts.json | 4 ---- templates/boilerplate/config/storage.json | 3 --- templates/boilerplate/embark.json | 5 +++++ templates/demo/config/contracts.json | 4 ---- templates/demo/config/storage.json | 3 --- templates/demo/embark.json | 5 +++++ templates/simple/contracts.json | 4 ---- templates/simple/embark.json | 3 +++ test_apps/contracts_app/embark.json | 6 +++++- test_apps/test_app/config/contracts.json | 4 ---- test_apps/test_app/config/storage.json | 3 --- test_apps/test_app/embark.json | 5 +++++ 13 files changed, 26 insertions(+), 28 deletions(-) diff --git a/lib/core/config.js b/lib/core/config.js index 8683dd3a..e425f2a1 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -18,6 +18,7 @@ var Config = function(options) { this.plugins = options.plugins; this.logger = options.logger; this.events = options.events; + this.embarkConfig = {}; }; Config.prototype.loadConfigFiles = function(options) { @@ -92,7 +93,7 @@ Config.prototype.loadBlockchainConfigFile = function() { Config.prototype.loadContractsConfigFile = function() { var configObject = { "default": { - "versions": { + "versions": this.embarkConfig.versions || { "web3.js": "1.0.0-beta", "solc": "0.4.17" }, @@ -120,7 +121,7 @@ Config.prototype.loadContractsConfigFile = function() { Config.prototype.loadStorageConfigFile = function() { var configObject = { "default": { - "versions": { + "versions": this.embarkConfig.versions || { "ipfs-api": "17.2.4" }, "enabled": true, diff --git a/templates/boilerplate/config/contracts.json b/templates/boilerplate/config/contracts.json index 41db174d..8ea794ea 100644 --- a/templates/boilerplate/config/contracts.json +++ b/templates/boilerplate/config/contracts.json @@ -1,9 +1,5 @@ { "default": { - "versions": { - "web3.js": "1.0.0-beta", - "solc": "0.4.17" - }, "deployment": { "host": "localhost", "port": 8545, diff --git a/templates/boilerplate/config/storage.json b/templates/boilerplate/config/storage.json index b2865584..f1041e84 100644 --- a/templates/boilerplate/config/storage.json +++ b/templates/boilerplate/config/storage.json @@ -1,8 +1,5 @@ { "default": { - "versions": { - "ipfs-api": "17.2.4" - }, "enabled": true, "ipfs_bin": "ipfs", "provider": "ipfs", diff --git a/templates/boilerplate/embark.json b/templates/boilerplate/embark.json index c2ab4b83..37d16797 100644 --- a/templates/boilerplate/embark.json +++ b/templates/boilerplate/embark.json @@ -8,5 +8,10 @@ }, "buildDir": "dist/", "config": "config/", + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17", + "ipfs-api": "17.2.4" + }, "plugins": {} } diff --git a/templates/demo/config/contracts.json b/templates/demo/config/contracts.json index 3c1ef4d4..da746390 100644 --- a/templates/demo/config/contracts.json +++ b/templates/demo/config/contracts.json @@ -1,9 +1,5 @@ { "default": { - "versions": { - "web3.js": "1.0.0-beta", - "solc": "0.4.17" - }, "deployment": { "host": "localhost", "port": 8545, diff --git a/templates/demo/config/storage.json b/templates/demo/config/storage.json index b2865584..f1041e84 100644 --- a/templates/demo/config/storage.json +++ b/templates/demo/config/storage.json @@ -1,8 +1,5 @@ { "default": { - "versions": { - "ipfs-api": "17.2.4" - }, "enabled": true, "ipfs_bin": "ipfs", "provider": "ipfs", diff --git a/templates/demo/embark.json b/templates/demo/embark.json index 68b3bb6f..9ad97017 100644 --- a/templates/demo/embark.json +++ b/templates/demo/embark.json @@ -7,6 +7,11 @@ }, "buildDir": "dist/", "config": "config/", + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17", + "ipfs-api": "17.2.4" + }, "plugins": { } } diff --git a/templates/simple/contracts.json b/templates/simple/contracts.json index 41db174d..8ea794ea 100644 --- a/templates/simple/contracts.json +++ b/templates/simple/contracts.json @@ -1,9 +1,5 @@ { "default": { - "versions": { - "web3.js": "1.0.0-beta", - "solc": "0.4.17" - }, "deployment": { "host": "localhost", "port": 8545, diff --git a/templates/simple/embark.json b/templates/simple/embark.json index 1bf27d8f..4c43334a 100644 --- a/templates/simple/embark.json +++ b/templates/simple/embark.json @@ -3,5 +3,8 @@ "app": {}, "buildDir": "build/", "config": "./", + "versions": { + "solc": "0.4.17" + }, "plugins": {} } diff --git a/test_apps/contracts_app/embark.json b/test_apps/contracts_app/embark.json index d0a0f8f6..75648c57 100644 --- a/test_apps/contracts_app/embark.json +++ b/test_apps/contracts_app/embark.json @@ -2,5 +2,9 @@ "contracts": ["contracts/**"], "app": {}, "buildDir": "build/", - "config": "./" + "config": "./", + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17" + } } diff --git a/test_apps/test_app/config/contracts.json b/test_apps/test_app/config/contracts.json index 08b92dc6..d504a8ff 100644 --- a/test_apps/test_app/config/contracts.json +++ b/test_apps/test_app/config/contracts.json @@ -1,9 +1,5 @@ { "default": { - "versions": { - "web3.js": "1.0.0-beta.27", - "solc": "0.4.18" - }, "deployment": { "host": "localhost", "port": 8545, diff --git a/test_apps/test_app/config/storage.json b/test_apps/test_app/config/storage.json index 5492ed28..c1edf6d3 100644 --- a/test_apps/test_app/config/storage.json +++ b/test_apps/test_app/config/storage.json @@ -1,8 +1,5 @@ { "default": { - "versions": { - "ipfs-api": "17.2.6" - }, "enabled": true, "available_providers": ["ipfs"], "ipfs_bin": "ipfs", diff --git a/test_apps/test_app/embark.json b/test_apps/test_app/embark.json index 60615ef4..8459e8af 100644 --- a/test_apps/test_app/embark.json +++ b/test_apps/test_app/embark.json @@ -14,6 +14,11 @@ }, "buildDir": "dist/", "config": "config/", + "versions": { + "web3.js": "1.0.0-beta.27", + "solc": "0.4.18", + "ipfs-api": "17.2.6" + }, "plugins": { "embark-service": {} }