From 8e349cc6ed3535ba69643e741bb3836a95889946 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sun, 2 Jul 2017 18:03:14 -0400 Subject: [PATCH] support directive --- lib/core/config.js | 2 +- lib/core/run_tests.js | 2 +- lib/pipeline/npm.js | 2 +- lib/pipeline/pipeline.js | 7 ++++--- test_app/embark.json | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/core/config.js b/lib/core/config.js index 2c40419e0..8daeaaa4a 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -249,7 +249,7 @@ Config.prototype.loadFiles = function(files) { readFiles.push({filename: 'embark.js', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")}); } - if (file.indexOf("web3-") == 0) { + if (file.indexOf("web3-") === 0) { let web3Version = file.split('web3-')[1].split(".js")[0]; npm.getPackageVersion('web3', web3Version, function(web3Content) { self.logger.error('downloaded web3'); diff --git a/lib/core/run_tests.js b/lib/core/run_tests.js index ad90fff6e..f553b779d 100644 --- a/lib/core/run_tests.js +++ b/lib/core/run_tests.js @@ -67,5 +67,5 @@ module.exports = { }); } -} +}; diff --git a/lib/pipeline/npm.js b/lib/pipeline/npm.js index af06de3e3..59b725dc0 100644 --- a/lib/pipeline/npm.js +++ b/lib/pipeline/npm.js @@ -17,7 +17,7 @@ module.exports = { let gitHash = registryJSON.gitHead; let repo = registryJSON.homepage.split("github.com/")[1]; - let gitUrl = "http://raw.githubusercontent.com/" + repo + "/" + gitHash + "/dist/" + packageName + ".js" + let gitUrl = "http://raw.githubusercontent.com/" + repo + "/" + gitHash + "/dist/" + packageName + ".js"; utils.httpGet(gitUrl, function (res2) { let body = ''; res2.on('data', function (d) { diff --git a/lib/pipeline/pipeline.js b/lib/pipeline/pipeline.js index a36158683..eb2e33d0c 100644 --- a/lib/pipeline/pipeline.js +++ b/lib/pipeline/pipeline.js @@ -23,11 +23,12 @@ class Pipeline { let pipelinePlugins = this.plugins.getPluginsFor('pipeline'); - if (file.filename[0] === '$') { + if (file.filename === "$ALL_CONTRACTS") { + return {content: abi, filename: file.filename, path: file.path, modified: true}; + } else if (file.filename[0] === '$') { let contractName = file.filename.substr(1); return {content: this.buildContractJS(contractName), filename: contractName + ".js", path: file.path, modified: true}; - } - else if (file.filename === 'embark.js') { + } else if (file.filename === 'embark.js') { return {content: file.content + "\n" + abi, filename: file.filename, path: file.path, modified: true}; } else if (file.filename === 'abi.js') { return {content: abi, filename: file.filename, path: file.path, modified: true}; diff --git a/test_app/embark.json b/test_app/embark.json index 330d6fd82..8f1ee41e7 100644 --- a/test_app/embark.json +++ b/test_app/embark.json @@ -12,7 +12,8 @@ "test.html": "app/test.html", "test2.html": "app/test2.html", "js/myweb3.js": "web3-0.18.js", - "js/web3.js": "web3.js" + "js/web3.js": "web3.js", + "js/all_contracts.js": "$ALL_CONTRACTS" }, "buildDir": "dist/", "config": "config/",