summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-02-24 12:34:57 +0100
committerRemi Collet <fedora@famillecollet.com>2017-02-24 12:34:57 +0100
commit523701f3e9ece4be7e8c0aa3ae62b5cebed6f58d (patch)
tree64adb014ffa523115ccc19bd66959cd3a629753a
parentc27d5015f786538b6f3c31f1838ac09aae8736fb (diff)
php-zendframework-zendservice-recaptcha: rewrite autoloader
-rw-r--r--php-zendframework-zendservice-recaptcha-autoload.php16
-rw-r--r--php-zendframework-zendservice-recaptcha.spec29
2 files changed, 25 insertions, 20 deletions
diff --git a/php-zendframework-zendservice-recaptcha-autoload.php b/php-zendframework-zendservice-recaptcha-autoload.php
deleted file mode 100644
index 65a608b..0000000
--- a/php-zendframework-zendservice-recaptcha-autoload.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/*
-Simple autoloader for Zend Framework + ZendService components
-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(
- 'ZendService' => dirname(__DIR__)
-))));
diff --git a/php-zendframework-zendservice-recaptcha.spec b/php-zendframework-zendservice-recaptcha.spec
index 379b0df..97ea72a 100644
--- a/php-zendframework-zendservice-recaptcha.spec
+++ b/php-zendframework-zendservice-recaptcha.spec
@@ -18,7 +18,7 @@
Name: php-%{gh_owner}-%{pk_project}
Version: 3.0.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Zend Framework %{library} component
Group: Development/Libraries
@@ -26,7 +26,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
@@ -77,6 +76,19 @@ Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
mv LICENSE.md LICENSE
+# Generate autoloader for this framework extension
+cat << 'EOF' | tee autoload.php
+<?php
+Zend\Loader\AutoloaderFactory::factory(array(
+ 'Zend\Loader\StandardAutoloader' => array(
+ 'namespaces' => array(
+ '%{namespace}\\%{library}' => dirname(__DIR__) . '/%{namespace}/%{library}',
+))));
+EOF
+
+# Redirect to framework autoloader
+ln -s ../../Zend/autoload.php src/autoload.php
+
%build
# Empty build section, nothing required
@@ -88,7 +100,7 @@ rm -rf %{buildroot}
mkdir -p %{buildroot}%{php_home}/%{namespace}
cp -pr src %{buildroot}%{php_home}/%{namespace}/%{library}
-install -pm 644 %{SOURCE2} %{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php
+install -Dpm 644 autoload.php %{buildroot}%{php_home}/Zend/%{namespace}-%{library}-autoload.php
%check
@@ -96,7 +108,12 @@ install -pm 644 %{SOURCE2} %{buildroot}%{php_home}/%{namespace}/%{library}/auto
mkdir vendor
cat << EOF | tee vendor/autoload.php
<?php
-require_once '%{buildroot}%{php_home}/%{namespace}/%{library}/autoload.php';
+require_once '%{php_home}/Zend/autoload.php';
+Zend\\Loader\\AutoloaderFactory::factory(array(
+ 'Zend\\Loader\\StandardAutoloader' => array(
+ 'namespaces' => array(
+ '%{namespace}\\%{library}' => '%{buildroot}%{php_home}/%{namespace}/%{library}',
+))));
EOF
# remirepo:11
run=0
@@ -131,9 +148,13 @@ rm -rf %{buildroot}
%doc composer.json
%dir %{php_home}/%{namespace}
%{php_home}/%{namespace}/%{library}
+ %{php_home}/Zend/%{namespace}-%{library}-autoload.php
%changelog
+* Fri Feb 24 2017 Remi Collet <remi@fedoraproject.org> - 3.0.0-2
+- rewrite autoloader as framework extension
+
* Mon Feb 20 2017 Remi Collet <remi@fedoraproject.org> - 3.0.0-1
- update to 3.0.0