/** * Executes the current command. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * * @return null|int null or 0 if everything went fine, or an error code */ protected function execute(InputInterface $input, OutputInterface $output) { $config = $this->assetic->getConfiguration(); $config->setBuildOnRequest(true); $this->assetic->build(); $this->assetic->getAssetWriter()->writeManagerAssets($this->assetic->getAssetManager()); }
public function setupAction() { $config = $this->assetic->getConfiguration(); $mode = null !== ($mode = $config->getUmask()) ? $mode : 0775; $displayMode = decoct($mode); $cachePath = $config->getCachePath(); $pathExists = is_dir($cachePath); if ($cachePath && !$pathExists) { mkdir($cachePath, $mode, true); echo "Cache path created '{$cachePath}' with mode '{$displayMode}' \n"; } else { if ($pathExists) { echo "Creation of cache path '{$cachePath}' skipped - path exists \n"; } else { echo "Creation of cache path '{$cachePath}' skipped - no path provided \n"; } } $webPath = $config->getWebPath(); $pathExists = is_dir($webPath); if ($webPath && !$pathExists) { mkdir($webPath, $mode, true); echo "Web path created '{$webPath}' with mode '{$displayMode}' \n"; } else { if ($pathExists) { echo "Creation of web path '{$webPath}' skipped - path exists \n"; } else { echo "Creation of web path '{$webPath}' skipped - no path provided \n"; } } }
/** * Executes the current command. * * @param InputInterface $input An InputInterface instance * @param OutputInterface $output An OutputInterface instance * * @return null|int null or 0 if everything went fine, or an error code */ protected function execute(InputInterface $input, OutputInterface $output) { $config = $this->assetic->getConfiguration(); $mode = null !== ($mode = $config->getUmask()) ? $mode : 0775; if (!$this->createPath($output, 'Cache', $config->getCachePath(), $mode)) { return 1; } if (!$this->createPath($output, 'Web', $config->getWebPath(), $mode)) { return 1; } return 0; }
/** * @param AssetInterface $asset * @param array $options * @return string */ protected function setupAsset(AssetInterface $asset, array $options = array()) { $ret = ''; if ($this->service->getConfiguration()->isDebug() && !$this->service->getConfiguration()->isCombine() && $asset instanceof AssetCollection) { // Move assets as single instance not as a collection foreach ($asset as $value) { /** @var AssetCollection $value */ $ret .= $this->helper($value, $options) . PHP_EOL; } } else { $ret .= $this->helper($asset, $options) . PHP_EOL; } return $ret; }
public function testGetStrategyForRendererSuccess() { $renderer = $this->getMockBuilder('Zend\\View\\Renderer\\PhpRenderer')->disableOriginalConstructor()->getMock(); $this->object->getConfiguration()->addRendererToStrategy(get_class($renderer), 'AsseticBundle\\View\\NoneStrategy'); $value = $this->object->getStrategyForRenderer($renderer); $this->assertInstanceOf('AsseticBundle\\View\\StrategyInterface', $value); }