return contract filepath after build so that we add it to the manager
This commit is contained in:
parent
02ad9b314a
commit
9ac2dde3eb
|
@ -465,13 +465,14 @@ class EmbarkController {
|
|||
engine.startService("scaffolding");
|
||||
callback();
|
||||
},
|
||||
function generateContract(callback){
|
||||
engine.events.request('scaffolding:generate:contract', options, function(){
|
||||
// Engine is re-initiated to be able to see the new contract file
|
||||
engine.init({}, callback);
|
||||
function generateContract(callback) {
|
||||
engine.events.request('scaffolding:generate:contract', options, function(err, file) {
|
||||
// Add contract file to the manager
|
||||
engine.events.request('config:contractsFiles:add', file);
|
||||
callback();
|
||||
});
|
||||
},
|
||||
function initEngineServices(callback){
|
||||
function initEngineServices(callback) {
|
||||
let pluginList = engine.plugins.listPlugins();
|
||||
if (pluginList.length > 0) {
|
||||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||
|
@ -481,15 +482,15 @@ class EmbarkController {
|
|||
engine.startService("codeRunner");
|
||||
engine.startService("web3");
|
||||
engine.startService("deployment", {onlyCompile: true});
|
||||
|
||||
|
||||
callback();
|
||||
},
|
||||
function deploy(callback) {
|
||||
engine.events.request('deploy:contracts', function (err) {
|
||||
engine.events.request('deploy:contracts', function(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function generateUI(callback){
|
||||
function generateUI(callback) {
|
||||
engine.events.request("scaffolding:generate:ui", options, () => {
|
||||
callback();
|
||||
});
|
||||
|
@ -502,7 +503,7 @@ class EmbarkController {
|
|||
` ],\n` +
|
||||
` "index.html": "app/${options.contract}.html"`).cyan);
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
upload(options) {
|
||||
|
|
|
@ -75,6 +75,7 @@ class ScaffoldingReact {
|
|||
// Write template
|
||||
const result = template(data);
|
||||
fs.writeFileSync(filePath, result);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
build(contract, overwrite, cb) {
|
||||
|
@ -94,7 +95,7 @@ class ScaffoldingReact {
|
|||
filename
|
||||
}, overwrite);
|
||||
|
||||
this._generateFile(contract, 'dapp.js.tpl', 'js',
|
||||
const filePath = this._generateFile(contract, 'dapp.js.tpl', 'js',
|
||||
{
|
||||
'title': contract.className,
|
||||
'contractName': contract.className,
|
||||
|
@ -112,11 +113,11 @@ class ScaffoldingReact {
|
|||
this.embark.logger.info('app/' + filename + ".html generated");
|
||||
this.embark.logger.info('app/' + filename + ".js generated");
|
||||
|
||||
cb(null, filePath);
|
||||
} catch (error) {
|
||||
this.embark.logger.error(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
cb();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ class ScaffoldingSolidity {
|
|||
// Write template
|
||||
const result = template(data);
|
||||
fs.writeFileSync(filePath, result);
|
||||
return filePath;
|
||||
}
|
||||
|
||||
build(contract, overwrite, cb){
|
||||
|
@ -33,7 +34,7 @@ class ScaffoldingSolidity {
|
|||
|
||||
const filename = contract.className;
|
||||
|
||||
this._generateFile(contract, 'contract.sol.tpl', 'sol', {
|
||||
const filePath = this._generateFile(contract, 'contract.sol.tpl', 'sol', {
|
||||
'contractName': contract.className,
|
||||
'structName': contract.className + "Struct",
|
||||
'fields': Object.keys(contract.fields).map(f => {
|
||||
|
@ -42,7 +43,7 @@ class ScaffoldingSolidity {
|
|||
}, overwrite);
|
||||
this.embark.logger.info("contracts/" + filename + ".sol generated");
|
||||
|
||||
cb();
|
||||
cb(null, filePath);
|
||||
} catch(error) {
|
||||
this.embark.logger.error(error.message);
|
||||
process.exit(1);
|
||||
|
|
Loading…
Reference in New Issue