diff options
author | Remi Collet <fedora@famillecollet.com> | 2017-02-24 08:46:30 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2017-02-24 08:46:30 +0100 |
commit | de00569517245907341b9aa7857e0b2bad0ca4cf (patch) | |
tree | d883c38b913ee81fc9e7f5396576d46bdd228b1e | |
parent | 50ac894add1307c4371011150f85d8020950fcb7 (diff) |
php-zendframework-zendpdf: rewrite autoloader
-rw-r--r-- | composer.json | 32 | ||||
-rw-r--r-- | php-zendframework-zendpdf-autoload.php | 16 | ||||
-rw-r--r-- | php-zendframework-zendpdf.spec | 43 |
3 files changed, 69 insertions, 22 deletions
diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..dbb6fdf --- /dev/null +++ b/composer.json @@ -0,0 +1,32 @@ +{ + "name": "zendframework/zendpdf", + "description": "Zend Pdf Component", + "type": "library", + "license": "BSD-3-Clause", + "keywords": [ + "zf2", + "pdf" + ], + "homepage": "http://packages.zendframework.com/", + "autoload": { + "psr-0": { + "ZendPdf\\": "library/" + } + }, + "repositories": [ + { + "type": "composer", + "url": "http://packages.zendframework.com/" + } + ], + "require": { + "php": ">=5.3.3", + "zendframework/zend-memory": ">=2.0.0", + "zendframework/zend-stdlib": ">=2.0.0" + }, + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + } +} diff --git a/php-zendframework-zendpdf-autoload.php b/php-zendframework-zendpdf-autoload.php deleted file mode 100644 index e895002..0000000 --- a/php-zendframework-zendpdf-autoload.php +++ /dev/null @@ -1,16 +0,0 @@ -<?php -/* -Simple autoloader for Zend Framework + ZendPdf component -Inspired from https://github.com/zendframework/ZendSkeletonApplication - -Set autoregister_zf for Zend Framework -Set fallback_autoloader for dependencies which are PSR-0 compliant -*/ -require_once '/usr/share/php/Zend//Loader/AutoloaderFactory.php'; -Zend\Loader\AutoloaderFactory::factory(array( - 'Zend\Loader\StandardAutoloader' => array( - 'fallback_autoloader' => true, - 'autoregister_zf' => true, - 'namespaces' => array( - 'ZendPdf' => __DIR__ -)))); diff --git a/php-zendframework-zendpdf.spec b/php-zendframework-zendpdf.spec index a9c2e3c..90a4af7 100644 --- a/php-zendframework-zendpdf.spec +++ b/php-zendframework-zendpdf.spec @@ -16,7 +16,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 2.0.2 -Release: 1%{?dist} +Release: 4%{?dist} Summary: Zend Framework %{library} component Group: Development/Libraries @@ -24,7 +24,6 @@ License: BSD URL: https://framework.zend.com/ Source0: %{gh_commit}/%{name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh -Source2: %{name}-autoload.php BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch @@ -75,6 +74,19 @@ Provides: php-composer(%{gh_owner}/%{gh_project}) = %{version} mv LICENSE.txt LICENSE +# Generate autoloader for this framework extension +cat << 'EOF' | tee autoload.php +<?php +Zend\Loader\AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + '%{library}' => dirname(__DIR__) . '/%{library}', +)))); +EOF + +# Redirect to framework autoloader +ln -s ../Zend/autoload.php library/ZendPdf/autoload.php + %build # Empty build section, nothing required @@ -86,7 +98,7 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{php_home} cp -pr library/%{library} %{buildroot}%{php_home}/%{library} -install -pm 644 %{SOURCE2} %{buildroot}%{php_home}/%{library}/autoload.php +install -Dpm 644 autoload.php %{buildroot}%{php_home}/Zend/%{library}-autoload.php %check @@ -94,16 +106,31 @@ install -pm 644 %{SOURCE2} %{buildroot}%{php_home}/%{library}/autoload.php mkdir vendor cat << EOF | tee vendor/autoload.php <?php -require_once '%{php_home}/Zend/Loader/AutoloaderFactory.php'; +require_once '%{php_home}/Zend/autoload.php'; Zend\\Loader\\AutoloaderFactory::factory(array( 'Zend\\Loader\\StandardAutoloader' => array( 'namespaces' => array( + '%{library}' => '%{buildroot}%{php_home}/%{library}', 'ZendTest\\\\%{library}' => dirname(__DIR__).'/tests/ZendXmlTest' )))); -require_once '%{buildroot}%{php_home}/%{library}/autoload.php'; EOF cd tests -%{_bindir}/phpunit --include-path=%{buildroot}%{php_home} +# remirepo:11 +run=0 +ret=0 +if which php56; then + php56 %{_bindir}/phpunit || ret=1 + run=1 +fi +if which php71; then + php71 %{_bindir}/phpunit || ret=1 + run=1 +fi +if [ $run -eq 0 ]; then +%{_bindir}/phpunit --verbose +# remirepo:2 +fi +exit $ret %else : Test suite disabled %endif @@ -120,8 +147,12 @@ rm -rf %{buildroot} %doc *.md %doc composer.json %{php_home}/%{library} +%{php_home}/Zend/%{library}-autoload.php %changelog +* Fri Feb 24 2017 Remi Collet <remi@fedoraproject.org> - 2.0.2-4 +- rewrite autoloader as framework extension + * Thu Aug 6 2015 Remi Collet <remi@fedoraproject.org> - 2.0.2-1 - initial package |