Skip to content

Commit

Permalink
[AsseticBundle] updated for changes in Assetic
Browse files Browse the repository at this point in the history
  • Loading branch information
kriswallsmith committed May 15, 2011
1 parent 9e407d7 commit b173884
Show file tree
Hide file tree
Showing 15 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/AsseticBundle/Command/DumpCommand.php
Expand Up @@ -171,7 +171,7 @@ private function dumpAsset($name, OutputInterface $output)
*/
private function doDump(AssetInterface $asset, OutputInterface $output)
{
$target = rtrim($this->basePath, '/').'/'.str_replace('_controller/', '', $asset->getTargetUrl());
$target = rtrim($this->basePath, '/').'/'.str_replace('_controller/', '', $asset->getTargetPath());
if (!is_dir($dir = dirname($target))) {
$output->writeln('<info>[dir+]</info> '.$dir);
if (false === @mkdir($dir, 0777, true)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Bundle/AsseticBundle/Factory/AssetFactory.php
Expand Up @@ -47,7 +47,7 @@ public function __construct(KernelInterface $kernel, ContainerInterface $contain
* Please note this is a naive implementation of globs in that it doesn't
* attempt to support bundle inheritance within the glob pattern itself.
*/
protected function parseInput($input)
protected function parseInput($input, array $options = array())
{
// expand bundle notation
if ('@' == $input[0] && false !== strpos($input, '/')) {
Expand All @@ -60,7 +60,7 @@ protected function parseInput($input)
}
}

return parent::parseInput($input);
return parent::parseInput($input, $options);
}

protected function createAssetReference($name)
Expand Down
Expand Up @@ -23,9 +23,9 @@ class UseControllerWorker implements WorkerInterface
{
public function process(AssetInterface $asset)
{
$targetUrl = $asset->getTargetUrl();
$targetUrl = $asset->getTargetPath();
if ($targetUrl && '/' != $targetUrl[0] && 0 !== strpos($targetUrl, '_controller/')) {
$asset->setTargetUrl('_controller/'.$targetUrl);
$asset->setTargetPath('_controller/'.$targetUrl);
}

return $asset;
Expand Down
Expand Up @@ -12,7 +12,6 @@
<services>
<service id="assetic.filter.compass" class="%assetic.filter.compass.class%">
<tag name="assetic.filter" alias="compass" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.compass.sass%</argument>
</service>
</services>
Expand Down
Expand Up @@ -13,7 +13,6 @@
<services>
<service id="assetic.filter.less" class="%assetic.filter.less.class%">
<tag name="assetic.filter" alias="less" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.less.node%</argument>
<argument>%assetic.filter.less.node_paths%</argument>
</service>
Expand Down
Expand Up @@ -11,7 +11,6 @@
<services>
<service id="assetic.filter.lessphp" class="%assetic.filter.lessphp.class%">
<tag name="assetic.filter" alias="lessphp" />
<argument>%assetic.read_from%</argument>
</service>
</services>
</container>
Expand Up @@ -12,7 +12,6 @@
<services>
<service id="assetic.filter.sass" class="%assetic.filter.sass.class%">
<tag name="assetic.filter" alias="sass" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.sass.bin%</argument>
</service>
</services>
Expand Down
Expand Up @@ -12,7 +12,6 @@
<services>
<service id="assetic.filter.scss" class="%assetic.filter.scss.class%">
<tag name="assetic.filter" alias="scss" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.scss.sass%</argument>
</service>
</services>
Expand Down
Expand Up @@ -12,7 +12,6 @@
<services>
<service id="assetic.filter.sprockets" class="%assetic.filter.sprockets.class%">
<tag name="assetic.filter" alias="sprockets" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.sprockets.bin%</argument>
</service>
</services>
Expand Down
Expand Up @@ -13,7 +13,6 @@
<services>
<service id="assetic.filter.stylus" class="%assetic.filter.stylus.class%">
<tag name="assetic.filter" alias="stylus" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.stylus.node%</argument>
<argument>%assetic.filter.stylus.node_paths%</argument>
</service>
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/AsseticBundle/Routing/AsseticLoader.php
Expand Up @@ -99,7 +99,7 @@ private function loadRouteForAsset(RouteCollection $routes, AssetInterface $asse
);

// remove the fake front controller
$pattern = str_replace('_controller/', '', $asset->getTargetUrl());
$pattern = str_replace('_controller/', '', $asset->getTargetPath());

if ($format = pathinfo($pattern, PATHINFO_EXTENSION)) {
$defaults['_format'] = $format;
Expand Down
Expand Up @@ -40,6 +40,6 @@ public function __construct(AssetsHelper $assetsHelper, AssetFactory $factory, $

protected function getAssetUrl(AssetInterface $asset, $options = array())
{
return $this->assetsHelper->getUrl($asset->getTargetUrl(), isset($options['package']) ? $options['package'] : null);
return $this->assetsHelper->getUrl($asset->getTargetPath(), isset($options['package']) ? $options['package'] : null);
}
}
Expand Up @@ -108,7 +108,7 @@ public function testDumpOne()
->method('isDebug')
->will($this->returnValue(false));
$asset->expects($this->once())
->method('getTargetUrl')
->method('getTargetPath')
->will($this->returnValue('test_asset.css'));
$asset->expects($this->once())
->method('dump')
Expand Down Expand Up @@ -140,7 +140,7 @@ public function testDumpDebug()
->method('isDebug')
->will($this->returnValue(true));
$asset->expects($this->once())
->method('getTargetUrl')
->method('getTargetPath')
->will($this->returnValue('test_asset.css'));
$asset->expects($this->once())
->method('dump')
Expand All @@ -149,7 +149,7 @@ public function testDumpDebug()
->method('getIterator')
->will($this->returnValue(new \ArrayIterator(array($leaf))));
$leaf->expects($this->once())
->method('getTargetUrl')
->method('getTargetPath')
->will($this->returnValue('test_leaf.css'));
$leaf->expects($this->once())
->method('dump')
Expand Down
Expand Up @@ -51,6 +51,6 @@ class AsseticHelperForTest extends AsseticHelper
{
protected function getAssetUrl(AssetInterface $asset, $options = array())
{
return $asset->getTargetUrl();
return $asset->getTargetPath();
}
}
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/AsseticBundle/Twig/AsseticNode.php
Expand Up @@ -27,7 +27,7 @@ protected function compileAssetUrl(\Twig_Compiler $compiler, AssetInterface $ass
->raw('isset($context[\'assetic\'][\'use_controller\']) && $context[\'assetic\'][\'use_controller\'] ? ')
->subcompile($this->getPathFunction($name))
->raw(' : ')
->subcompile($this->getAssetFunction($asset->getTargetUrl()))
->subcompile($this->getAssetFunction($asset->getTargetPath()))
;
}

Expand Down

0 comments on commit b173884

Please sign in to comment.