Skip to content

Commit 0991a87

Browse files
committed
add support for embark_js directive
1 parent 0e904bb commit 0991a87

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/core/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ Config.prototype.loadFiles = function(files) {
229229

230230
// get embark.js object first
231231
originalFiles.filter(function(file) {
232-
return file.indexOf('.') >= 0;
232+
return (file[0] === '$' || file.indexOf('.') >= 0);
233233
}).filter(function(file) {
234234
if (file === 'embark.js') {
235235

@@ -249,6 +249,9 @@ Config.prototype.loadFiles = function(files) {
249249

250250
readFiles.push({filename: 'embark.js', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")});
251251
}
252+
if (file === '$EMBARK_JS') {
253+
readFiles.push({filename: '$EMBARK_JS', content: fs.readFileSync(fs.embarkPath("js/build/embark.bundle.js")).toString(), path: fs.embarkPath("js/build/embark.bundle.js")});
254+
}
252255
if (file.indexOf("web3-") === 0) {
253256
let web3Version = file.split('web3-')[1].split(".js")[0];
254257
npm.getPackageVersion('web3', web3Version, function(web3Content) {

lib/pipeline/pipeline.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class Pipeline {
2525

2626
if (file.filename === "$ALL_CONTRACTS") {
2727
return {content: abi, filename: file.filename, path: file.path, modified: true};
28+
} else if (file.filename === "$EMBARK_JS") {
29+
return {content: file.content, filename: "embark.js", path: file.path, modified: true};
2830
} else if (file.filename[0] === '$') {
2931
let contractName = file.filename.substr(1);
3032
return {content: this.buildContractJS(contractName), filename: contractName + ".js", path: file.path, modified: true};

test_app/embark.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
"test2.html": "app/test2.html",
1414
"js/myweb3.js": "web3-0.18.js",
1515
"js/web3.js": "web3.js",
16-
"js/all_contracts.js": "$ALL_CONTRACTS"
16+
"js/all_contracts.js": "$ALL_CONTRACTS",
17+
"js/only_embark.js": "$EMBARK_JS"
1718
},
1819
"buildDir": "dist/",
1920
"config": "config/",

0 commit comments

Comments
 (0)