diff options
-rw-r--r-- | autoload.php.in | 39 | ||||
-rw-r--r-- | php-phpunit-phploc.spec | 30 |
2 files changed, 20 insertions, 49 deletions
diff --git a/autoload.php.in b/autoload.php.in deleted file mode 100644 index 0bd43af..0000000 --- a/autoload.php.in +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/* Autoloader for phploc/phploc and its dependencies */ - -$vendorDir = '/usr/share/php'; -require_once $vendorDir . '/SebastianBergmann/FinderFacade/autoload.php'; -require_once $vendorDir . '/SebastianBergmann/Git/autoload.php'; -require_once $vendorDir . '/SebastianBergmann/Version/autoload.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/console */ -$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/php-phpunit-phploc.spec b/php-phpunit-phploc.spec index bee1c26..ae1f45a 100644 --- a/php-phpunit-phploc.spec +++ b/php-phpunit-phploc.spec @@ -7,7 +7,7 @@ # # Please, preserve the changelog entries # -%global gh_commit 6cdf01336c06d20825831fe8cee70764fe373585 +%global gh_commit 50e063abd41833b3a5d29a2e8fbef5859ac28bdc %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner sebastianbergmann %global gh_project phploc @@ -17,7 +17,7 @@ %global with_tests %{?_without_tests:0}%{!?_without_tests:1} Name: php-phpunit-phploc -Version: 2.1.4 +Version: 2.1.5 Release: 1%{?dist} Summary: A tool for quickly measuring the size of a PHP project @@ -26,18 +26,15 @@ 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 -# Autoload template -Source1: autoload.php.in - # Fix for RPM, use autoload Patch0: %{gh_project}-rpm.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.3 -BuildRequires: %{_bindir}/phpab +BuildRequires: php-composer(theseer/autoload) %if %{with_tests} -BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) BuildRequires: php-composer(sebastian/finder-facade) >= 1.1 BuildRequires: php-composer(sebastian/finder-facade) < 2 BuildRequires: php-composer(sebastian/git) >= 2.0 @@ -94,11 +91,20 @@ need to get a quick understanding of a project's size. %build -phpab \ +%{_bindir}/phpab \ --output src/autoload.php \ - --template %{SOURCE1} \ src +cat << 'EOF' | tee -a src/autoload.php +// Dependencies +$vendorDir = '/usr/share/php'; +require_once $vendorDir . '/SebastianBergmann/FinderFacade/autoload.php'; +require_once $vendorDir . '/SebastianBergmann/Git/autoload.php'; +require_once $vendorDir . '/SebastianBergmann/Version/autoload.php'; +require_once $vendorDir . '/TheSeer/fDOMDocument/autoload.php'; +require_once $vendorDir . '/Symfony/Component/Console/autoloader.php'; +EOF + %install rm -rf %{buildroot} @@ -110,7 +116,7 @@ install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc %if %{with_tests} %check -phpunit \ +%{_bindir}/phpunit \ --bootstrap %{buildroot}%{php_home}/PHPLOC/autoload.php \ --verbose tests %endif @@ -138,6 +144,10 @@ fi %changelog +* Thu Oct 22 2015 Remi Collet <remi@fedoraproject.org> - 2.1.5-1 +- update to 2.1.5 +- simplify autoloader + * Tue Aug 4 2015 Remi Collet <remi@fedoraproject.org> - 2.1.4-1 - update to 2.1.4 |