fix dir in contractsDirectory

This commit is contained in:
Jonathan Rainville 2018-04-18 12:59:58 -04:00
parent 9faf644c31
commit b931efcf7d
2 changed files with 4 additions and 5 deletions

View File

@ -4,6 +4,8 @@ const Plugins = require('./plugins.js');
const utils = require('../utils/utils.js'); const utils = require('../utils/utils.js');
const path = require('path'); const path = require('path');
const httpContractDir = '.embark/contracts/';
var Config = function(options) { var Config = function(options) {
this.env = options.env; this.env = options.env;
this.blockchainConfig = {}; this.blockchainConfig = {};
@ -188,8 +190,7 @@ Config.prototype.loadExternalContractsFiles = function() {
} }
if (contract.file.startsWith('http') || contract.file.startsWith('git')) { if (contract.file.startsWith('http') || contract.file.startsWith('git')) {
const url = this.getExternalContractUrl(contract); const url = this.getExternalContractUrl(contract);
// TODO put directory name somewhere else const localFile = httpContractDir + path.basename(url);
const localFile = utils.joinPath(process.cwd(), '.embark/contracts', path.basename(url));
this.contractsFiles.push(new File({filename: localFile, type: "http", basedir: '', path: url})); this.contractsFiles.push(new File({filename: localFile, type: "http", basedir: '', path: url}));
} else if (fs.existsSync(contract.file)) { } else if (fs.existsSync(contract.file)) {
this.contractsFiles.push(new File({filename: contract.file, type: "dapp_file", basedir: '', path: contract.file})); this.contractsFiles.push(new File({filename: contract.file, type: "dapp_file", basedir: '', path: contract.file}));
@ -258,6 +259,7 @@ Config.prototype.loadEmbarkConfigFile = function() {
}).map((dir) => { }).map((dir) => {
return dir.split("*.")[0]; return dir.split("*.")[0];
}); });
this.contractDirectories.push(httpContractDir);
this.buildDir = this.embarkConfig.buildDir; this.buildDir = this.embarkConfig.buildDir;
this.configDir = this.embarkConfig.config; this.configDir = this.embarkConfig.config;

View File

@ -1,6 +1,5 @@
let async = require('../../utils/async_extend.js'); let async = require('../../utils/async_extend.js');
let SolcW = require('./solcW.js'); let SolcW = require('./solcW.js');
const path = require('path');
class Solidity { class Solidity {
@ -26,8 +25,6 @@ class Solidity {
let match = new RegExp("^" + directory); let match = new RegExp("^" + directory);
filename = filename.replace(match, ''); filename = filename.replace(match, '');
} }
// TODO remove this and fix it
filename = path.basename(filename);
file.content(function(fileContent) { file.content(function(fileContent) {
if (!fileContent) { if (!fileContent) {