diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-10-14 10:55:23 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-10-14 10:55:23 +0200 |
commit | ce258176f85be1583f630edeea96c2c25e4c8ace (patch) | |
tree | 47e6a510b342afd9d387dbc937513388905003ee | |
parent | bef3f78602c9eba5568c8a8e2a0e14326a91989c (diff) |
php-seld-phar-utils: 1.0.1
-rw-r--r-- | phar-utils-autoload.php | 15 | ||||
-rw-r--r-- | php-seld-phar-utils.spec | 37 |
2 files changed, 48 insertions, 4 deletions
diff --git a/phar-utils-autoload.php b/phar-utils-autoload.php new file mode 100644 index 0000000..0b8dbac --- /dev/null +++ b/phar-utils-autoload.php @@ -0,0 +1,15 @@ +<?php +/* Autoloader for seld/phar-utils and its dependencies */ + +$vendorDir = '/usr/share/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(); +} + +$fedoraClassLoader->addPrefix('Seld\\PharUtils\\', dirname(dirname(__DIR__))); diff --git a/php-seld-phar-utils.spec b/php-seld-phar-utils.spec index 2fdf41c..8551258 100644 --- a/php-seld-phar-utils.spec +++ b/php-seld-phar-utils.spec @@ -6,13 +6,13 @@ # # Please, preserve the changelog entries # -%global gh_commit 336bb5ee20de511f3c1a164222fcfd194afcab3a +%global gh_commit 7009b5139491975ef6486545a39f3e6dad5ac30a %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner Seldaek %global gh_project phar-utils Name: php-seld-phar-utils -Version: 1.0.0 +Version: 1.0.1 Release: 1%{?dist} Summary: PHAR file format utilities @@ -21,18 +21,27 @@ License: MIT 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 +Source1: %{gh_project}-autoload.php + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3 +# For test +BuildRequires: php-cli +# Autoloader +BuildRequires: php-composer(symfony/class-loader) # From composer.json # "php": ">=5.3.0", Requires: php(language) >= 5.3.0 -# From phpcompatifo report for 1.0.0 +# From phpcompatifo report for 1.0.1 Requires: php-date Requires: php-hash Requires: php-pcre Requires: php-spl +# Autoloader +Requires: php-composer(symfony/class-loader) Provides: php-composer(seld/phar-utils) = %{version} @@ -40,10 +49,15 @@ Provides: php-composer(seld/phar-utils) = %{version} %description PHAR file format utilities, for when PHP phars you up. +To use this library, you just have to add, in your project: + require_once '%{_datadir}/php/Seld/PharUtils/autoload.php'; + %prep %setup -q -n %{gh_project}-%{gh_commit} +cp %{SOURCE1} src/autoload.php + %build # Nothing @@ -56,6 +70,16 @@ mkdir -p %{buildroot}%{_datadir}/php/Seld/PharUtils/ cp -pr src/* %{buildroot}%{_datadir}/php/Seld/PharUtils/ +%check +: Check if our autoloader works +php -r ' +require "%{buildroot}%{_datadir}/php/Seld/PharUtils/autoload.php"; +$a = new \Seld\PharUtils\Timestamps("%{SOURCE1}"); +echo "Ok\n"; +exit(0); +' + + %clean rm -rf %{buildroot} @@ -64,10 +88,15 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE -%doc README.md composer.json +%doc README.md +%doc composer.json %{_datadir}/php/Seld %changelog +* Wed Oct 14 2015 Remi Collet <remi@fedoraproject.org> - 1.0.1-1 +- update to 1.0.1 +- add autoloader + * Mon May 4 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-1 - initial package
\ No newline at end of file |