diff --git a/lib/cmd.js b/lib/cmd.js index 3dde287c5..50419d535 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -65,6 +65,7 @@ Cmd.prototype.run = function() { .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') + .option('--nodashboard', 'simple mode, disables the dashboard') .description('run dapp (default: development)') .action(function(env, options) { self.Embark.initConfig(env || 'development', { @@ -74,7 +75,8 @@ Cmd.prototype.run = function() { env: env || 'development', serverPort: options.port, serverHost: options.host, - runWebserver: !options.noserver + runWebserver: !options.noserver, + useDashboard: !options.nodashboard }); }); }; diff --git a/lib/index.js b/lib/index.js index 82334d8e5..0671fbb6b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -63,20 +63,34 @@ var Embark = { var self = this; var env = options.env; async.waterfall([ + function welcome(callback) { + if (!options.useDashboard) { + console.log('========================'.bold.green); + console.log('Welcome to Embark 2.1.2'.yellow.bold); + console.log('========================'.bold.green); + } + callback(); + }, function startConsole(callback) { Embark.console = new Console(); callback(); }, function startMonitor(callback) { + if (!options.useDashboard) { + return callback(); + } Embark.monitor = new Monitor({env: env, console: Embark.console}); - Embark.monitor.setStatus("Starting"); self.logger.logFunction = Embark.monitor.logEntry; self.logger.contractsState = Embark.monitor.setContracts; self.logger.availableServices = Embark.monitor.availableServices; + self.logger.setStatus = Embark.monitor.setStatus.bind(Embark.monitor); // TODO: do this after monitor is rendered callback(); }, function monitorServices(callback) { + if (!options.useDashboard) { + return callback(); + } Embark.servicesMonitor = new ServicesMonitor({ logger: Embark.logger, config: Embark.config, @@ -92,7 +106,7 @@ var Embark = { if (!options.runWebserver) { return callback(); } - Embark.monitor.setStatus("Starting Server"); + self.logger.setStatus("Starting Server"); var server = new Server({ logger: self.logger, host: options.serverHost, @@ -101,7 +115,7 @@ var Embark = { server.start(callback); }, function watchFilesForChanges(callback) { - Embark.monitor.setStatus("Watching for changes"); + self.logger.setStatus("Watching for changes"); var watch = new Watch({logger: self.logger}); watch.start(); watch.on('redeploy', function() { @@ -116,7 +130,7 @@ var Embark = { callback(); } ], function(err, result) { - Embark.monitor.setStatus("Ready".green); + self.logger.setStatus("Ready".green); self.logger.trace("finished".underline); }); }, @@ -215,7 +229,7 @@ var Embark = { buildDeployGenerate: function(done) { var self = this; - Embark.monitor.setStatus("Deploying...".magenta.underline); + self.logger.setStatus("Deploying...".magenta.underline); async.waterfall([ function deployAndBuildContractsManager(callback) { Embark.buildAndDeploy(function(err, contractsManager) { @@ -237,7 +251,7 @@ var Embark = { callback(null, abiGenerator.generateABI({useEmbarkJS: true})); }, function buildPipeline(abi, callback) { - Embark.monitor.setStatus("Building Assets"); + self.logger.setStatus("Building Assets"); var pipeline = new Pipeline({ buildDir: self.config.buildDir, contractsFiles: self.config.contractsFiles, @@ -251,9 +265,9 @@ var Embark = { if (err) { self.logger.error("error deploying"); self.logger.error(err.message); - Embark.monitor.setStatus("Deployment Error".red); + self.logger.setStatus("Deployment Error".red); } else { - Embark.monitor.setStatus("Ready".green); + self.logger.setStatus("Ready".green); } done(result); }); diff --git a/lib/logger.js b/lib/logger.js index b93f005a2..5007977c5 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -4,8 +4,9 @@ var Logger = function(options) { this.logLevels = ['error', 'warn', 'info', 'debug', 'trace']; this.logLevel = options.logLevel || 'info'; this.logFunction = options.logFunction || console.log; - this.contractsState = options.contractsState || console.log; - this.availableServices = options.availableServices || console.log; + this.contractsState = options.contractsState || function() {}; + this.availableServices = options.availableServices || function() {}; + this.setStatus = options.setStatus || console.log; }; Logger.prototype.error = function(txt) {