/** * Deploy a static view file * * @param string $filePath * @param string $area * @param string $themePath * @param string $locale * @param string $module * @return void */ private function deployFile($filePath, $area, $themePath, $locale, $module) { $requestedPath = $filePath; if (substr($filePath, -5) == '.less') { $requestedPath = preg_replace('/.less$/', '.css', $filePath); } $logMessage = "Processing file '{$filePath}' for area '{$area}', theme '{$themePath}', locale '{$locale}'"; if ($module) { $logMessage .= ", module '{$module}'"; } $this->logger->logDebug($logMessage); try { $asset = $this->assetRepo->createAsset($requestedPath, ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]); $asset = $this->minifyService->getAssets([$asset], true)[0]; $this->logger->logDebug("\tDeploying the file to '{$asset->getPath()}'", '.'); if ($this->isDryRun) { $asset->getContent(); } else { $this->assetPublisher->publish($asset); $this->bundleManager->addAsset($asset); } $this->count++; } catch (\Magento\Framework\View\Asset\File\NotFoundException $e) { // File was not found by Fallback (possibly because it's wrong context for it) - there is nothing to publish $this->logger->logDebug("\tNotice: Could not find file '{$filePath}'. This file may not be relevant for the theme or area."); } catch (\Less_Exception_Compiler $e) { $this->logger->logDebug("\tNotice: Could not parse LESS file '{$filePath}'. " . "This may indicate that the file is incomplete, but this is acceptable. " . "The file '{$filePath}' will be combined with another LESS file."); } catch (\Exception $e) { $this->logger->logError($e->getMessage() . " ({$logMessage})"); $this->logger->logDebug((string) $e); $this->errorCount++; } }
/** * Deploy a static view file * * @param string $filePath * @param string $area * @param string $themePath * @param string $locale * @param string $module * @return void */ private function deployFile($filePath, $area, $themePath, $locale, $module) { $requestedPath = $filePath; if (substr($filePath, -5) == '.less') { $requestedPath = preg_replace('/.less$/', '.css', $filePath); } $logModule = $module ? "<{$module}>" : (null === $module ? '<lib>' : '<theme>'); try { $asset = $this->assetRepo->createAsset($requestedPath, ['area' => $area, 'theme' => $themePath, 'locale' => $locale, 'module' => $module]); $this->logger->logDebug("{$logModule} {$filePath} -> {$asset->getPath()}"); if ($this->isDryRun) { $asset->getContent(); } else { $this->assetPublisher->publish($asset); } $this->count++; } catch (\Exception $e) { $this->logger->logError("{$logModule} {$filePath}"); $this->logger->logDebug((string) $e); $this->errorCount++; } }
/** * @param int $verbosity * @param string $expectedMsg * * @dataProvider logDebugAltDataProvider */ public function testLogDebugAlt($verbosity, $expectedMsg) { $object = new Log($verbosity); $object->logDebug('foo', '[alt]'); $this->expectOutputString($expectedMsg); }