/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
parent::fire();
$serverHost = $this->option('host');
$serverPort = $this->option('port');
$serverEnv = $this->option('env');
$assetsServerHost = $this->option('larasset-host');
$assetsServerPort = $this->option('larasset-port');
putenv('LARASSET_PORT=' . $assetsServerPort);
if ($this->option('larasset-environment')) {
// TODO: Remove the DEPRECATED stuff in the next minor version (0.10.0 or 1.0.0)
$this->comment("WARN: The '--larasset-environment' option is DEPRECATED, use '--larasset-env' option instead please.");
$assetsServerEnv = $this->option('larasset-environment');
} else {
$assetsServerEnv = $this->option('larasset-env');
}
// Run assets server in a background process
$command = "php artisan larasset:serve --port=" . $assetsServerPort . " --host=" . $assetsServerHost . " --assets-env=" . $assetsServerEnv;
$this->info("Start the assets server...");
$serverLogsPath = $this->normalizePath(storage_path('logs/larasset_server.log'));
$this->line('Assets server logs are stored in "' . $serverLogsPath . '"');
$this->execInBackground($command, $serverLogsPath);
// Run PHP application server
$this->call('serve', ['--host' => $serverHost, '--port' => $serverPort, '--env' => $serverEnv]);
}