diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-11 08:39:59 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-11 08:39:59 +0200 |
commit | 7d3f8cf3e4e3e82eafd45002eefc3a46d997adc6 (patch) | |
tree | 2d9d2faafddc0d8e76f88e2050bd82eca24ab7b9 | |
parent | e9e9c2c39bc4e4feb08afef37d9c9bfdfb49c23e (diff) |
switch to fedora/autoloader
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | autoload.php.in | 39 | ||||
-rw-r--r-- | php-phpunit-PHPUnit-SkeletonGenerator.spec | 62 |
3 files changed, 43 insertions, 65 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/autoload.php.in b/autoload.php.in deleted file mode 100644 index 3b4586b..0000000 --- a/autoload.php.in +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/* Autoloader for phpunit/phpunit-skeleton-generator and its dependencies */ - -$vendorDir = '/usr/share/php'; -// Use Symfony autoloader -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -/* for symfony/console */ -$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir); - -/* optional, for test suite */ -if (is_dir($vendorDir . '/org/bovigo/vfs')) { - $fedoraClassLoader->addPrefix('org\\bovigo\\vfs', $vendorDir); -} - -require_once $vendorDir . '/Text/Template/Autoload.php'; -require_once $vendorDir . '/SebastianBergmann/Version/autoload.php'; - -spl_autoload_register( - function($class) { - static $classes = null; - if ($classes === null) { - $classes = array( - ___CLASSLIST___ - ); - } - $cn = strtolower($class); - if (isset($classes[$cn])) { - require ___BASEDIR___$classes[$cn]; - } - } -); diff --git a/php-phpunit-PHPUnit-SkeletonGenerator.spec b/php-phpunit-PHPUnit-SkeletonGenerator.spec index b2ceec9..d4a6d8e 100644 --- a/php-phpunit-PHPUnit-SkeletonGenerator.spec +++ b/php-phpunit-PHPUnit-SkeletonGenerator.spec @@ -17,7 +17,7 @@ Name: php-phpunit-PHPUnit-SkeletonGenerator Version: 2.0.1 -Release: 5%{?dist} +Release: 7%{?dist} Summary: Tool that can generate skeleton test classes Group: Development/Libraries @@ -25,27 +25,27 @@ License: BSD URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz -# Autoloader template -Source1: autoload.php.in - # Autoloader for RPM - die composer ! Patch0: %{name}-rpm.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.3 BuildRequires: %{_bindir}/phpab %if %{with_tests} +BuildRequires: php-composer(phpunit/php-text-template) < 2 BuildRequires: php-composer(phpunit/php-text-template) >= 1.2 +BuildRequires: php-composer(sebastian/version) < 3 BuildRequires: php-composer(sebastian/version) >= 1.0 +BuildRequires: php-composer(symfony/console) < 3 BuildRequires: php-composer(symfony/console) >= 2.4 # From composer.json, requires-dev # "mikey179/vfsStream": "~1.2" # "phpunit/phpunit": "~4.0", +BuildRequires: php-composer(mikey179/vfsStream) < 2 BuildRequires: php-composer(mikey179/vfsStream) >= 1.2 BuildRequires: %{_bindir}/phpunit # For our autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-fedora-autoloader-devel %endif # From composer.json, requires @@ -61,7 +61,7 @@ Requires: php-composer(sebastian/version) < 3 Requires: php-composer(symfony/console) >= 2.4 Requires: php-composer(symfony/console) < 3 # Need for our autoloader patch -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # From phpcompatinfo report from 2.0.0 Requires: php-date Requires: php-pcre @@ -81,40 +81,45 @@ and vice versa. %patch0 -p1 -b .rpm -find . -type f -name \*.rpm -print | xargs rm +find . -type f -name \*.rpm -delete %build -phpab \ +%{_bindir}/phpab \ --output src/autoload.php \ - --template %{SOURCE1} \ + --template fedora \ src +cat << 'EOF' | tee -a src/autoload.php +\Fedora\Autoloader\Dependencies::required(array( + '%{php_home}/Symfony/Component/Console/autoload.php', + '%{php_home}/Text/Template/Autoload.php', + '%{php_home}/SebastianBergmann/Version/autoload.php', +)); +EOF %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{php_home}/SebastianBergmann/PHPUnit cp -pr src %{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator install -D -p -m 755 phpunit-skelgen %{buildroot}%{_bindir}/phpunit-skelgen -%clean -rm -rf %{buildroot} - - %if %{with_tests} %check +mkdir vendor +cat << 'EOF' | tee vendor/autoload.php +<?php +require_once '%{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator/autoload.php'; +require_once '%{php_home}/org/bovigo/vfs/autoload.php'; +EOF + cd build -%{_bindir}/phpunit \ - --bootstrap %{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator/autoload.php \ - --verbose - -if which php70; then - php70 %{_bindir}/phpunit \ - --bootstrap %{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator/autoload.php \ - --verbose -fi +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose + fi +done %endif @@ -126,8 +131,10 @@ fi %files -%defattr(-,root,root,-) -%doc README.md LICENSE composer.json +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc README.md +%doc composer.json %{_bindir}/phpunit-skelgen %dir %{php_home}/SebastianBergmann %dir %{php_home}/SebastianBergmann/PHPUnit @@ -135,6 +142,9 @@ fi %changelog +* Thu May 11 2017 Remi Collet <remi@fedoraproject.org> - 2.0.1-7 +- switch to fedora/autoloader + * Mon Apr 18 2016 Remi Collet <remi@fedoraproject.org> - 2.0.1-5 - allow sebastian/version 2.0 |