Revert changes to `scaffold` function in `cmd_controller.js`
This commit is contained in:
parent
728713a183
commit
3246b62151
|
@ -438,50 +438,73 @@ class EmbarkController {
|
||||||
}
|
}
|
||||||
|
|
||||||
scaffold(options) {
|
scaffold(options) {
|
||||||
|
|
||||||
this.context = options.context || [constants.contexts.scaffold];
|
this.context = options.context || [constants.contexts.scaffold];
|
||||||
options.onlyCompile = true;
|
|
||||||
|
|
||||||
const Engine = require('../lib/core/engine.js');
|
const Engine = require('../lib/core/engine.js');
|
||||||
const engine = new Engine({
|
const engine = new Engine({
|
||||||
env: options.env,
|
env: options.env,
|
||||||
|
client: options.client,
|
||||||
|
locale: options.locale,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
embarkConfig: options.embarkConfig || 'embark.json',
|
embarkConfig: 'embark.json',
|
||||||
|
interceptLogs: false,
|
||||||
logFile: options.logFile,
|
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([
|
async.waterfall([
|
||||||
function (callback) {
|
function initEngine(callback) {
|
||||||
engine.init({}, 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();
|
let pluginList = engine.plugins.listPlugins();
|
||||||
if (pluginList.length > 0) {
|
if (pluginList.length > 0) {
|
||||||
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
|
||||||
}
|
}
|
||||||
|
|
||||||
engine.startService("processManager");
|
engine.startService("processManager");
|
||||||
engine.startService("serviceMonitor");
|
|
||||||
engine.startService("libraryManager");
|
engine.startService("libraryManager");
|
||||||
engine.startService("pipeline");
|
engine.startService("codeRunner");
|
||||||
engine.startService("deployment", {onlyCompile: true});
|
|
||||||
engine.startService("web3");
|
engine.startService("web3");
|
||||||
engine.startService("scaffolding");
|
engine.startService("deployment", {onlyCompile: true});
|
||||||
|
|
||||||
engine.events.request('deploy:contracts', callback);
|
callback();
|
||||||
}
|
},
|
||||||
], (err) => {
|
function deploy(callback) {
|
||||||
if (err) {
|
engine.events.request('deploy:contracts', function(err) {
|
||||||
engine.logger.error(err.message);
|
callback(err);
|
||||||
engine.logger.info(err.stack);
|
});
|
||||||
} else {
|
},
|
||||||
engine.events.request("scaffolding:generate", options, () => {
|
function generateUI(callback) {
|
||||||
engine.logger.info(__("finished generating the UI").underline);
|
engine.events.request("scaffolding:generate:ui", options, () => {
|
||||||
process.exit();
|
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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue