blob: f0771f5cc116c0ebff26ca7802cee661303daa06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# remirepo/fedora spec file for php-swaggest-json-diff
#
# 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 203014d2d87a60b37dc8a985b71c866e83752f67
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner swaggest
%global gh_project json-diff
# Packagist
%global pk_vendor %{gh_owner}
%global pk_project %{gh_project}
# Namespace
%global ns_vendor Swaggest
%global ns_project JsonDiff
%global major %nil
Name: php-%{pk_vendor}-%{pk_project}%{major}
Version: 3.7.1
Release: 1%{?gh_date?%{gh_date}git%{gh_short}}%{?dist}
Summary: JSON diff/rearrange/patch/pointer library for PHP
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-json
# 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-filter
BuildRequires: php-pcre
# For autoloader
BuildRequires: php-fedora-autoloader-devel
%endif
# From composer.json, "require": {
# "ext-json": "*"
Requires: php-json
# From phpcompatinfo report for 3.7.0
Requires: php-filter
Requires: php-pcre
# For generated autoloader
Requires: php-composer(fedora/autoloader)
# Composer
Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
%description
A PHP implementation for finding unordered diff between two JSON documents.
Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
%build
: Create autoloader
%{_bindir}/phpab -t fedora -o src/autoload.php src
%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');
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
%dir %{_datadir}/php/%{ns_vendor}
%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
%changelog
* Thu Sep 26 2019 Remi Collet <remi@remirepo.net> - 3.7.1-1
- update to 3.7.1
* Thu Sep 12 2019 Remi Collet <remi@remirepo.net> - 3.7.0-1
- initial package
|