summaryrefslogtreecommitdiffstats
path: root/php-jakub-onderka-php-console-color.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-jakub-onderka-php-console-color.spec')
-rw-r--r--php-jakub-onderka-php-console-color.spec62
1 files changed, 21 insertions, 41 deletions
diff --git a/php-jakub-onderka-php-console-color.spec b/php-jakub-onderka-php-console-color.spec
index 3251780..439eff8 100644
--- a/php-jakub-onderka-php-console-color.spec
+++ b/php-jakub-onderka-php-console-color.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-jakub-onderka-php-console-color
#
-# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -28,7 +28,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 1%{?github_release}%{?dist}
+Release: 3%{?github_release}%{?dist}
Summary: Simple library for creating colored console ouput
Group: Development/Libraries
@@ -41,7 +41,6 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu
# https://patch-diff.githubusercontent.com/raw/JakubOnderka/PHP-Console-Color/pull/8.patch
Patch0: %{name}-pr8-add-license.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
@@ -53,7 +52,7 @@ BuildRequires: php-pcre
BuildRequires: php-posix
BuildRequires: php-spl
## Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
@@ -63,7 +62,7 @@ Requires: php-pcre
Requires: php-posix
Requires: php-spl
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -92,60 +91,37 @@ cat <<'AUTOLOAD' | tee src/JakubOnderka/PhpConsoleColor/autoload.php
/**
* Autoloader for %{name} and its' dependencies
* (created by %{name}-%{version}-%{release}).
- *
- * @return \Symfony\Component\ClassLoader\ClassLoader
*/
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
-if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
- if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
- require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php';
- }
-
- $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
- $fedoraClassLoader->register();
-}
-
-$fedoraClassLoader->addPrefix('JakubOnderka\\PhpConsoleColor\\', dirname(dirname(__DIR__)));
-
-return $fedoraClassLoader;
+\Fedora\Autoloader\Autoload::addPsr4('JakubOnderka\\PhpConsoleColor\\', __DIR__);
AUTOLOAD
%install
-rm -rf %{buildroot}
-
mkdir -p %{buildroot}%{phpdir}
cp -rp src/* %{buildroot}%{phpdir}/
%check
%if %{with_tests}
-run=0
-ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
- %{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php
-fi
-exit $ret
+: Upstream tests
+RETURN_CODE=0
+PHPUNIT=$(which phpunit)
+for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do
+ if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
+ $PHP_EXEC $PHPUNIT --verbose \
+ --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php \
+ || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
%else
: Tests skipped
%endif
-%clean
-rm -rf %{buildroot}
-
-
%files
-%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json
@@ -155,6 +131,10 @@ rm -rf %{buildroot}
%changelog
+* Mon May 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1-3
+- Switch autoloader to php-composer(fedora/autoloader)
+- Test with SCLs if available
+
* Thu Jul 21 2016 Remi Collet <remi@fedoraproject.org> - 0.1-1
- backport for remi repository