[AsseticBundle] updated for changes in Assetic

This commit is contained in:
Kris Wallsmith 2011-05-14 21:51:18 -07:00
parent 9e407d7e91
commit b1738845e9
15 changed files with 12 additions and 19 deletions

View File

@ -171,7 +171,7 @@ class DumpCommand extends Command
*/ */
private function doDump(AssetInterface $asset, 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))) { if (!is_dir($dir = dirname($target))) {
$output->writeln('<info>[dir+]</info> '.$dir); $output->writeln('<info>[dir+]</info> '.$dir);
if (false === @mkdir($dir, 0777, true)) { if (false === @mkdir($dir, 0777, true)) {

View File

@ -47,7 +47,7 @@ class AssetFactory extends BaseAssetFactory
* Please note this is a naive implementation of globs in that it doesn't * Please note this is a naive implementation of globs in that it doesn't
* attempt to support bundle inheritance within the glob pattern itself. * attempt to support bundle inheritance within the glob pattern itself.
*/ */
protected function parseInput($input) protected function parseInput($input, array $options = array())
{ {
// expand bundle notation // expand bundle notation
if ('@' == $input[0] && false !== strpos($input, '/')) { if ('@' == $input[0] && false !== strpos($input, '/')) {
@ -60,7 +60,7 @@ class AssetFactory extends BaseAssetFactory
} }
} }
return parent::parseInput($input); return parent::parseInput($input, $options);
} }
protected function createAssetReference($name) protected function createAssetReference($name)

View File

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

View File

@ -12,7 +12,6 @@
<services> <services>
<service id="assetic.filter.compass" class="%assetic.filter.compass.class%"> <service id="assetic.filter.compass" class="%assetic.filter.compass.class%">
<tag name="assetic.filter" alias="compass" /> <tag name="assetic.filter" alias="compass" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.compass.sass%</argument> <argument>%assetic.filter.compass.sass%</argument>
</service> </service>
</services> </services>

View File

@ -13,7 +13,6 @@
<services> <services>
<service id="assetic.filter.less" class="%assetic.filter.less.class%"> <service id="assetic.filter.less" class="%assetic.filter.less.class%">
<tag name="assetic.filter" alias="less" /> <tag name="assetic.filter" alias="less" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.less.node%</argument> <argument>%assetic.filter.less.node%</argument>
<argument>%assetic.filter.less.node_paths%</argument> <argument>%assetic.filter.less.node_paths%</argument>
</service> </service>

View File

@ -11,7 +11,6 @@
<services> <services>
<service id="assetic.filter.lessphp" class="%assetic.filter.lessphp.class%"> <service id="assetic.filter.lessphp" class="%assetic.filter.lessphp.class%">
<tag name="assetic.filter" alias="lessphp" /> <tag name="assetic.filter" alias="lessphp" />
<argument>%assetic.read_from%</argument>
</service> </service>
</services> </services>
</container> </container>

View File

@ -12,7 +12,6 @@
<services> <services>
<service id="assetic.filter.sass" class="%assetic.filter.sass.class%"> <service id="assetic.filter.sass" class="%assetic.filter.sass.class%">
<tag name="assetic.filter" alias="sass" /> <tag name="assetic.filter" alias="sass" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.sass.bin%</argument> <argument>%assetic.filter.sass.bin%</argument>
</service> </service>
</services> </services>

View File

@ -12,7 +12,6 @@
<services> <services>
<service id="assetic.filter.scss" class="%assetic.filter.scss.class%"> <service id="assetic.filter.scss" class="%assetic.filter.scss.class%">
<tag name="assetic.filter" alias="scss" /> <tag name="assetic.filter" alias="scss" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.scss.sass%</argument> <argument>%assetic.filter.scss.sass%</argument>
</service> </service>
</services> </services>

View File

@ -12,7 +12,6 @@
<services> <services>
<service id="assetic.filter.sprockets" class="%assetic.filter.sprockets.class%"> <service id="assetic.filter.sprockets" class="%assetic.filter.sprockets.class%">
<tag name="assetic.filter" alias="sprockets" /> <tag name="assetic.filter" alias="sprockets" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.sprockets.bin%</argument> <argument>%assetic.filter.sprockets.bin%</argument>
</service> </service>
</services> </services>

View File

@ -13,7 +13,6 @@
<services> <services>
<service id="assetic.filter.stylus" class="%assetic.filter.stylus.class%"> <service id="assetic.filter.stylus" class="%assetic.filter.stylus.class%">
<tag name="assetic.filter" alias="stylus" /> <tag name="assetic.filter" alias="stylus" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.filter.stylus.node%</argument> <argument>%assetic.filter.stylus.node%</argument>
<argument>%assetic.filter.stylus.node_paths%</argument> <argument>%assetic.filter.stylus.node_paths%</argument>
</service> </service>

View File

@ -99,7 +99,7 @@ class AsseticLoader extends Loader
); );
// remove the fake front controller // remove the fake front controller
$pattern = str_replace('_controller/', '', $asset->getTargetUrl()); $pattern = str_replace('_controller/', '', $asset->getTargetPath());
if ($format = pathinfo($pattern, PATHINFO_EXTENSION)) { if ($format = pathinfo($pattern, PATHINFO_EXTENSION)) {
$defaults['_format'] = $format; $defaults['_format'] = $format;

View File

@ -40,6 +40,6 @@ class StaticAsseticHelper extends AsseticHelper
protected function getAssetUrl(AssetInterface $asset, $options = array()) 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);
} }
} }

View File

@ -108,7 +108,7 @@ class DumpCommandTest extends \PHPUnit_Framework_TestCase
->method('isDebug') ->method('isDebug')
->will($this->returnValue(false)); ->will($this->returnValue(false));
$asset->expects($this->once()) $asset->expects($this->once())
->method('getTargetUrl') ->method('getTargetPath')
->will($this->returnValue('test_asset.css')); ->will($this->returnValue('test_asset.css'));
$asset->expects($this->once()) $asset->expects($this->once())
->method('dump') ->method('dump')
@ -140,7 +140,7 @@ class DumpCommandTest extends \PHPUnit_Framework_TestCase
->method('isDebug') ->method('isDebug')
->will($this->returnValue(true)); ->will($this->returnValue(true));
$asset->expects($this->once()) $asset->expects($this->once())
->method('getTargetUrl') ->method('getTargetPath')
->will($this->returnValue('test_asset.css')); ->will($this->returnValue('test_asset.css'));
$asset->expects($this->once()) $asset->expects($this->once())
->method('dump') ->method('dump')
@ -149,7 +149,7 @@ class DumpCommandTest extends \PHPUnit_Framework_TestCase
->method('getIterator') ->method('getIterator')
->will($this->returnValue(new \ArrayIterator(array($leaf)))); ->will($this->returnValue(new \ArrayIterator(array($leaf))));
$leaf->expects($this->once()) $leaf->expects($this->once())
->method('getTargetUrl') ->method('getTargetPath')
->will($this->returnValue('test_leaf.css')); ->will($this->returnValue('test_leaf.css'));
$leaf->expects($this->once()) $leaf->expects($this->once())
->method('dump') ->method('dump')

View File

@ -51,6 +51,6 @@ class AsseticHelperForTest extends AsseticHelper
{ {
protected function getAssetUrl(AssetInterface $asset, $options = array()) protected function getAssetUrl(AssetInterface $asset, $options = array())
{ {
return $asset->getTargetUrl(); return $asset->getTargetPath();
} }
} }

View File

@ -27,7 +27,7 @@ class AsseticNode extends BaseAsseticNode
->raw('isset($context[\'assetic\'][\'use_controller\']) && $context[\'assetic\'][\'use_controller\'] ? ') ->raw('isset($context[\'assetic\'][\'use_controller\']) && $context[\'assetic\'][\'use_controller\'] ? ')
->subcompile($this->getPathFunction($name)) ->subcompile($this->getPathFunction($name))
->raw(' : ') ->raw(' : ')
->subcompile($this->getAssetFunction($asset->getTargetUrl())) ->subcompile($this->getAssetFunction($asset->getTargetPath()))
; ;
} }