Skip to content

Commit 9cdcc4f

Browse files
committed
add code to import in solcP
1 parent 60fb6b1 commit 9cdcc4f

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

lib/constants.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"httpContractsDirectory": ".embark/contracts/"
3+
}

lib/core/config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ const File = require('./file.js');
33
const Plugins = require('./plugins.js');
44
const utils = require('../utils/utils.js');
55
const path = require('path');
6-
7-
const httpContractDir = '.embark/contracts/';
6+
const constants = require('../constants');
87

98
var Config = function(options) {
109
this.env = options.env;
@@ -199,7 +198,7 @@ Config.prototype.loadExternalContractsFiles = function() {
199198
if (!fileObj) {
200199
return this.logger.error("HTTP contract file not found: " + contract.file);
201200
}
202-
const localFile = httpContractDir + fileObj.filePath;
201+
const localFile = constants.httpContractsDirectory + fileObj.filePath;
203202
this.contractsFiles.push(new File({filename: localFile, type: File.types.http, basedir: '', path: fileObj.url}));
204203
} else if (fs.existsSync(contract.file)) {
205204
this.contractsFiles.push(new File({filename: contract.file, type: File.types.dapp_file, basedir: '', path: contract.file}));
@@ -268,7 +267,7 @@ Config.prototype.loadEmbarkConfigFile = function() {
268267
}).map((dir) => {
269268
return dir.split("*.")[0];
270269
});
271-
this.contractDirectories.push(httpContractDir);
270+
this.contractDirectories.push(constants.httpContractsDirectory);
272271

273272
this.buildDir = this.embarkConfig.buildDir;
274273
this.configDir = this.embarkConfig.config;

lib/core/file.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ class File {
3838
}
3939

4040
downloadFile (filename, url, callback) {
41-
console.log('Downloading:', filename, 'form', url);
4241
const self = this;
4342
async.waterfall([
4443
function makeTheDir(next) {

lib/modules/solidity/solcP.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
let solc;
22

3-
let fs = require('fs-extra');
4-
let path = require('path');
3+
const fs = require('fs-extra');
4+
const path = require('path');
5+
const constants = require('../../constants');
56

67
function findImports(filename) {
78
if (fs.existsSync(filename)) {
@@ -10,6 +11,9 @@ function findImports(filename) {
1011
if (fs.existsSync(path.join('./node_modules/', filename))) {
1112
return {contents: fs.readFileSync(path.join('./node_modules/', filename)).toString()};
1213
}
14+
if (fs.existsSync(path.join(constants.httpContractsDirectory, filename))) {
15+
return {contents: fs.readFileSync(path.join('./.embark/contracts', filename)).toString()};
16+
}
1317
return {error: 'File not found'};
1418
}
1519

0 commit comments

Comments
 (0)