Revert changes to `scaffold` function in `cmd_controller.js`

This commit is contained in:
emizzle 2018-10-23 17:43:11 +11:00 committed by Pascal Precht
parent 728713a183
commit 3246b62151
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 46 additions and 23 deletions

View File

@ -438,50 +438,73 @@ class EmbarkController {
}
scaffold(options) {
this.context = options.context || [constants.contexts.scaffold];
options.onlyCompile = true;
const Engine = require('../lib/core/engine.js');
const engine = new Engine({
env: options.env,
client: options.client,
locale: options.locale,
version: this.version,
embarkConfig: options.embarkConfig || 'embark.json',
embarkConfig: 'embark.json',
interceptLogs: false,
logFile: options.logFile,
context: this.context
logLevel: options.logLevel,
events: options.events,
logger: options.logger,
config: options.config,
plugins: options.plugins,
context: this.context,
webpackConfigName: options.webpackConfigName
});
async.waterfall([
function (callback) {
function initEngine(callback) {
engine.init({}, callback);
},
function (callback) {
function startServices(callback) {
engine.startService("scaffolding");
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) {
let pluginList = engine.plugins.listPlugins();
if (pluginList.length > 0) {
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
}
engine.startService("processManager");
engine.startService("serviceMonitor");
engine.startService("libraryManager");
engine.startService("pipeline");
engine.startService("deployment", {onlyCompile: true});
engine.startService("codeRunner");
engine.startService("web3");
engine.startService("scaffolding");
engine.startService("deployment", {onlyCompile: true});
engine.events.request('deploy:contracts', callback);
}
], (err) => {
if (err) {
engine.logger.error(err.message);
engine.logger.info(err.stack);
} else {
engine.events.request("scaffolding:generate", options, () => {
engine.logger.info(__("finished generating the UI").underline);
process.exit();
callback();
},
function deploy(callback) {
engine.events.request('deploy:contracts', function(err) {
callback(err);
});
},
function generateUI(callback) {
engine.events.request("scaffolding:generate:ui", options, () => {
callback();
});
}
], function(err) {
if (err) {
engine.logger.error(__("Error generating the UI: "));
engine.logger.error(err.message || err);
process.exit(1);
}
engine.logger.info(__("finished generating the UI").underline);
engine.logger.info(__("To see the result, execute {{cmd}} and go to /{{contract}}.html", {cmd: 'embark run'.underline, contract: options.contract}));
process.exit();
});
}