support embark blockchain without node modules
This commit is contained in:
parent
1fef23a14c
commit
ea16259f34
|
@ -109,7 +109,11 @@ program.command('blockchain [env]').description('run blockchain').action(functio
|
||||||
Embark.init()
|
Embark.init()
|
||||||
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig)
|
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig)
|
||||||
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig)
|
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig)
|
||||||
Embark.startBlockchain(env);
|
|
||||||
|
//TODO: better with --exec, but need to fix console bug first
|
||||||
|
wrench.copyDirSyncRecursive(__dirname + "/../js", "/tmp", {forceDelete: true});
|
||||||
|
|
||||||
|
Embark.startBlockchain(env, true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ Blockchain.prototype.init_command = function() {
|
||||||
return this.generate_basic_command() + "account new ";
|
return this.generate_basic_command() + "account new ";
|
||||||
}
|
}
|
||||||
|
|
||||||
Blockchain.prototype.run_command = function(address) {
|
Blockchain.prototype.run_command = function(address, use_tmp) {
|
||||||
var cmd = this.generate_basic_command();
|
var cmd = this.generate_basic_command();
|
||||||
var config = this.config;
|
var config = this.config;
|
||||||
|
|
||||||
|
@ -57,8 +57,13 @@ Blockchain.prototype.run_command = function(address) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.mine_when_needed) {
|
if (config.mine_when_needed) {
|
||||||
|
if (use_tmp) {
|
||||||
|
cmd += "js /tmp/mine.js";
|
||||||
|
}
|
||||||
|
else {
|
||||||
cmd += "js node_modules/embark-framework/js/mine.js";
|
cmd += "js node_modules/embark-framework/js/mine.js";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return cmd;
|
return cmd;
|
||||||
}
|
}
|
||||||
|
@ -84,10 +89,10 @@ Blockchain.prototype.get_address = function() {
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
Blockchain.prototype.startChain = function() {
|
Blockchain.prototype.startChain = function(use_tmp) {
|
||||||
var address = this.get_address();
|
var address = this.get_address();
|
||||||
console.log("running: " + this.run_command(address));
|
console.log("running: " + this.run_command(address, use_tmp));
|
||||||
exec(this.run_command(address));
|
exec(this.run_command(address, use_tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Blockchain
|
module.exports = Blockchain
|
||||||
|
|
|
@ -30,9 +30,9 @@ Embark = {
|
||||||
return new Tests(this.contractsConfig, contractFiles);
|
return new Tests(this.contractsConfig, contractFiles);
|
||||||
},
|
},
|
||||||
|
|
||||||
startBlockchain: function(env) {
|
startBlockchain: function(env, use_tmp) {
|
||||||
var chain = new Blockchain(this.blockchainConfig.config(env));
|
var chain = new Blockchain(this.blockchainConfig.config(env));
|
||||||
chain.startChain();
|
chain.startChain(use_tmp);
|
||||||
},
|
},
|
||||||
|
|
||||||
deployContracts: function(env, contractFiles, destFile) {
|
deployContracts: function(env, contractFiles, destFile) {
|
||||||
|
|
Loading…
Reference in New Issue