public function fire()
{
parent::fire();
$serverHost = $this->option('host');
$serverPort = $this->option('port');
if ($this->option('environment')) {
# TODO: Remove the DEPRECATED stuff in the next minor version (0.10.0 or 1.0.0)
$this->comment("WARN: The '--environment' option is DEPRECATED, use '--assets-env' option instead please.");
$serverEnv = $this->option('environment');
} else {
$serverEnv = $this->option('assets-env');
}
$serverOptions = "--port=" . $serverPort . " --host=" . $serverHost;
$packagePath = $this->packagePath();
$searchPaths = array_map(function ($path) {
return $this->normalizePath($path);
}, config('larasset.paths', []));
putenv('LARASSET_PATH=' . implode('|', $searchPaths));
putenv('LARASSET_PREFIX=' . config('larasset.prefix'));
putenv('LARASSET_ENV=' . $serverEnv);
putenv('LARASSET_COMMAND=server');
$assetsServerCommand = "larasset " . $serverOptions;
// Serve assets
system("cd " . $packagePath . " && " . $assetsServerCommand);
}