Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

updated to work with twig formula loader changes #142

Open
wants to merge 7 commits into from

2 participants

@kriswallsmith
Collaborator

compatibility with kriswallsmith/assetic#338

@stof stof commented on the diff
composer.json
@@ -16,7 +16,7 @@
"require": {
"php": ">=5.3.0",
"symfony/framework-bundle": ">=2.1.0,<2.3-dev",
- "kriswallsmith/assetic": "1.1.*"
+ "kriswallsmith/assetic": "dev-node-visitor"
@stof Collaborator
stof added a note

This needs to be reverted before the merge (btw, should we release 1.1 first and bump Assetic to 1.2 with these changes ?)

@kriswallsmith Collaborator

What stability is 1.1 at?

@stof Collaborator
stof added a note

currently, we only have alpha releases for 1.1 (but doing a stable release would be a great idea)

@stof Collaborator
stof added a note

thus, changing the signature of the Twig extension is a BC break for everyone using Assetic and Twig standalone so I don't really like doing this before the 1.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 12, 2012
  1. @kriswallsmith
  2. @kriswallsmith

    cleaned up cleanup

    kriswallsmith authored
    Files in the cache directory need to be removed in
    these static methods, otherwise Twig will see
    class_exists() return true in ->loadTemplate()
    and skip re-compiling because of that, but the
    node visitor's ConfigCache file for that template
    will be gone.
Commits on Dec 14, 2012
  1. @kriswallsmith
Commits on Jan 8, 2013
  1. @kriswallsmith
  2. @kriswallsmith
Commits on Jan 9, 2013
  1. @kriswallsmith
Commits on Jan 10, 2013
  1. @kriswallsmith
This page is out of date. Refresh to see the latest.
View
1  Resources/config/assetic.xml
@@ -8,7 +8,6 @@
<parameter key="assetic.asset_factory.class">Symfony\Bundle\AsseticBundle\Factory\AssetFactory</parameter>
<parameter key="assetic.asset_manager.class">Assetic\Factory\LazyAssetManager</parameter>
<parameter key="assetic.asset_manager_cache_warmer.class">Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer</parameter>
- <parameter key="assetic.cached_formula_loader.class">Assetic\Factory\Loader\CachedFormulaLoader</parameter>
<parameter key="assetic.config_cache.class">Assetic\Cache\ConfigCache</parameter>
<parameter key="assetic.config_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\ConfigurationLoader</parameter>
<parameter key="assetic.config_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource</parameter>
View
1  Resources/config/templating_php.xml
@@ -8,6 +8,7 @@
<parameter key="assetic.helper.dynamic.class">Symfony\Bundle\AsseticBundle\Templating\DynamicAsseticHelper</parameter>
<parameter key="assetic.helper.static.class">Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper</parameter>
<parameter key="assetic.php_formula_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\AsseticHelperFormulaLoader</parameter>
+ <parameter key="assetic.cached_formula_loader.class">Assetic\Factory\Loader\CachedFormulaLoader</parameter>
</parameters>
<services>
View
9 Resources/config/templating_twig.xml
@@ -14,21 +14,16 @@
<tag name="twig.extension" />
<tag name="assetic.templating.twig" />
<argument type="service" id="assetic.asset_factory" />
+ <argument type="service" id="assetic.config_cache" />
<argument type="service" id="templating.name_parser" />
<argument>%assetic.use_controller%</argument>
<argument>%assetic.twig_extension.functions%</argument>
<argument>%assetic.bundles%</argument>
<argument type="service" id="assetic.value_supplier" on-invalid="null" />
</service>
- <service id="assetic.twig_formula_loader" class="%assetic.cached_formula_loader.class%" public="false">
+ <service id="assetic.twig_formula_loader" class="%assetic.twig_formula_loader.class%" public="false">
<tag name="assetic.formula_loader" alias="twig" />
<tag name="assetic.templating.twig" />
- <argument type="service" id="assetic.twig_formula_loader.real" />
- <argument type="service" id="assetic.config_cache" />
- <argument>%kernel.debug%</argument>
- </service>
- <service id="assetic.twig_formula_loader.real" class="%assetic.twig_formula_loader.class%" public="false">
- <tag name="assetic.templating.twig" />
<argument type="service" id="twig" />
</service>
</services>
View
18 Tests/FunctionalTest.php
@@ -20,27 +20,27 @@
*/
class FunctionalTest extends \PHPUnit_Framework_TestCase
{
- protected $cacheDir;
+ static protected $cacheDir;
- protected function setUp()
+ static public function setUpBeforeClass()
{
if (!class_exists('Assetic\\AssetManager')) {
- $this->markTestSkipped('Assetic is not available.');
+ self::markTestSkipped('Assetic is not available.');
}
- $this->cacheDir = __DIR__.'/Resources/cache';
- if (file_exists($this->cacheDir)) {
+ self::$cacheDir = __DIR__.'/Resources/cache';
+ if (file_exists(self::$cacheDir)) {
$filesystem = new Filesystem();
- $filesystem->remove($this->cacheDir);
+ $filesystem->remove(self::$cacheDir);
}
- mkdir($this->cacheDir, 0777, true);
+ mkdir(self::$cacheDir, 0777, true);
}
- protected function tearDown()
+ static public function tearDownAfterClass()
{
$filesystem = new Filesystem();
- $filesystem->remove($this->cacheDir);
+ $filesystem->remove(self::$cacheDir);
}
public function testTwigRenderDebug()
View
11 Twig/AsseticExtension.php
@@ -11,9 +11,10 @@
namespace Symfony\Bundle\AsseticBundle\Twig;
-use Assetic\ValueSupplierInterface;
+use Assetic\Cache\ConfigCache;
use Assetic\Extension\Twig\AsseticExtension as BaseAsseticExtension;
use Assetic\Factory\AssetFactory;
+use Assetic\ValueSupplierInterface;
use Symfony\Component\Templating\TemplateNameParserInterface;
/**
@@ -27,9 +28,9 @@ class AsseticExtension extends BaseAsseticExtension
private $templateNameParser;
private $enabledBundles;
- public function __construct(AssetFactory $factory, TemplateNameParserInterface $templateNameParser, $useController = false, $functions = array(), $enabledBundles = array(), ValueSupplierInterface $valueSupplier = null)
+ public function __construct(AssetFactory $factory, ConfigCache $cache, TemplateNameParserInterface $templateNameParser, $useController = false, $functions = array(), $enabledBundles = array(), ValueSupplierInterface $valueSupplier = null)
{
- parent::__construct($factory, $functions, $valueSupplier);
+ parent::__construct($factory, $cache, $functions, $valueSupplier);
$this->useController = $useController;
$this->templateNameParser = $templateNameParser;
@@ -47,9 +48,9 @@ public function getTokenParsers()
public function getNodeVisitors()
{
- return array(
+ return array_merge(parent::getNodeVisitors(), array(
new AsseticNodeVisitor($this->templateNameParser, $this->enabledBundles),
- );
+ ));
}
public function getGlobals()
View
2  composer.json
@@ -16,7 +16,7 @@
"require": {
"php": ">=5.3.0",
"symfony/framework-bundle": ">=2.1.0,<2.3-dev",
- "kriswallsmith/assetic": "1.1.*"
+ "kriswallsmith/assetic": "dev-node-visitor"
@stof Collaborator
stof added a note

This needs to be reverted before the merge (btw, should we release 1.1 first and bump Assetic to 1.2 with these changes ?)

@kriswallsmith Collaborator

What stability is 1.1 at?

@stof Collaborator
stof added a note

currently, we only have alpha releases for 1.1 (but doing a stable release would be a great idea)

@stof Collaborator
stof added a note

thus, changing the signature of the Twig extension is a BC break for everyone using Assetic and Twig standalone so I don't really like doing this before the 1.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
},
"require-dev": {
"symfony/twig-bundle": ">=2.1.0,<2.3-dev",
Something went wrong with that request. Please try again.