summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-07-10 06:34:32 +0200
committerRemi Collet <remi@remirepo.net>2017-07-10 06:34:32 +0200
commitc45d408da3fd2330f01cfc8845a6fa1011f4019d (patch)
tree38560397222d5c0a895aa3367d2a4805eb308db9
parent44942c527ee81e60fe29220e3a5961cf785a0123 (diff)
v1.5.1 (from Fedora)
-rw-r--r--composer.json11
-rw-r--r--php-twig-extensions-upstream.patch36
-rw-r--r--php-twig-extensions.spec122
3 files changed, 71 insertions, 98 deletions
diff --git a/composer.json b/composer.json
index a59ff78..cabcd9c 100644
--- a/composer.json
+++ b/composer.json
@@ -12,21 +12,22 @@
}
],
"require": {
- "twig/twig": "~1.20|~2.0"
+ "twig/twig": "~1.27|~2.0"
},
"require-dev": {
- "symfony/translation": "~2.3"
+ "symfony/phpunit-bridge": "~3.3@dev",
+ "symfony/translation": "~2.3|~3.0"
},
"suggest": {
"symfony/translation": "Allow the time_diff output to be translated"
},
"autoload": {
- "psr-0": { "Twig_Extensions_": "lib/" }
+ "psr-0": { "Twig_Extensions_": "lib/" },
+ "psr-4": { "Twig\\Extensions\\": "src/" }
},
- "minimum-stability": "dev",
"extra": {
"branch-alias": {
- "dev-master": "1.4-dev"
+ "dev-master": "1.5-dev"
}
}
}
diff --git a/php-twig-extensions-upstream.patch b/php-twig-extensions-upstream.patch
deleted file mode 100644
index 4576737..0000000
--- a/php-twig-extensions-upstream.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 658c6eade785eb8b0257e28dfa5165383aeffcd9 Mon Sep 17 00:00:00 2001
-From: Fabien Potencier <fabien.potencier@gmail.com>
-Date: Fri, 30 Sep 2016 13:06:23 -0700
-Subject: [PATCH] fixed tests
-
----
- test/Twig/Tests/Extension/DateTest.php | 16 +---------------
- 1 file changed, 1 insertion(+), 15 deletions(-)
-
-diff --git a/test/Twig/Tests/Extension/DateTest.php b/test/Twig/Tests/Extension/DateTest.php
-index 8453d13..0080098 100644
---- a/test/Twig/Tests/Extension/DateTest.php
-+++ b/test/Twig/Tests/Extension/DateTest.php
-@@ -21,21 +21,7 @@ class Twig_Tests_Extension_DateTest extends PHPUnit_Framework_TestCase
-
- public function setUp()
- {
-- $timezone = new DateTimeZone(date_default_timezone_get());
--
-- $coreExtension = $this->getMockBuilder('Twig_Extension_Core')->getMock();
-- $coreExtension
-- ->expects($this->any())
-- ->method('getTimezone')
-- ->will($this->returnValue($timezone));
--
-- $this->env = $this->getMockBuilder('Twig_Environment')->disableOriginalConstructor()->getMock();
-- $this->env
-- ->expects($this->any())
-- ->method('getExtension')
-- ->with('core')
-- ->will($this->returnValue($coreExtension))
-- ;
-+ $this->env = new Twig_Environment($this->getMockBuilder('Twig_LoaderInterface')->getMock());
- }
-
- /**
diff --git a/php-twig-extensions.spec b/php-twig-extensions.spec
index 9836344..0a7c64f 100644
--- a/php-twig-extensions.spec
+++ b/php-twig-extensions.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-twig-extensions
#
-# Copyright (c) 2014-2016 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2014-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,17 +12,17 @@
%global github_owner twigphp
%global github_name Twig-extensions
-%global github_version 1.4.1
-%global github_commit f0bb8431c8691f5a39f1017d9a5967a082bf01ff
+%global github_version 1.5.1
+%global github_commit d188c76168b853481cc75879ea045bf93d718e9c
%global composer_vendor twig
%global composer_project extensions
-# "symfony/translation": "~2.3"
-%global symfony_min_ver 2.3
-%global symfony_max_ver 3.0
-# "twig/twig": "~1.20|~2.0"
-# 1.27 to avoid Error: Call to undefined method Twig_Node_Expression_Name::getTemplateLine()
+# "symfony/translation": "~2.3|~3.0"
+# NOTE: Min version not 2.3 because autoloader required
+%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1}
+%global symfony_max_ver 4.0
+# "twig/twig": "~1.27|~2.0"
%global twig_min_ver 1.27
%global twig_max_ver 3.0
@@ -33,46 +33,51 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 2%{?dist}
+Release: 1%{?dist}
Summary: Twig extensions
Group: Development/Libraries
License: MIT
-URL: http://twig.sensiolabs.org/doc/extensions/index.html
+URL: http://twig-extensions.readthedocs.io/
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
BuildRequires: php-composer(phpunit/phpunit)
## composer.json
BuildRequires: php-composer(symfony/translation) >= %{symfony_min_ver}
+BuildRequires: php-composer(symfony/translation) < %{symfony_max_ver}
+BuildRequires: php-composer(twig/twig) >= %{twig_min_ver}
%if 0%{?fedora} < 25
-BuildRequires: php-composer(twig/twig) < 2
+BuildRequires: php-composer(twig/twig) < 2
+%else
+BuildRequires: php-composer(twig/twig) < %{twig_max_ver}
%endif
-BuildRequires: php-composer(twig/twig) >= %{twig_min_ver}
-## phpcompatinfo (computed from version 1.4.0)
+## phpcompatinfo (computed from version 1.5.1)
+BuildRequires: php(language) >= 5.3.0
BuildRequires: php-date
BuildRequires: php-mbstring
BuildRequires: php-pcre
BuildRequires: php-spl
+## Autoloader
+BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
%if 0%{?fedora} < 25
-Requires: php-composer(twig/twig) < 2
+Requires: php-composer(twig/twig) < 2
%else
-Requires: php-composer(twig/twig) < %{twig_max_ver}
+Requires: php-composer(twig/twig) < %{twig_max_ver}
%endif
-Requires: php-composer(twig/twig) >= %{twig_min_ver}
+Requires: php-composer(twig/twig) >= %{twig_min_ver}
# composer.json: optional
Requires: php-composer(symfony/translation) >= %{symfony_min_ver}
Requires: php-composer(symfony/translation) < %{symfony_max_ver}
-# phpcompatinfo (computed from version 1.4.0)
-Requires: php-mbstring
-Requires: php-pcre
-Requires: php-spl
+# phpcompatinfo (computed from version 1.5.1)
+Requires: php(language) >= 5.3.0
+# Autoloader
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -80,6 +85,8 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
Common additional features for Twig that do not directly belong in core Twig.
+Autoloader: %{phpdir}/Twig/Extensions/autoload.php
+
%prep
%setup -qn %{github_name}-%{github_commit}
@@ -89,18 +96,23 @@ cat <<'AUTOLOAD' | tee lib/Twig/Extensions/autoload.php
<?php
/**
* Autoloader for %{name} and its' dependencies
- *
- * Created by %{name}-%{version}-%{release}
+ * (created by %{name}-%{version}-%{release}).
*/
-
-require_once __DIR__ . '/Autoloader.php';
-Twig_Extensions_Autoloader::register();
-
-if (file_exists($dep='%{phpdir}/Twig2/autoload.php')) {
- require_once $dep;
-} else if (file_exists($dep='%{phpdir}/Twig/autoload.php')) {
- require_once $dep;
-}
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Autoload::addPsr0('Twig_Extensions_', dirname(dirname(__DIR__)));
+\Fedora\Autoloader\Autoload::addPsr4('Twig\\Extensions\\', __DIR__);
+
+\Fedora\Autoloader\Dependencies::required(array(
+ array(
+ '%{phpdir}/Twig2/autoload.php',
+ '%{phpdir}/Twig/autoload.php',
+ ),
+ array(
+ '%{phpdir}/Symfony3/Component/Translation/autoload.php',
+ '%{phpdir}/Symfony/Component/Translation/autoload.php',
+ ),
+));
AUTOLOAD
@@ -109,45 +121,34 @@ AUTOLOAD
%install
-rm -rf %{buildroot}
-
mkdir -p %{buildroot}%{phpdir}
cp -rp lib/* %{buildroot}%{phpdir}/
+cp -rp src/* %{buildroot}%{phpdir}/Twig/Extensions/
%check
+%if %{with_tests}
+# under investigation
sed -e 's/testLocalizedDateFilterWithDateTimeZone/SKIPtestLocalizedDateFilterWithDateTimeZone/' \
-i test/Twig/Tests/Extension/IntlTest.php
-%if %{with_tests}
-# remirepo:11
-run=0
-ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php
-# remirepo:2
-fi
-exit $ret
+: Upstream tests
+RETURN_CODE=0
+PHPUNIT=$(which phpunit)
+for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71 php72; do
+ if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
+ $PHP_EXEC $PHPUNIT --verbose \
+ --bootstrap %{buildroot}%{phpdir}/Twig/Extensions/autoload.php \
+ || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
%else
: Tests skipped
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README.rst
@@ -157,6 +158,13 @@ rm -rf %{buildroot}
%changelog
+* Sun Jul 09 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.1-1
+- Update to 1.5.1 (RHBZ #1456812)
+- Add max version constraints to BuildRequires
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add Symfony Translation to autoloader
+- Test with SCLs if available
+
* Fri Jan 6 2017 Remi Collet <remi@fedoraproject.org> - 1.4.1-2
- use Twig 2 when installed but ensure it is not pulled
by defaut to avoid pulling PHP 7