/** * Execute the console command. * * @return mixed */ 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); }
/** * Execute the console command. * * @return mixed */ public function fire() { parent::fire(); 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."); $assetsEnv = $this->option('environment'); } else { $assetsEnv = $this->option('assets-env'); } $packagePath = $this->packagePath(); $searchPaths = array_map(function ($path) { return $this->normalizePath($path); }, config('larasset.paths', [])); putenv('LARASSET_PATH=' . implode('|', $searchPaths)); $precompileFiles = array_map(function ($path) { return $this->normalizePath($path); }, config('larasset.precompile', [])); putenv('LARASSET_PRECOMPILE=' . implode('|', $precompileFiles)); putenv('LARASSET_ENV=' . $assetsEnv); putenv('LARASSET_COMMAND=precompile'); putenv('LARASSET_PREFIX=' . config('larasset.prefix')); $enableSourceMaps = config('larasset.sourceMaps') === null ? true : config('larasset.sourceMaps'); putenv('LARASSET_SOURCE_MAPS=' . ($enableSourceMaps ? 'true' : 'false')); $assetsPrecompileCommand = "larasset"; // Precompile assets system("cd " . $packagePath . " && " . $assetsPrecompileCommand); // $this->deleteManifest(); // $this->copyAssets(); }
/** * Execute the console command. * * @return mixed */ public function fire() { parent::fire(); $environment = "production"; $gemFilePath = $this->normalizePath($this->option('gemfile-path')); $packagePath = $this->packagePath(); if ($this->useWindows()) { putenv('BUNDLE_GEMFILE=' . $gemFilePath); $bundleGemfile = 'setx BUNDLE_GEMFILE "' . $gemFilePath . '" > nul'; } else { $bundleGemfile = 'BUNDLE_GEMFILE "' . $gemFilePath . '"'; } $this->envs = array_add($this->envs, 'BUNDLE_GEMFILE', $gemFilePath); $assetsCleanCommand = $bundleGemfile . " && " . $this->getRakeCommand() . " assets:clean RAILS_ENV=" . $environment; // Clean assets system("cd " . $packagePath . " && " . $assetsCleanCommand); $destination = $this->normalizePath(public_path('assets')); // Delete old assets if (File::isDirectory($destination)) { $this->deleteTree($destination); } $this->copyAssets(); }