diff options
author | Remi Collet <fedora@famillecollet.com> | 2015-10-14 15:43:45 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2015-10-14 15:43:45 +0200 |
commit | 58890f0efb46f634ad62547ae9cc5d35bbd95659 (patch) | |
tree | 90a4a6c5c523f6583c3b3339a3f19623827a14f1 /php-jsonlint.spec | |
parent | 7f815979280e0c5109351e66055e390b6666edd3 (diff) |
php-jsonlint: add an autoloader
Diffstat (limited to 'php-jsonlint.spec')
-rw-r--r-- | php-jsonlint.spec | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/php-jsonlint.spec b/php-jsonlint.spec index 23c67e0..fb0f115 100644 --- a/php-jsonlint.spec +++ b/php-jsonlint.spec @@ -1,5 +1,6 @@ +# remirepo spec file for php-jsonlint, from: # -# RPM spec file for php-jsonlint +# Fedora spec file for php-jsonlint # # Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com> # Remi Collet <remi@fedoraproject.org> @@ -23,7 +24,7 @@ Name: php-%{github_name} Version: %{github_version} -Release: 1%{?dist} +Release: 3%{?dist} Summary: JSON Lint for PHP Group: Development/Libraries @@ -31,6 +32,9 @@ License: MIT URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +# Autoloader +Source1: %{name}-autoload.php + # Bin usage without Composer autoloader Patch0: %{name}-bin-without-composer-autoloader.patch @@ -39,14 +43,19 @@ BuildArch: noarch %if %{with_tests} # For tests: composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: php-phpunit-PHPUnit +BuildRequires: php-composer(phpunit/phpunit) # For tests: phpcompatinfo (computed from version 1.3.1) BuildRequires: php-pcre +# For autoloader +BuildRequires: php-composer(symfony/class-loader) %endif Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 1.3.1) +Requires: php-cli Requires: php-pcre +# For autoloader +Requires: php-composer(symfony/class-loader) Provides: php-composer(seld/jsonlint) = %{version} @@ -57,10 +66,14 @@ Provides: php-composer(seld/jsonlint) = %{version} This library is a port of the JavaScript jsonlint (https://github.com/zaach/jsonlint) library. +To use this library, you just have to add, in your project: + require_once '%{_datadir}/php/Seld/JsonLint/autoload.php'; + %prep %setup -q -n %{github_name}-%{github_commit} +cp %{SOURCE1} src/Seld/JsonLint/autoload.php %patch0 -p1 @@ -80,16 +93,9 @@ install -pm 0755 bin/jsonlint %{buildroot}%{_bindir}/ %check %if %{with_tests} -# Create autoloader -cat > autoload.php <<'AUTOLOAD' -<?php -spl_autoload_register(function ($class) { - $src = str_replace('\\', '/', $class).'.php'; - @include_once $src; -}); -AUTOLOAD - -%{_bindir}/phpunit --bootstrap ./autoload.php --include-path %{buildroot}%{_datadir}/php . +%{_bindir}/phpunit \ + --bootstrap %{buildroot}%{_datadir}/php/Seld/JsonLint/autoload.php \ + --verbose %else : Tests skipped %endif @@ -106,6 +112,9 @@ AUTOLOAD %changelog +* Wed Oct 14 2015 Remi Collet <remi@fedoraproject.org> - 1.3.1-3 +- add autoloader + * Mon Jan 5 2015 Remi Collet <remi@fedoraproject.org> - 1.3.1-1 - Updated to 1.3.1 |