summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore8
-rw-r--r--Makefile4
-rw-r--r--composer.json45
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-webimpress-http-middleware-compatibility.spec133
5 files changed, 218 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..b845b61
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,45 @@
+{
+ "name": "webimpress/http-middleware-compatibility",
+ "description": "Compatibility library for Draft PSR-15 HTTP Middleware",
+ "type": "library",
+ "homepage": "https://github.com/webimpress/http-middleware-compatibility",
+ "license": "BSD-2-Clause",
+ "keywords": [
+ "webimpress",
+ "psr-15",
+ "middleware"
+ ],
+ "support": {
+ "issues": "https://github.com/webimpress/http-middleware-compatibility/issues",
+ "source": "https://github.com/webimpress/http-middleware-compatibility"
+ },
+ "config": {
+ "sort-packages": true
+ },
+ "extra": {
+ "dependency": [
+ "http-interop/http-middleware"
+ ]
+ },
+ "require": {
+ "php": "^5.6 || ^7.0",
+ "http-interop/http-middleware": "^0.1.1 || ^0.2 || ^0.3 || ^0.4.1 || ^0.5",
+ "webimpress/composer-extra-dependency": "^0.2.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^5.7.23 || ^6.4.3"
+ },
+ "autoload": {
+ "files": [
+ "autoload/http-middleware.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "WebimpressTest\\HttpMiddlewareCompatibility\\": "test/"
+ }
+ },
+ "scripts": {
+ "test": "phpunit --colors=always"
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..87a1c0b
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION, Commit=$COMMIT\n"
+
+echo "Cloning..."
+git clone --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
+
diff --git a/php-webimpress-http-middleware-compatibility.spec b/php-webimpress-http-middleware-compatibility.spec
new file mode 100644
index 0000000..19bd1d9
--- /dev/null
+++ b/php-webimpress-http-middleware-compatibility.spec
@@ -0,0 +1,133 @@
+# remirepo/fedora spec file for php-webimpress-http-middleware-compatibility
+#
+# Copyright (c) 2020 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+
+%global with_tests 0%{!?_without_tests:1}
+# Github
+%global gh_commit 8ed1c2c7523dce0035b98bc4f3a73ca9cd1d3717
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner webimpress
+%global gh_project http-middleware-compatibility
+# Packagist
+%global pk_vendor %{gh_owner}
+%global pk_project %{gh_project}
+%global major %nil
+
+Name: php-%{pk_vendor}-%{pk_project}%{major}
+Version: 0.1.4
+Release: 1%{?dist}
+Summary: Compatibility library for Draft PSR-15 HTTP Middleware
+
+License: BSD
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{name}-%{version}-%{?gh_short}.tgz
+Source1: makesrc.sh
+
+BuildArch: noarch
+%if %{with_tests}
+BuildRequires: php(language) >= 5.4
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(http-interop/http-middleware) > 0.1.1 with php-composer(http-interop/http-middleware) < 0.6)
+# For tests, from composer.json "require-dev": {
+# "phpunit/phpunit": "^5.7.23 || ^6.4.3"
+BuildRequires: phpunit6 > 6.4.3
+%global phpunit %{_bindir}/phpunit6
+# remirepo:5
+%else
+BuildRequires: php-composer(http-interop/http-middleware)
+BuildRequires: php-composer(phpunit/phpunit) >= 5.7.23
+%global phpunit %{_bindir}/phpunit
+%endif
+%endif
+
+# From composer.json, "require": {
+# "php": "^5.6 || ^7.0",
+# "http-interop/http-middleware": "^0.1.1 || ^0.2 || ^0.3 || ^0.4.1 || ^0.5",
+# "webimpress/composer-extra-dependency": "^0.2.2"
+Requires: php(language) >= 5.6
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(http-interop/http-middleware) > 0.1.1 with php-composer(http-interop/http-middleware) < 0.6)
+# remirepo:3
+%else
+Requires: php-composer(http-interop/http-middleware)
+%endif
+# From phpcompatinfo report for 0.1.4
+# Only core
+
+# Composer
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+The purpose of the library is to deliver consistent interface for
+different versions of http-interop/http-middleware which implements
+Draft of PSR-15 HTTP Middleware.
+
+Many projects currently use different version of library
+http-interop/http-middleware and updating to newest version requires
+usually major release. The library lets consumers of your component
+decide what version of http-interop/http-middleware they want to use
+and allow them to migrate to the latest version at any time.
+
+Autoloader: %{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+mv LICENSE.md LICENSE
+
+
+%build
+cat << 'EOF' | tee autoload/autoload.php
+<?php
+require_once '%{_datadir}/php/Interop/Http/Middleware/autoload.php';
+require_once __DIR__ . '/http-middleware.php';
+EOF
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{_datadir}/php/%{pk_vendor}/
+cp -pr autoload %{buildroot}%{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require '%{buildroot}%{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}/autoload.php';
+EOF
+
+ret=0
+for cmd in php php71 php72 php73 php74; do
+ if which $cmd; then
+ $cmd %{phpunit} --no-coverage --verbose || ret=1
+ fi
+done
+exit $ret
+%else
+: Test suite disabled
+%endif
+
+
+%files
+# remirepo:1
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc composer.json
+%doc *.md
+%{_datadir}/php/%{pk_vendor}/%{pk_project}%{major}
+
+
+%changelog
+* Fri Jan 10 2020 Remi Collet <remi@remirepo.net> - 0.1.4-1
+- initial package