mirror of https://github.com/embarklabs/embark.git
add error if framework is not supported
This commit is contained in:
parent
9ac2dde3eb
commit
bae21133bc
|
@ -1,16 +1,16 @@
|
|||
class Scaffolding {
|
||||
constructor(engine, _options) {
|
||||
this.engine = engine;
|
||||
constructor(embark, _options) {
|
||||
this.embark = embark;
|
||||
this.options = _options;
|
||||
this.plugins = _options.plugins;
|
||||
|
||||
engine.events.setCommandHandler("scaffolding:generate:contract", (options, cb) => {
|
||||
embark.events.setCommandHandler("scaffolding:generate:contract", (options, cb) => {
|
||||
this.framework = options.contractLanguage;
|
||||
this.fields = options.fields;
|
||||
this.generate(options.contract, options.overwrite, true, cb);
|
||||
});
|
||||
|
||||
engine.events.setCommandHandler("scaffolding:generate:ui", (options, cb) => {
|
||||
embark.events.setCommandHandler("scaffolding:generate:ui", (options, cb) => {
|
||||
this.framework = options.framework;
|
||||
this.fields = options.fields;
|
||||
this.generate(options.contract, options.overwrite, false, cb);
|
||||
|
@ -39,6 +39,9 @@ class Scaffolding {
|
|||
this.plugins.loadInternalPlugin('scaffolding-solidity', this.options);
|
||||
break;
|
||||
default:
|
||||
this.embark.logger.error(__('Selected framework not supported'));
|
||||
this.embark.logger.error(__('Supported Frameworks are: %s', 'react, solidity'));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,8 +50,8 @@ class Scaffolding {
|
|||
|
||||
const build = this.getScaffoldPlugin(this.framework);
|
||||
if (!build) {
|
||||
this.engine.logger.error("Could not find plugin for framework '" + this.framework + "'");
|
||||
process.exit();
|
||||
this.embark.logger.error("Could not find plugin for framework '" + this.framework + "'");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const hasFields = Object.getOwnPropertyNames(this.fields).length !== 0;
|
||||
|
@ -66,15 +69,15 @@ class Scaffolding {
|
|||
try {
|
||||
build(contract, overwrite, cb);
|
||||
} catch (err) {
|
||||
this.engine.logger.error(err.message);
|
||||
this.embark.logger.error(err.message);
|
||||
}
|
||||
} else {
|
||||
// Contract already exists
|
||||
this.engine.events.request("contracts:list", (_err, contractsList) => {
|
||||
this.embark.events.request("contracts:list", (_err, contractsList) => {
|
||||
if (_err) throw new Error(_err);
|
||||
const contract = contractsList.find(x => x.className === contractName);
|
||||
if (!contract) {
|
||||
this.engine.logger.error("contract '" + contractName + "' does not exist");
|
||||
this.embark.logger.error("contract '" + contractName + "' does not exist");
|
||||
cb();
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +85,7 @@ class Scaffolding {
|
|||
try {
|
||||
build(contract, overwrite, cb);
|
||||
} catch (err) {
|
||||
this.engine.logger.error(err.message);
|
||||
this.embark.logger.error(err.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue