summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore7
-rw-r--r--php-jakub-onderka-php-console-highlighter.spec75
2 files changed, 36 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1ab5c4f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/php-jakub-onderka-php-console-highlighter.spec b/php-jakub-onderka-php-console-highlighter.spec
index a3261fe..62bd5f7 100644
--- a/php-jakub-onderka-php-console-highlighter.spec
+++ b/php-jakub-onderka-php-console-highlighter.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-jakub-onderka-php-console-highlighter
#
-# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -31,7 +31,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 1%{?github_release}%{?dist}
+Release: 3%{?github_release}%{?dist}
Summary: Highlight PHP code in console (terminal)
Group: Development/Libraries
@@ -44,28 +44,28 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu
# https://patch-diff.githubusercontent.com/raw/JakubOnderka/PHP-Console-Highlighter/pull/11.patch
Patch0: %{name}-pr11-phpunit-createMock.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# Tests
%if %{with_tests}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: php-composer(jakub-onderka/php-console-color) < %{jakub_onderka_php_console_color_max_ver}
BuildRequires: php-composer(jakub-onderka/php-console-color) >= %{jakub_onderka_php_console_color_min_ver}
+BuildRequires: php-composer(phpunit/phpunit)
## phpcompatinfo (computed from version 0.3.2)
BuildRequires: php-tokenizer
## Autoloader
-BuildRequires: php-composer(symfony/class-loader)
+BuildRequires: php-composer(fedora/autoloader)
%endif
# composer.json
-Requires: php(language) >= %{php_min_ver}
-Requires: php-composer(jakub-onderka/php-console-color) >= %{jakub_onderka_php_console_color_min_ver}
+Requires: php(language) >= %{php_min_ver}
Requires: php-composer(jakub-onderka/php-console-color) < %{jakub_onderka_php_console_color_max_ver}
+Requires: php-composer(jakub-onderka/php-console-color) >= %{jakub_onderka_php_console_color_min_ver}
# phpcompatinfo (computed from version 0.3.2)
Requires: php-tokenizer
# Autoloader
-Requires: php-composer(symfony/class-loader)
+Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
@@ -90,63 +90,41 @@ cat <<'AUTOLOAD' | tee src/JakubOnderka/PhpConsoleHighlighter/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\\PhpConsoleHighlighter\\', dirname(dirname(__DIR__)));
+\Fedora\Autoloader\Autoload::addPsr4('JakubOnderka\\PhpConsoleHighlighter\\', __DIR__);
-// Required dependency
-require_once '%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php';
-
-return $fedoraClassLoader;
+\Fedora\Autoloader\Dependencies::required(array(
+ '%{phpdir}/JakubOnderka/PhpConsoleColor/autoload.php',
+));
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/PhpConsoleHighlighter/autoload.php || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleHighlighter/autoload.php || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
- %{_bindir}/phpunit --verbose \
- --bootstrap %{buildroot}%{phpdir}/JakubOnderka/PhpConsoleHighlighter/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/PhpConsoleHighlighter/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 *.md
@@ -155,6 +133,11 @@ rm -rf %{buildroot}
%changelog
+* Mon May 15 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.3.2-3
+- Switch autoloader to php-composer(fedora/autoloader)
+- Add max versions to build dependencies
+- Test with SCLs if available
+
* Thu Jul 21 2016 Remi Collet <remi@fedoraproject.org> - 0.3.2-1
- backport for remi repository