summaryrefslogtreecommitdiffstats
path: root/php-swaggest-json-schema.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-swaggest-json-schema.spec')
-rw-r--r--php-swaggest-json-schema.spec157
1 files changed, 157 insertions, 0 deletions
diff --git a/php-swaggest-json-schema.spec b/php-swaggest-json-schema.spec
new file mode 100644
index 0000000..e8ab08d
--- /dev/null
+++ b/php-swaggest-json-schema.spec
@@ -0,0 +1,157 @@
+# remirepo/fedora spec file for php-swaggest-json-schema
+#
+# Copyright (c) 2019 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 b324c2b7fd0178c7453483d6d6efe440d99d1925
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner swaggest
+%global gh_project php-json-schema
+# Packagist
+%global pk_vendor %{gh_owner}
+%global pk_project json-schema
+# Namespace
+%global ns_vendor Swaggest
+%global ns_project JsonSchema
+%global major %nil
+
+Name: php-%{pk_vendor}-%{pk_project}%{major}
+Version: 0.12.17
+Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
+Summary: High definition PHP structures with JSON-schema based validation
+
+License: MIT
+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
+BuildRequires: php-json
+BuildRequires: php-mbstring
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(phplang/scope-exit) > 1.0 with php-composer(phplang/scope-exit) < 2)
+BuildRequires: (php-composer(swaggest/json-diff) > 3.5.1 with php-composer(swaggest/json-diff) < 4)
+%else
+BuildRequires: php-composer(phplang/scope-exit) < 2
+BuildRequires: php-composer(phplang/scope-exit) >= 1.0
+BuildRequires: php-composer(swaggest/json-diff) < 4
+BuildRequires: php-composer(swaggest/json-diff) >= 3.5.1
+%endif
+# For tests, from composer.json "require-dev": {
+# "phpunit/phpunit": "^4.8.23",
+# "phpunit/php-code-coverage": "2.2.4",
+# "codeclimate/php-test-reporter": "^0.4.0"
+BuildRequires: php-composer(phpunit/phpunit) >= 4.8.23
+%global phpunit %{_bindir}/phpunit
+BuildRequires: php-date
+BuildRequires: php-filter
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# For autoloader
+BuildRequires: php-fedora-autoloader-devel
+%endif
+
+# From composer.json, "require": {
+# "php": ">=5.4",
+# "ext-json": "*",
+# "ext-mbstring": "*",
+# "phplang/scope-exit": "^1.0",
+# "swaggest/json-diff": "^3.5.1"
+Requires: php(language) >= 5.4
+Requires: php-json
+Requires: php-mbstring
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(phplang/scope-exit) > 1.0 with php-composer(phplang/scope-exit) < 2)
+Requires: (php-composer(swaggest/json-diff) > 3.5.1 with php-composer(swaggest/json-diff) < 4)
+%else
+Requires: php-composer(phplang/scope-exit) < 2
+Requires: php-composer(phplang/scope-exit) >= 1.0
+Requires: php-composer(swaggest/json-diff) < 4
+Requires: php-composer(swaggest/json-diff) >= 3.5.1
+%endif
+# From phpcompatinfo report for 0.12.17
+Requires: php-date
+Requires: php-filter
+Requires: php-pcre
+Requires: php-spl
+# For generated autoloader
+Requires: php-composer(fedora/autoloader)
+
+# Composer
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
+
+
+%description
+High definition PHP structures with JSON-schema based validation.
+
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+: Fix layout
+mkdir src/spec
+cp -p spec/*.json src/spec/
+sed -e 's:/../spec/:/spec/:' -i src/RemoteRef/Preloaded.php
+
+
+%build
+: Create autoloader
+%{_bindir}/phpab -t fedora -o src/autoload.php src
+cat << 'EOF' | tee -a src/autoload.php
+
+\Fedora\Autoloader\Dependencies::required([
+ '%{_datadir}/php/PhpLang/scope-exit-autoload.php',
+ '%{_datadir}/php/Swaggest/JsonDiff/autoload.php',
+]);
+EOF
+
+
+%install
+: Library
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%check
+%if %{with_tests}
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Tests\\', dirname(__DIR__).'/tests/src');
+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 README.md
+%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
+
+
+%changelog
+* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 0.12.17-1
+- initial package