mirror of https://github.com/embarklabs/embark.git
change file creation with using File.types
This commit is contained in:
parent
5925124978
commit
df226919c0
|
@ -191,11 +191,11 @@ 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);
|
||||||
const localFile = httpContractDir + path.basename(url);
|
const localFile = httpContractDir + path.basename(url);
|
||||||
this.contractsFiles.push(new File({filename: localFile, type: "http", basedir: '', path: url}));
|
this.contractsFiles.push(new File({filename: localFile, type: File.types.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: File.types.dapp_file, basedir: '', path: contract.file}));
|
||||||
} else if (fs.existsSync(path.join('./node_modules/', contract.file))) {
|
} else if (fs.existsSync(path.join('./node_modules/', contract.file))) {
|
||||||
this.contractsFiles.push(new File({filename: path.join('./node_modules/', contract.file), type: "dapp_file", basedir: '', path: path.join('./node_modules/', contract.file)}));
|
this.contractsFiles.push(new File({filename: path.join('./node_modules/', contract.file), type: File.types.dapp_file, basedir: '', path: path.join('./node_modules/', contract.file)}));
|
||||||
} else {
|
} else {
|
||||||
this.logger.error("contract file not found: " + contract.file);
|
this.logger.error("contract file not found: " + contract.file);
|
||||||
}
|
}
|
||||||
|
@ -302,7 +302,7 @@ Config.prototype.loadFiles = function(files) {
|
||||||
return (file[0] === '$' || file.indexOf('.') >= 0);
|
return (file[0] === '$' || file.indexOf('.') >= 0);
|
||||||
}).filter(function(file) {
|
}).filter(function(file) {
|
||||||
let basedir = findMatchingExpression(file, files);
|
let basedir = findMatchingExpression(file, files);
|
||||||
readFiles.push(new File({filename: file, type: "dapp_file", basedir: basedir, path: file}));
|
readFiles.push(new File({filename: file, type: File.types.dapp_file, basedir: basedir, path: file}));
|
||||||
});
|
});
|
||||||
|
|
||||||
var filesFromPlugins = [];
|
var filesFromPlugins = [];
|
||||||
|
@ -335,7 +335,7 @@ Config.prototype.loadPluginContractFiles = function() {
|
||||||
contractsPlugins.forEach(function(plugin) {
|
contractsPlugins.forEach(function(plugin) {
|
||||||
plugin.contractsFiles.forEach(function(file) {
|
plugin.contractsFiles.forEach(function(file) {
|
||||||
var filename = file.replace('./','');
|
var filename = file.replace('./','');
|
||||||
self.contractsFiles.push(new File({filename: filename, type: 'custom', resolver: function(callback) {
|
self.contractsFiles.push(new File({filename: filename, type: File.types.custom, resolver: function(callback) {
|
||||||
callback(plugin.loadPluginFile(file));
|
callback(plugin.loadPluginFile(file));
|
||||||
}}));
|
}}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ let File = require('../lib/core/file.js');
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
|
|
||||||
let readFile = function(file) {
|
let readFile = function(file) {
|
||||||
return new File({filename: file, type: 'dapp_file', path: file});
|
return new File({filename: file, type: File.types.dapp_file, path: file});
|
||||||
};
|
};
|
||||||
|
|
||||||
var solcVersion = "0.4.17";
|
var solcVersion = "0.4.17";
|
||||||
|
|
|
@ -4,13 +4,12 @@ let Logger = require('../lib/core/logger.js');
|
||||||
let File = require('../lib/core/file.js');
|
let File = require('../lib/core/file.js');
|
||||||
let TestLogger = require('../lib/tests/test_logger.js');
|
let TestLogger = require('../lib/tests/test_logger.js');
|
||||||
let assert = require('assert');
|
let assert = require('assert');
|
||||||
let fs = require('fs');
|
|
||||||
|
|
||||||
//let SolidityCompiler = require('../lib/modules/solidity');
|
//let SolidityCompiler = require('../lib/modules/solidity');
|
||||||
let Plugins = require('../lib/core/plugins.js');
|
let Plugins = require('../lib/core/plugins.js');
|
||||||
|
|
||||||
let readFile = function(file) {
|
let readFile = function(file) {
|
||||||
return new File({filename: file, type: 'dapp_file', path: file});
|
return new File({filename: file, type: File.types.dapp_file, path: file});
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('embark.Contracts', function() {
|
describe('embark.Contracts', function() {
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
100
|
100
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ERC20": {
|
|
||||||
"file": "zeppelin-solidity/contracts/token/ERC20/ERC20.sol"
|
|
||||||
},
|
|
||||||
"SimpleStorageTest": {
|
"SimpleStorageTest": {
|
||||||
"file": "./some_folder/test_contract.sol",
|
"file": "./some_folder/test_contract.sol",
|
||||||
"args": [
|
"args": [
|
||||||
|
|
Loading…
Reference in New Issue