support --noserver option

This commit is contained in:
Iuri Matias 2016-10-29 22:00:54 -04:00
parent 60285ea1c0
commit 655f56f893
3 changed files with 12 additions and 3 deletions

View File

@ -64,6 +64,7 @@ Cmd.prototype.run = function() {
.command('run [environment]')
.option('-p, --port [port]', 'port to run the dev webserver (default: 8000)')
.option('-b, --host [host]', 'host to run the dev webserver (default: localhost)')
.option('--noserver', 'disable the development webserver')
.description('run dapp (default: development)')
.action(function(env, options) {
self.Embark.initConfig(env || 'development', {
@ -72,7 +73,8 @@ Cmd.prototype.run = function() {
self.Embark.run({
env: env || 'development',
serverPort: options.port,
serverHost: options.host
serverHost: options.host,
runWebserver: !options.noserver
});
});
};

View File

@ -81,13 +81,17 @@ var Embark = {
logger: Embark.logger,
config: Embark.config,
serverHost: options.serverHost,
serverPort: options.serverPort
serverPort: options.serverPort,
runWebserver: options.runWebserver
});
Embark.servicesMonitor.startMonitor();
callback();
},
self.buildDeployGenerate.bind(self),
function startAssetServer(callback) {
if (!options.runWebserver) {
return callback();
}
Embark.monitor.setStatus("Starting Server");
var server = new Server({
logger: self.logger,

View File

@ -8,6 +8,7 @@ var ServicesMonitor = function(options) {
this.config = options.config;
this.serverHost = options.serverHost || 'localhost';
this.serverPort = options.serverPort || 8000;
this.runWebserver = options.runWebserver;
};
ServicesMonitor.prototype.startMonitor = function() {
@ -65,7 +66,9 @@ ServicesMonitor.prototype.check = function() {
},
function checkDevServer(result, callback) {
self.logger.trace('checkDevServer');
result.push(('dev server (http://' + self.serverHost + ':' + self.serverPort + ')').green);
var devServer = 'dev server (http://' + self.serverHost + ':' + self.serverPort + ')';
devServer = (self.runWebserver) ? devServer.green : devServer.red;
result.push(devServer);
callback(null, result);
}
], function(err, result) {