diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-09 11:26:51 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-09 11:26:51 +0200 |
commit | b2c3dab08a2c1682332a52bc7533754275d21781 (patch) | |
tree | 07865310da801863046f0390607f535a3dcf9bda | |
parent | 34473f890cf45a998898ddcb125be9b5d464358c (diff) |
switch to fedora-autoloader
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | autoload.php.in | 35 | ||||
-rw-r--r-- | composer.json | 25 | ||||
-rw-r--r-- | php-phpunit-FinderFacade.spec | 56 |
4 files changed, 61 insertions, 62 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 a5f9520..0000000 --- a/autoload.php.in +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/* Autoloader for sebastian/finder-facade and its dependencies */ - -$vendorDir = '/usr/share/php'; -require_once $vendorDir . '/TheSeer/fDOMDocument/autoload.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/finder */ -$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendorDir); - -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/composer.json b/composer.json new file mode 100644 index 0000000..645bc26 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "sebastian/finder-facade", + "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", + "homepage": "https://github.com/sebastianbergmann/finder-facade", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "support": { + "issues": "https://github.com/sebastianbergmann/finder-facade/issues" + }, + "require": { + "theseer/fdomdocument": "~1.3", + "symfony/finder": "~2.3|~3.0" + }, + "autoload": { + "classmap": [ + "src/" + ] + } +} diff --git a/php-phpunit-FinderFacade.spec b/php-phpunit-FinderFacade.spec index a8ec0df..f00fbc0 100644 --- a/php-phpunit-FinderFacade.spec +++ b/php-phpunit-FinderFacade.spec @@ -17,39 +17,37 @@ Name: php-phpunit-FinderFacade Version: 1.2.1 -Release: 1%{?dist} +Release: 3%{?dist} Summary: Wrapper for Symfony Finder component Group: Development/Libraries License: BSD URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz -# Autoloader template -Source1: autoload.php.in -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.3 -BuildRequires: %{_bindir}/phpab +BuildRequires: php-fedora-autoloader-devel %if %{with_tests} BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(theseer/fdomdocument) < 2 BuildRequires: php-composer(theseer/fdomdocument) >= 1.3 -BuildRequires: php-composer(symfony/finder) >= 2.3 -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(symfony/finder) < 4 +BuildRequires: php-composer(symfony/finder) >= 2.3 %endif # From composer.json "require": { # "theseer/fdomdocument": "~1.3", # "symfony/finder": "~2.3|~3.0" Requires: php(language) >= 5.3.3 -Requires: php-composer(theseer/fdomdocument) >= 1.3 Requires: php-composer(theseer/fdomdocument) < 2 -Requires: php-composer(symfony/finder) >= 2.3 +Requires: php-composer(theseer/fdomdocument) >= 1.3 Requires: php-composer(symfony/finder) < 4 +Requires: php-composer(symfony/finder) >= 2.3 # From phpcompatinfo report for version 1.2.1 Requires: php-ctype # For our autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) Provides: php-composer(sebastian/finder-facade) = %{version} # For compatibility with PEAR mode @@ -67,38 +65,40 @@ Convenience wrapper for Symfony's Finder component. %build phpab \ --output src/autoload.php \ - --template %{SOURCE1} \ + --template fedora2 \ src +cat << 'EOF' | tee -a src/autoload.php +\Fedora\Autoloader\Dependencies::required(array( + '%{php_home}/TheSeer/fDOMDocument/autoload.php', + array( + '%{php_home}/Symfony3/Component/Finder/autoload.php', + '%{php_home}/Symfony/Component/Finder/autoload.php', + ), +)); +EOF + %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{php_home}/SebastianBergmann cp -pr src %{buildroot}%{php_home}/SebastianBergmann/FinderFacade %if %{with_tests} %check -%{_bindir}/php \ - -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ - %{_bindir}/phpunit \ - --bootstrap %{buildroot}%{php_home}/SebastianBergmann/FinderFacade/autoload.php \ - --verbose tests +php -r 'require "%{buildroot}%{php_home}/SebastianBergmann/FinderFacade/autoload.php";' -if which php70; then -php70 \ - -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ - %{_bindir}/phpunit \ +for cmd in php php56 php70 php71 php72; do + if which $cmd; then + $cmd -d include_path=.:%{buildroot}%{php_home}:%{php_home} \ + %{_bindir}/phpunit \ --bootstrap %{buildroot}%{php_home}/SebastianBergmann/FinderFacade/autoload.php \ --verbose tests -fi + fi +done %endif -%clean -rm -rf %{buildroot} - - %post if [ -x %{_bindir}/pear ]; then %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \ @@ -107,7 +107,6 @@ fi %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc README.md @@ -117,6 +116,9 @@ fi %changelog +* Tue May 9 2017 Remi Collet <remi@fedoraproject.org> - 1.2.1-3 +- switch to fedora/autoloader + * Wed Feb 17 2016 Remi Collet <remi@fedoraproject.org> - 1.2.1-1 - update to 1.2.1 - run test suite with both PHP 5 and 7 when available |