Commit 4f01c099 authored by catch's avatar catch

Issue #1989230 by ParisLiakos, alexpott: Update to Symfony 2.3.

parent 98060490
This diff is collapsed.
......@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b::getLoader();
return ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4::getLoader();
......@@ -197,6 +197,7 @@ public function loadClass($class)
*/
public function findFile($class)
{
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
......
......@@ -52,6 +52,7 @@
'PHPUnit_Framework_Constraint_IsFalse' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsFalse.php',
'PHPUnit_Framework_Constraint_IsIdentical' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsIdentical.php',
'PHPUnit_Framework_Constraint_IsInstanceOf' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsInstanceOf.php',
'PHPUnit_Framework_Constraint_IsJson' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsJson.php',
'PHPUnit_Framework_Constraint_IsNull' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsNull.php',
'PHPUnit_Framework_Constraint_IsTrue' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsTrue.php',
'PHPUnit_Framework_Constraint_IsType' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsType.php',
......
......@@ -17,6 +17,7 @@
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'),
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\ClassLoader\\' => array($vendorDir . '/symfony/class-loader'),
'Symfony\\Cmf\\Component\\Routing' => array($vendorDir . '/symfony-cmf/routing'),
'Psr\\Log\\' => array($vendorDir . '/psr/log'),
......
......@@ -2,7 +2,7 @@
// autoload_real.php generated by Composer
class ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b
class ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4
{
private static $loader;
......@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir));
......
This diff is collapsed.
1.1.0
-----
1.1.1 (June 1, 2013)
--------------------
* Fixed cloning of asset collections
* Fixed environment var inheritance
* Replaced `AssetWriter::getCombinations()` for BC, even though we don't use it
* Added support for `@import-once` to Less filters
1.1.0 (May 15, 2013)
--------------------
* Added LazyAssetManager::getLastModified() for determining "deep" mtime
* Added DartFilter
* Added EmberPrecompile
* Added GssFilter
* Added PhpCssEmbedFilter
* Added RooleFilter
* Added TypeScriptFilter
* Added the possibility to configure additional load paths for less and lessphp
* Added the UglifyCssFilter
* Fixed the handling of directories in the GlobAsset. #256
......
source "https://rubygems.org"
gem "sprockets", "~> 1.0.0"
gem "sass"
gem "compass"
......@@ -79,6 +79,7 @@ The core provides the following filters in the `Assetic\Filter` namespace:
* `CssMinFilter`: minifies CSS
* `CssRewriteFilter`: fixes relative URLs in CSS assets when moving to a new URL
* `DartFilter`: compiles Javascript using dart2js
* `EmberPrecompileFilter`: precompiles Handlebars templates into Javascript for use in the Ember.js framework
* `GoogleClosure\CompilerApiFilter`: compiles Javascript using the Google Closure Compiler API
* `GoogleClosure\CompilerJarFilter`: compiles Javascript using the Google Closure Compiler JAR
* `GssFilter`: compliles CSS using the Google Closure Stylesheets Compiler
......
......@@ -15,11 +15,11 @@
],
"require": {
"php": ">=5.3.1",
"symfony/process": ">=2.1.0,<2.3-dev"
"symfony/process": "~2.1"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"twig/twig": ">=1.6.0,<2.0",
"phpunit/phpunit": "~3.7",
"twig/twig": "~1.6",
"leafo/lessphp": "*",
"leafo/scssphp": "*",
"ptachoire/cssembed": "*",
......@@ -30,7 +30,6 @@
"kamicane/packager": "*",
"joliclic/javascript-packer": "*"
},
"minimum-stability": "dev",
"suggest": {
"twig/twig": "Assetic provides the integration with the Twig templating engine",
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
......@@ -60,15 +59,6 @@
"autoload": { "classmap": [ "cssmin-v3.0.1.php" ] }
}
},
{
"type": "package",
"package": {
"name": "mrclay/minify",
"version": "2.1.5",
"dist": { "url": "http://minify.googlecode.com/files/minify-2.1.5.zip", "type": "zip" },
"autoload": { "classmap": [ "min/lib/" ] }
}
},
{
"type": "package",
"package": {
......
{
"devDependencies": {
"uglifycss": "*",
"coffee-script": "*",
"stylus": "*",
"ember-precompile": "*",
"typescript": "*",
"less": "*",
"handlebars": "*",
"uglify-js": "*"
}
}
......@@ -54,6 +54,12 @@ public function __construct($assets = array(), $filters = array(), $sourceRoot =
$this->values = array();
}
public function __clone()
{
$this->filters = clone $this->filters;
$this->clones = new \SplObjectStorage();
}
public function all()
{
return $this->assets;
......
......@@ -11,8 +11,8 @@
namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/**
* Represents an asset loaded from a file.
......@@ -56,7 +56,7 @@ public function __construct($source, $filters = array(), $sourceRoot = null, $so
public function load(FilterInterface $additionalFilter = null)
{
$source = PathUtils::resolvePath($this->source, $this->getVars(), $this->getValues());
$source = VarUtils::resolve($this->source, $this->getVars(), $this->getValues());
if (!is_file($source)) {
throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source));
......@@ -67,7 +67,7 @@ public function load(FilterInterface $additionalFilter = null)
public function getLastModified()
{
$source = PathUtils::resolvePath($this->source, $this->getVars(), $this->getValues());
$source = VarUtils::resolve($this->source, $this->getVars(), $this->getValues());
if (!is_file($source)) {
throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source));
......
......@@ -11,9 +11,8 @@
namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/**
* A collection of assets loaded by glob.
......@@ -98,7 +97,7 @@ public function setValues(array $values)
private function initialize()
{
foreach ($this->globs as $glob) {
$glob = PathUtils::resolvePath($glob, $this->getVars(), $this->getValues());
$glob = VarUtils::resolve($glob, $this->getVars(), $this->getValues());
if (false !== $paths = glob($glob)) {
foreach ($paths as $path) {
......
......@@ -11,9 +11,8 @@
namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/**
* Represents an asset loaded via an HTTP request.
......@@ -54,13 +53,11 @@ public function __construct($sourceUrl, $filters = array(), $ignoreErrors = fals
public function load(FilterInterface $additionalFilter = null)
{
if (false === $content = @file_get_contents(PathUtils::resolvePath(
$this->sourceUrl, $this->getVars(), $this->getValues()))
) {
if ($this->ignoreErrors) {
return;
}
$content = @file_get_contents(
VarUtils::resolve($this->sourceUrl, $this->getVars(), $this->getValues())
);
if (false === $content && !$this->ignoreErrors) {
throw new \RuntimeException(sprintf('Unable to load asset from URL "%s"', $this->sourceUrl));
}
......
......@@ -58,7 +58,7 @@ public function has($name)
* @param string $name The asset name
* @param AssetInterface $asset The asset
*
* @throws \InvalidArgumentException If tthe asset name is invalid
* @throws \InvalidArgumentException If the asset name is invalid
*/
public function set($name, AssetInterface $asset)
{
......@@ -78,4 +78,12 @@ public function getNames()
{
return array_keys($this->assets);
}
/**
* Clears all assets.
*/
public function clear()
{
$this->assets = array();
}
}
......@@ -11,9 +11,8 @@
namespace Assetic;
use Assetic\Util\PathUtils;
use Assetic\Asset\AssetInterface;
use Assetic\Util\VarUtils;
/**
* Writes assets to the filesystem.
......@@ -24,20 +23,20 @@
class AssetWriter
{
private $dir;
private $varValues;
private $values;
/**
* Constructor.
*
* @param string $dir The base web directory
* @param array $varValues
* @param string $dir The base web directory
* @param array $values Variable values
*
* @throws \InvalidArgumentException if a variable value is not a string
*/
public function __construct($dir, array $varValues = array())
public function __construct($dir, array $values = array())
{
foreach ($varValues as $var => $values) {
foreach ($values as $value) {
foreach ($values as $var => $vals) {
foreach ($vals as $value) {
if (!is_string($value)) {
throw new \InvalidArgumentException(sprintf('All variable values must be strings, but got %s for variable "%s".', json_encode($value), $var));
}
......@@ -45,7 +44,7 @@ public function __construct($dir, array $varValues = array())
}
$this->dir = $dir;
$this->varValues = $varValues;
$this->values = $values;
}
public function writeManagerAssets(AssetManager $am)
......@@ -57,46 +56,20 @@ public function writeManagerAssets(AssetManager $am)
public function writeAsset(AssetInterface $asset)
{
foreach ($this->getCombinations($asset->getVars()) as $combination) {
foreach (VarUtils::getCombinations($asset->getVars(), $this->values) as $combination) {
$asset->setValues($combination);
static::write($this->dir.'/'.PathUtils::resolvePath(
$asset->getTargetPath(), $asset->getVars(), $asset->getValues()),
$asset->dump());
static::write(
$this->dir.'/'.VarUtils::resolve(
$asset->getTargetPath(),
$asset->getVars(),
$asset->getValues()
),
$asset->dump()
);
}
}
private function getCombinations(array $vars)
{
if (!$vars) {
return array(array());
}
$combinations = array();
$nbValues = array();
foreach ($this->varValues as $var => $values) {
if (!in_array($var, $vars, true)) {
continue;
}
$nbValues[$var] = count($values);
}
for ($i=array_product($nbValues),$c=$i*2; $i<$c; $i++) {
$k = $i;
$combination = array();
foreach ($vars as $var) {
$combination[$var] = $this->varValues[$var][$k % $nbValues[$var]];
$k = intval($k/$nbValues[$var]);
}
$combinations[] = $combination;
}
return $combinations;
}
protected static function write($path, $contents)
{
if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
......@@ -107,4 +80,15 @@ protected static function write($path, $contents)
throw new \RuntimeException('Unable to write file '.$path);
}
}
/**
* Not used.
*
* This method is provided for backward compatibility with certain versions
* of AsseticBundle.
*/
private function getCombinations(array $vars)
{
return VarUtils::getCombinations($vars, $this->values);
}
}
......@@ -11,8 +11,8 @@
namespace Assetic\Extension\Twig;
use Assetic\ValueSupplierInterface;
use Assetic\Factory\AssetFactory;
use Assetic\ValueSupplierInterface;
class AsseticExtension extends \Twig_Extension
{
......
......@@ -11,9 +11,11 @@
namespace Assetic\Factory;
use Assetic\Asset\AssetInterface;
use Assetic\AssetManager;
use Assetic\Factory\Loader\FormulaLoaderInterface;
use Assetic\Factory\Resource\ResourceInterface;
use Assetic\Filter\DependencyExtractorInterface;
/**
* A lazy asset manager is a composition of a factory and many formula loaders.
......@@ -201,4 +203,40 @@ public function isDebug()
{
return $this->factory->isDebug();
}
public function getLastModified(AssetInterface $asset)
{
$mtime = $asset->getLastModified();
if (!$filters = $asset->getFilters()) {
return $mtime;
}
// prepare load path
$sourceRoot = $asset->getSourceRoot();
$sourcePath = $asset->getSourcePath();
$loadPath = $sourceRoot && $sourcePath ? dirname($sourceRoot.'/'.$sourcePath) : null;
$prevFilters = array();
foreach ($filters as $filter) {
$prevFilters[] = $filter;
if (!$filter instanceof DependencyExtractorInterface) {
continue;
}
// extract children from asset after running all preceeding filters
$clone = clone $asset;
$clone->clearFilters();
foreach (array_slice($prevFilters, 0, -1) as $prevFilter) {
$clone->ensureFilter($prevFilter);
}
$clone->load();
foreach ($filter->getChildren($this->factory, $clone->getContent(), $loadPath) as $child) {
$mtime = max($mtime, $this->getLastModified($child));
}
}
return $mtime;
}
}
......@@ -11,7 +11,9 @@
namespace Assetic\Factory\Worker;
use Assetic\Asset\AssetCollectionInterface;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\LazyAssetManager;
/**
* Adds cache busting code
......@@ -20,59 +22,51 @@
*/
class CacheBustingWorker implements WorkerInterface
{
const STRATEGY_CONTENT = 1;
const STRATEGY_MODIFICATION = 2;