Commit d7669a2b authored by Iuri Matias's avatar Iuri Matias

refactor waterfall and cleanup, pass file to compile module

parent 477c38bf
var async = require('async');
let remixLib = require('remix-lib');
let Compiler = require('./src/compiler.js');
let Deployer = require('./src/deployer.js');
......@@ -10,17 +9,12 @@ var runTest = function(contractName, contractObj, cb) {
}
var runTestFile = function(filename, web3) {
let result, accounts, contracts;
async.waterfall([
function compile(next) {
Compiler.compileAll(function(err, compilationResult) {
result = compilationResult;
next();
});
Compiler.compileFile(filename, next);
},
function deployAllContracts(next) {
Deployer.deployAll(result, web3, next);
function deployAllContracts(compilationResult, next) {
Deployer.deployAll(compilationResult, web3, next);
},
function runTests(contracts, next) {
runTest("SimpleStorage", contracts.MyTest, next);
......@@ -29,7 +23,7 @@ var runTestFile = function(filename, web3) {
});
}
module.exports = {
runTestFile: runTestFile
runTestFile: runTestFile,
runTest: runTest
};
......@@ -6,13 +6,13 @@ let compilerInput = remixLib.helpers.compiler;
let RemixCompiler = require('remix-solidity').Compiler;
// TODO: replace this with remix's own compiler code
function compileAll(cb) {
function compileFile(filename, cb) {
console.log("compile all");
let compiler;
const sources = {
"simple_storage.sol": {content: fs.readFileSync("examples/simple_storage.sol").toString()},
"tests.sol": {content: fs.readFileSync("sol/tests.sol").toString()},
"simple_storage.sol": {content: fs.readFileSync("examples/simple_storage.sol").toString()},
"simple_storage_test.sol": {content: fs.readFileSync("examples/simple_storage_test.sol").toString()}
};
......@@ -39,6 +39,6 @@ function compileAll(cb) {
}
module.exports = {
compileAll: compileAll
compileFile: compileFile
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment