From 7d3f8cf3e4e3e82eafd45002eefc3a46d997adc6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 11 May 2017 08:39:59 +0200 Subject: switch to fedora/autoloader --- .gitignore | 7 ++++ autoload.php.in | 39 ------------------- php-phpunit-PHPUnit-SkeletonGenerator.spec | 62 +++++++++++++++++------------- 3 files changed, 43 insertions(+), 65 deletions(-) create mode 100644 .gitignore delete mode 100644 autoload.php.in 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 @@ -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 + - 2.0.1-7 +- switch to fedora/autoloader + * Mon Apr 18 2016 Remi Collet - 2.0.1-5 - allow sebastian/version 2.0 -- cgit