reorgnize code structure

This commit is contained in:
Iuri Matias 2017-02-19 12:51:32 -05:00
parent 8da0e80751
commit 1868788342
33 changed files with 59 additions and 46 deletions

View File

@ -1,9 +1,11 @@
var fs = require('./fs.js');
var colors = require('colors');
var GethCommands = require('./geth_commands.js');
var utils = require('./utils.js');
var shelljs = require('shelljs');
var fs = require('../../core/fs.js');
var utils = require('../../core/utils.js');
var GethCommands = require('./geth_commands.js');
var Blockchain = function(blockchainConfig, Client) {
this.blockchainConfig = blockchainConfig;

View File

@ -1,5 +1,5 @@
var fs = require('./fs.js');
var utils = require('./utils.js');
var fs = require('../core/fs.js');
var utils = require('../core/utils.js');
var TemplateGenerator = function(templateName) {
this.templateName = templateName;

View File

@ -1,7 +1,7 @@
var async = require('async');
var DeployTracker = require('./deploy_tracker.js');
var ABIGenerator = require('./abi.js');
var RunCode = require('./runCode.js');
var RunCode = require('../core/runCode.js');
var Deploy = function(options) {
this.web3 = options.web3;

View File

@ -1,4 +1,4 @@
var fs = require('./fs.js');
var fs = require('../core/fs.js');
var DeployTracker = function(options) {
this.logger = options.logger;

View File

@ -155,12 +155,12 @@ Config.prototype.loadFiles = function(files) {
return file.indexOf('.') >= 0;
}).filter(function(file) {
if (file === 'embark.js') {
readFiles.push({filename: 'web3.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../js/web3.js")).toString(), path: utils.joinPath(__dirname, "/../js/web3.js")});
readFiles.push({filename: 'ipfs.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../js/ipfs.js")).toString(), path: utils.joinPath(__dirname, "/../js/ipfs.js")});
readFiles.push({filename: 'web3.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../../js/web3.js")).toString(), path: utils.joinPath(__dirname, "/../../js/web3.js")});
readFiles.push({filename: 'ipfs.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../../js/ipfs.js")).toString(), path: utils.joinPath(__dirname, "/../../js/ipfs.js")});
// TODO: remove duplicated files if funcitonality is the same for storage and orbit
readFiles.push({filename: 'ipfs-api.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../js/ipfs-api.min.js")).toString(), path: utils.joinPath(__dirname, "/../js/ipfs-api.min.js")});
readFiles.push({filename: 'orbit.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../js/orbit.min.js")).toString(), path: utils.joinPath(__dirname, "/../js/orbit.min.js")});
readFiles.push({filename: 'embark.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../js/build/embark.bundle.js")).toString(), path: utils.joinPath(__dirname, "/../js/build/embark.bundle.js")});
readFiles.push({filename: 'ipfs-api.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../../js/ipfs-api.min.js")).toString(), path: utils.joinPath(__dirname, "/../../js/ipfs-api.min.js")});
readFiles.push({filename: 'orbit.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../../js/orbit.min.js")).toString(), path: utils.joinPath(__dirname, "/../../js/orbit.min.js")});
readFiles.push({filename: 'embark.js', content: fs.readFileSync(utils.joinPath(__dirname, "/../../js/build/embark.bundle.js")).toString(), path: utils.joinPath(__dirname, "/../../js/build/embark.bundle.js")});
}
});

View File

@ -8,6 +8,10 @@ function copySync() {
return fs.copySync.apply(fs.copySync, arguments);
}
function writeFileSync() {
return fs.writeFileSync.apply(fs.writeFileSync, arguments);
}
function readFileSync() {
return fs.readFileSync.apply(fs.readFileSync, arguments);
}
@ -24,6 +28,7 @@ module.exports = {
mkdirpSync: mkdirpSync,
copySync: copySync,
readFileSync: readFileSync,
writeFileSync: writeFileSync,
readJSONSync: readJSONSync,
writeJSONSync: writeJSONSync
};

View File

@ -1,11 +1,11 @@
var async = require('async');
var Web3 = require('web3');
var Embark = require('./index.js');
var ContractsManager = require('./contracts.js');
var Deploy = require('./deploy.js');
var Embark = require('../index.js');
var ContractsManager = require('../contracts/contracts.js');
var Deploy = require('../contracts/deploy.js');
var TestLogger = require('./test_logger.js');
var Config = require('./config.js');
var ABIGenerator = require('./abi.js');
var ABIGenerator = require('../contracts/abi.js');
var RunCode = require('./runCode.js');
var Test = function(_options) {

View File

@ -1,5 +1,5 @@
var utils = require('./utils.js');
var RunCode = require('./runCode.js');
var utils = require('../core/utils.js');
var RunCode = require('../core/runCode.js');
var Console = function(options) {
this.plugins = options.plugins;

View File

@ -3,24 +3,30 @@ var async = require('async');
var Web3 = require('web3');
var colors = require('colors');
var Blockchain = require('./cmds/blockchain/blockchain.js');
var Simulator = require('./cmds/simulator.js');
var TemplateGenerator = require('./cmds/template_generator.js');
var Deploy = require('./contracts/deploy.js');
var ContractsManager = require('./contracts/contracts.js');
var ABIGenerator = require('./contracts/abi.js');
var Test = require('./core/test.js');
var Logger = require('./core/logger.js');
var Config = require('./core/config.js');
var ServicesMonitor = require('./core/services.js');
var Monitor = require('./dashboard/monitor.js');
var Console = require('./dashboard/console.js');
var Pipeline = require('./pipeline/pipeline.js');
var Server = require('./pipeline/server.js');
var Watch = require('./pipeline/watch.js');
var IPFS = require('./upload/ipfs.js');
var Swarm = require('./upload/swarm.js');
var Cmd = require('./cmd.js');
var Deploy = require('./deploy.js');
var ContractsManager = require('./contracts.js');
var ABIGenerator = require('./abi.js');
var TemplateGenerator = require('./template_generator.js');
var Blockchain = require('./blockchain.js');
var Server = require('./server.js');
var Watch = require('./watch.js');
var Pipeline = require('./pipeline.js');
var Test = require('./test.js');
var Logger = require('./logger.js');
var Config = require('./config.js');
var Monitor = require('./monitor.js');
var ServicesMonitor = require('./services.js');
var Console = require('./console.js');
var IPFS = require('./ipfs.js');
var Swarm = require('./swarm.js');
var Simulator = require('./simulator.js');
var Embark = {

View File

@ -1,5 +1,5 @@
/*jshint esversion: 6, loopfunc: true */
var fs = require('./fs.js');
var fs = require('../core/fs.js');
var Pipeline = function(options) {
this.buildDir = options.buildDir;

View File

@ -1,5 +1,5 @@
/*jshint esversion: 6 */
var fs = require('./fs.js');
var fs = require('../core/fs.js');
var chokidar = require('chokidar');
// TODO: this should be receiving the config object not re-reading the

View File

@ -1,5 +1,5 @@
/*globals describe, it*/
var ABIGenerator = require('../lib/abi.js');
var ABIGenerator = require('../lib/contracts/abi.js');
var assert = require('assert');
// TODO: instead 'eval' the code with a fake web3 object

View File

@ -1,5 +1,5 @@
/*globals describe, it*/
var Blockchain = require('../lib/blockchain.js');
var Blockchain = require('../lib/cmds/blockchain/blockchain.js');
var assert = require('assert');
describe('embark.Blockchain', function() {

View File

@ -1,5 +1,5 @@
/*globals describe, it*/
var Compiler = require('../lib/compiler.js');
var Compiler = require('../lib/contracts/compiler.js');
var assert = require('assert');
var fs = require('fs');

View File

@ -1,6 +1,6 @@
/*globals describe, it*/
var Config = require('../lib/config.js');
var Plugins = require('../lib/plugins.js');
var Config = require('../lib/core/config.js');
var Plugins = require('../lib/core/plugins.js');
var assert = require('assert');
var fs = require('fs');

View File

@ -1,6 +1,6 @@
/*globals describe, it*/
var Console = require('../lib/console.js');
var Plugins = require('../lib/plugins.js');
var Console = require('../lib/dashboard/console.js');
var Plugins = require('../lib/core/plugins.js');
var assert = require('assert');
describe('embark.Console', function() {

View File

@ -1,6 +1,6 @@
/*globals describe, it*/
var ContractsManager = require('../lib/contracts.js');
var Logger = require('../lib/logger.js');
var ContractsManager = require('../lib/contracts/contracts.js');
var Logger = require('../lib/core/logger.js');
var assert = require('assert');
var fs = require('fs');