summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-05-11 08:09:48 +0200
committerRemi Collet <fedora@famillecollet.com>2016-05-11 08:09:48 +0200
commitf36b93bc6ed8bfd8d5a257ba8c48d77bf791f47d (patch)
treef2d2db273e78badfce479a91b8ec152ac63e35dd
php-nikic-fast-route: import from Fedora
-rw-r--r--php-nikic-fast-route-tests-autoloader.php10
-rw-r--r--php-nikic-fast-route.spec110
2 files changed, 120 insertions, 0 deletions
diff --git a/php-nikic-fast-route-tests-autoloader.php b/php-nikic-fast-route-tests-autoloader.php
new file mode 100644
index 0000000..c484d51
--- /dev/null
+++ b/php-nikic-fast-route-tests-autoloader.php
@@ -0,0 +1,10 @@
+<?php
+
+spl_autoload_register(function($class) {
+ if (strpos($class, 'FastRoute\\') === 0 && strcasecmp(substr($class, -4), 'Test') === 0) {
+ $name = substr($class, strlen('FastRoute'));
+ require __DIR__ . strtr($name, '\\', DIRECTORY_SEPARATOR) . '.php';
+ }
+});
+
+require_once 'BUILDROOT_PATH/bootstrap.php';
diff --git a/php-nikic-fast-route.spec b/php-nikic-fast-route.spec
new file mode 100644
index 0000000..8b502a7
--- /dev/null
+++ b/php-nikic-fast-route.spec
@@ -0,0 +1,110 @@
+# Fedora spec file for php-Analog
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+
+%global gh_commit 79843dce62ac52e9b628e73d5f1264cad10c65a6
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner nikic
+%global gh_project FastRoute
+%global pk_project fast-route
+%global php_home %{_datadir}/php
+%global with_tests 0%{!?_without_tests:1}
+
+Name: php-%{gh_owner}-%{pk_project}
+Version: 1.0.0
+Release: 2%{?dist}
+Summary: Fast implementation of a regular expression based router
+
+Group: Development/Libraries
+License: BSD
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
+Source1: php-%{gh_owner}-%{pk_project}-tests-autoloader.php
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+%if %{with_tests}
+# For tests
+BuildRequires: php(language) >= 5.4
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# From composer.json, "require-dev": {
+# "phpunit/phpunit": "~4.0"
+BuildRequires: php-composer(phpunit/phpunit) >= 4.0
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.4",
+Requires: php(language) >= 5.4
+# From phpcompatinfo 5.0.0 report for version 1.0.0
+Requires: php-pcre
+Requires: php-spl
+
+Provides: php-composer(%{gh_owner}/%{pk_project}) = %{version}
+
+
+%description
+Fast implementation of a regular expression based router.
+
+Documentation:
+http://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html
+
+Autoloader: %{php_home}/%{gh_project}/bootstrap.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+
+%build
+#Nothing to build
+
+
+%install
+rm -rf %{buildroot}
+
+#: Library
+mkdir -p %{buildroot}%{php_home}
+cp -pr src %{buildroot}%{php_home}/%{gh_project}
+
+
+%check
+%if %{with_tests}
+#ensure tests are not ran against local sources
+rm -rf src
+cp %{SOURCE1} test/bootstrap.php
+sed -e "s|BUILDROOT_PATH|%{buildroot}/%{php_home}/%{gh_project}|" -i test/bootstrap.php
+
+: Upstream test suite
+%{_bindir}/phpunit --verbose
+
+if which php70; then
+ php70 %{_bindir}/phpunit --verbose
+fi
+%else
+: Test suite disabled
+%endif
+
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc *.md
+%{php_home}/%{gh_project}
+
+
+%changelog
+* Fri May 06 2016 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-2
+- Fix package name
+
+* Fri May 06 2016 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-1
+- Initial packaging