Skip to content
Snippets Groups Projects
Commit 4f01c099 authored by catch's avatar catch
Browse files

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

parent 98060490
No related branches found
No related tags found
No related merge requests found
Showing
with 611 additions and 467 deletions
This diff is collapsed.
...@@ -4,4 +4,4 @@ ...@@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php'; require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b::getLoader(); return ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4::getLoader();
...@@ -197,6 +197,7 @@ public function loadClass($class) ...@@ -197,6 +197,7 @@ public function loadClass($class)
*/ */
public function findFile($class) public function findFile($class)
{ {
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) { if ('\\' == $class[0]) {
$class = substr($class, 1); $class = substr($class, 1);
} }
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
'PHPUnit_Framework_Constraint_IsFalse' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsFalse.php', '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_IsIdentical' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsIdentical.php',
'PHPUnit_Framework_Constraint_IsInstanceOf' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsInstanceOf.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_IsNull' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsNull.php',
'PHPUnit_Framework_Constraint_IsTrue' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsTrue.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', 'PHPUnit_Framework_Constraint_IsType' => $vendorDir . '/phpunit/phpunit/PHPUnit/Framework/Constraint/IsType.php',
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'),
'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'), 'Symfony\\Component\\EventDispatcher\\' => array($vendorDir . '/symfony/event-dispatcher'),
'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'), 'Symfony\\Component\\DependencyInjection\\' => array($vendorDir . '/symfony/dependency-injection'),
'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
'Symfony\\Component\\ClassLoader\\' => array($vendorDir . '/symfony/class-loader'), 'Symfony\\Component\\ClassLoader\\' => array($vendorDir . '/symfony/class-loader'),
'Symfony\\Cmf\\Component\\Routing' => array($vendorDir . '/symfony-cmf/routing'), 'Symfony\\Cmf\\Component\\Routing' => array($vendorDir . '/symfony-cmf/routing'),
'Psr\\Log\\' => array($vendorDir . '/psr/log'), 'Psr\\Log\\' => array($vendorDir . '/psr/log'),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// autoload_real.php generated by Composer // autoload_real.php generated by Composer
class ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b class ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4
{ {
private static $loader; private static $loader;
...@@ -19,9 +19,9 @@ public static function getLoader() ...@@ -19,9 +19,9 @@ public static function getLoader()
return self::$loader; 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(); self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInitc244582ae2d491644d70197d64a9670b', 'loadClassLoader')); spl_autoload_unregister(array('ComposerAutoloaderInitc269e792cec97d4c278bb968546f51b4', 'loadClassLoader'));
$vendorDir = dirname(__DIR__); $vendorDir = dirname(__DIR__);
$baseDir = dirname(dirname($vendorDir)); $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 possibility to configure additional load paths for less and lessphp
* Added the UglifyCssFilter * Added the UglifyCssFilter
* Fixed the handling of directories in the GlobAsset. #256 * 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: ...@@ -79,6 +79,7 @@ The core provides the following filters in the `Assetic\Filter` namespace:
* `CssMinFilter`: minifies CSS * `CssMinFilter`: minifies CSS
* `CssRewriteFilter`: fixes relative URLs in CSS assets when moving to a new URL * `CssRewriteFilter`: fixes relative URLs in CSS assets when moving to a new URL
* `DartFilter`: compiles Javascript using dart2js * `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\CompilerApiFilter`: compiles Javascript using the Google Closure Compiler API
* `GoogleClosure\CompilerJarFilter`: compiles Javascript using the Google Closure Compiler JAR * `GoogleClosure\CompilerJarFilter`: compiles Javascript using the Google Closure Compiler JAR
* `GssFilter`: compliles CSS using the Google Closure Stylesheets Compiler * `GssFilter`: compliles CSS using the Google Closure Stylesheets Compiler
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
], ],
"require": { "require": {
"php": ">=5.3.1", "php": ">=5.3.1",
"symfony/process": ">=2.1.0,<2.3-dev" "symfony/process": "~2.1"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "3.7.*", "phpunit/phpunit": "~3.7",
"twig/twig": ">=1.6.0,<2.0", "twig/twig": "~1.6",
"leafo/lessphp": "*", "leafo/lessphp": "*",
"leafo/scssphp": "*", "leafo/scssphp": "*",
"ptachoire/cssembed": "*", "ptachoire/cssembed": "*",
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
"kamicane/packager": "*", "kamicane/packager": "*",
"joliclic/javascript-packer": "*" "joliclic/javascript-packer": "*"
}, },
"minimum-stability": "dev",
"suggest": { "suggest": {
"twig/twig": "Assetic provides the integration with the Twig templating engine", "twig/twig": "Assetic provides the integration with the Twig templating engine",
"leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler",
...@@ -60,15 +59,6 @@ ...@@ -60,15 +59,6 @@
"autoload": { "classmap": [ "cssmin-v3.0.1.php" ] } "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", "type": "package",
"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 = ...@@ -54,6 +54,12 @@ public function __construct($assets = array(), $filters = array(), $sourceRoot =
$this->values = array(); $this->values = array();
} }
public function __clone()
{
$this->filters = clone $this->filters;
$this->clones = new \SplObjectStorage();
}
public function all() public function all()
{ {
return $this->assets; return $this->assets;
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
namespace Assetic\Asset; namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface; use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/** /**
* Represents an asset loaded from a file. * Represents an asset loaded from a file.
...@@ -56,7 +56,7 @@ public function __construct($source, $filters = array(), $sourceRoot = null, $so ...@@ -56,7 +56,7 @@ public function __construct($source, $filters = array(), $sourceRoot = null, $so
public function load(FilterInterface $additionalFilter = null) 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)) { if (!is_file($source)) {
throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source)); throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source));
...@@ -67,7 +67,7 @@ public function load(FilterInterface $additionalFilter = null) ...@@ -67,7 +67,7 @@ public function load(FilterInterface $additionalFilter = null)
public function getLastModified() 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)) { if (!is_file($source)) {
throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source)); throw new \RuntimeException(sprintf('The source file "%s" does not exist.', $source));
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
namespace Assetic\Asset; namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface; use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/** /**
* A collection of assets loaded by glob. * A collection of assets loaded by glob.
...@@ -98,7 +97,7 @@ public function setValues(array $values) ...@@ -98,7 +97,7 @@ public function setValues(array $values)
private function initialize() private function initialize()
{ {
foreach ($this->globs as $glob) { 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)) { if (false !== $paths = glob($glob)) {
foreach ($paths as $path) { foreach ($paths as $path) {
......
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
namespace Assetic\Asset; namespace Assetic\Asset;
use Assetic\Util\PathUtils;
use Assetic\Filter\FilterInterface; use Assetic\Filter\FilterInterface;
use Assetic\Util\VarUtils;
/** /**
* Represents an asset loaded via an HTTP request. * Represents an asset loaded via an HTTP request.
...@@ -54,13 +53,11 @@ public function __construct($sourceUrl, $filters = array(), $ignoreErrors = fals ...@@ -54,13 +53,11 @@ public function __construct($sourceUrl, $filters = array(), $ignoreErrors = fals
public function load(FilterInterface $additionalFilter = null) public function load(FilterInterface $additionalFilter = null)
{ {
if (false === $content = @file_get_contents(PathUtils::resolvePath( $content = @file_get_contents(
$this->sourceUrl, $this->getVars(), $this->getValues())) VarUtils::resolve($this->sourceUrl, $this->getVars(), $this->getValues())
) { );
if ($this->ignoreErrors) {
return;
}
if (false === $content && !$this->ignoreErrors) {
throw new \RuntimeException(sprintf('Unable to load asset from URL "%s"', $this->sourceUrl)); throw new \RuntimeException(sprintf('Unable to load asset from URL "%s"', $this->sourceUrl));
} }
......
...@@ -58,7 +58,7 @@ public function has($name) ...@@ -58,7 +58,7 @@ public function has($name)
* @param string $name The asset name * @param string $name The asset name
* @param AssetInterface $asset The asset * @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) public function set($name, AssetInterface $asset)
{ {
...@@ -78,4 +78,12 @@ public function getNames() ...@@ -78,4 +78,12 @@ public function getNames()
{ {
return array_keys($this->assets); return array_keys($this->assets);
} }
/**
* Clears all assets.
*/
public function clear()
{
$this->assets = array();
}
} }
...@@ -11,9 +11,8 @@ ...@@ -11,9 +11,8 @@
namespace Assetic; namespace Assetic;
use Assetic\Util\PathUtils;
use Assetic\Asset\AssetInterface; use Assetic\Asset\AssetInterface;
use Assetic\Util\VarUtils;
/** /**
* Writes assets to the filesystem. * Writes assets to the filesystem.
...@@ -24,20 +23,20 @@ ...@@ -24,20 +23,20 @@
class AssetWriter class AssetWriter
{ {
private $dir; private $dir;
private $varValues; private $values;
/** /**
* Constructor. * Constructor.
* *
* @param string $dir The base web directory * @param string $dir The base web directory
* @param array $varValues * @param array $values Variable values
* *
* @throws \InvalidArgumentException if a variable value is not a string * @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 $var => $vals) {
foreach ($values as $value) { foreach ($vals as $value) {
if (!is_string($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)); 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()) ...@@ -45,7 +44,7 @@ public function __construct($dir, array $varValues = array())
} }
$this->dir = $dir; $this->dir = $dir;
$this->varValues = $varValues; $this->values = $values;
} }
public function writeManagerAssets(AssetManager $am) public function writeManagerAssets(AssetManager $am)
...@@ -57,46 +56,20 @@ public function writeManagerAssets(AssetManager $am) ...@@ -57,46 +56,20 @@ public function writeManagerAssets(AssetManager $am)
public function writeAsset(AssetInterface $asset) public function writeAsset(AssetInterface $asset)
{ {
foreach ($this->getCombinations($asset->getVars()) as $combination) { foreach (VarUtils::getCombinations($asset->getVars(), $this->values) as $combination) {
$asset->setValues($combination); $asset->setValues($combination);
static::write($this->dir.'/'.PathUtils::resolvePath( static::write(
$asset->getTargetPath(), $asset->getVars(), $asset->getValues()), $this->dir.'/'.VarUtils::resolve(
$asset->dump()); $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) protected static function write($path, $contents)
{ {
if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) { if (!is_dir($dir = dirname($path)) && false === @mkdir($dir, 0777, true)) {
...@@ -107,4 +80,15 @@ protected static function write($path, $contents) ...@@ -107,4 +80,15 @@ protected static function write($path, $contents)
throw new \RuntimeException('Unable to write file '.$path); 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 @@ ...@@ -11,8 +11,8 @@
namespace Assetic\Extension\Twig; namespace Assetic\Extension\Twig;
use Assetic\ValueSupplierInterface;
use Assetic\Factory\AssetFactory; use Assetic\Factory\AssetFactory;
use Assetic\ValueSupplierInterface;
class AsseticExtension extends \Twig_Extension class AsseticExtension extends \Twig_Extension
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment