summaryrefslogtreecommitdiffstats
path: root/php-bartlett-umlwriter.spec
blob: 4772367db82e3b1f86fbae74cb2d7fceae27e053 (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# remirepo/fedora spec file for php-bartlett-umlwriter
#
# Copyright (c) 2015-2018 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#

# For compatibility with SCL
%undefine __brp_mangle_shebangs

%global bootstrap    0
%global gh_commit    9f2b0800a4f541ad74e723e1f2f134dcddb8ddf5
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
#global gh_date      20150331
%global gh_owner     llaville
%global gh_project   umlwriter
#global prever       RC2
%if %{bootstrap}
%global with_tests   %{?_with_tests:1}%{!?_with_tests:0}
%else
%global with_tests   %{?_without_tests:0}%{!?_without_tests:1}
%endif

Name:           php-bartlett-umlwriter
Version:        1.3.1
%global specrel 1
Release:        %{?gh_date:1%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist}
Summary:        Create UML class diagrams from your PHP source

License:        BSD
URL:            http://php5.laurent-laville.org/umlwriter/
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}-%{gh_short}.tar.gz

# Autoloader for RPM - die composer !
Source1:        %{name}-autoload.php

# Use out autoloader
Patch0:         %{name}-rpm.patch

BuildArch:      noarch
BuildRequires:  php(language) >= 5.4.0
%if %{with_tests}
BuildRequires:  %{_bindir}/phpunit
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
BuildRequires:  (php-composer(symfony/console)                   >= 2.5  with php-composer(symfony/console)                   < 5)
BuildRequires:  (php-composer(sebastian/version)                 >= 1.0  with php-composer(sebastian/version)                 < 3)
BuildRequires:  (php-composer(bartlett/php-reflect)              >= 4.3  with php-composer(bartlett/php-reflect)              < 5)
BuildRequires:  (php-composer(andrewsville/php-token-reflection) >= 1.4  with php-composer(andrewsville/php-token-reflection) < 2)
# remirepo:6
%else
BuildRequires:  php-symfony-console                    >= 2.5
BuildRequires:  php-phpunit-Version                    >= 1.0
BuildRequires:  php-bartlett-PHP-Reflect               >= 4.0
BuildRequires:  php-andrewsville-php-token-reflection  >= 1.4
%endif
# For our patch / autoloader
BuildRequires:   php-composer(fedora/autoloader)
%endif

# From composer.json
#    "require": {
#        "php": "^5.4|^7.0"
#        "symfony/console": "^2.5|^3.0|^4.0",
#        "sebastian/version": "^1.0|^2.0"
Requires:       php(language) >= 5.4.0
Requires:       php-cli
Requires:       php-spl
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:       (php-composer(symfony/console)                   >= 2.5  with php-composer(symfony/console)                   < 5)
Requires:       (php-composer(sebastian/version)                 >= 1.0  with php-composer(sebastian/version)                 < 3)
# remirepo:4
%else
Requires:       php-symfony-console                    >= 2.5
Requires:       php-phpunit-Version                    >= 1.0
%endif
#    "require-dev": {
#        "bartlett/php-reflect": "^4.3",
#        "andrewsville/php-token-reflection": "^1.4"
#    "suggest": {
#        "bartlett/php-reflect": "Reverse-engine, default solution",
#        "andrewsville/php-token-reflection": "Reverse-engine, alternative solution"
%if ! %{bootstrap}
# remirepo:1
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
Requires:      (php-composer(bartlett/php-reflect)              >= 4.3  with php-composer(bartlett/php-reflect)              < 5)
Requires:      (php-composer(andrewsville/php-token-reflection) >= 1.4  with php-composer(andrewsville/php-token-reflection) < 2)
# remirepo:4
%else
Requires:       php-bartlett-PHP-Reflect >= 4.3
Requires:       php-andrewsville-php-token-reflection >= 1.4
%endif
%endif
# For our patch / autoloader
Requires:       php-composer(fedora/autoloader)

Provides:       php-composer(bartlett/umlwriter) = %{version}


%description
This tool wil generate UML class diagrams with all class,
interface and trait definitions in your PHP project.

* reverse-engine interchangeable (currently support Bartlett\Reflect
  and Andrewsville\TokenReflection)
* UML syntax processor interchangeable (currently support Graphviz
  and PlantUML)
* generates a class and its direct dependencies
* generates a namespace with all objects
* generates a full package with all namespaces and objects


%prep
%setup -q -n %{gh_project}-%{gh_commit}

%patch0 -p1 -b .rpm
cp %{SOURCE1} src/Bartlett/UmlWriter/autoload.php

sed -e 's/@package_version@/%{version}%{?prever}/' \
    -i $(find src -name \*.php) bin/umlwriter


%build
# Nothing


%install
mkdir -p %{buildroot}%{_datadir}/php
cp -pr src/Bartlett %{buildroot}%{_datadir}/php/Bartlett

install -Dpm 755 bin/umlwriter   %{buildroot}%{_bindir}/umlwriter
install -Dpm 644 bin/umlwriter.1 %{buildroot}%{_mandir}/man1/umlwriter.1


%check
%if %{with_tests}
ret=0
for cmd in php php72 php73 php74; do
  if which $cmd; then
    $cmd %{_bindir}/phpunit --bootstrap %{buildroot}%{_datadir}/php/Bartlett/UmlWriter/autoload.php || ret=1
  fi
done
exit $ret
%else
: Test suite disabled
%endif


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json README.* examples
%{_bindir}/umlwriter
%{_mandir}/man1/umlwriter.1*
%dir %{_datadir}/php/Bartlett
     %{_datadir}/php/Bartlett/UmlWriter


%changelog
* Mon Nov 25 2019 Remi Collet <remi@remirepo.net> - 1.3.1-1
- update to 1.3.1 (no change)

* Tue Nov 27 2018 Remi Collet <remi@remirepo.net> - 1.3.0-1
- update to 1.3.0
- raise dependency on bartlett/php-reflect 4.3
- allow Symfony 4

* Tue Mar 20 2018 Remi Collet <remi@remirepo.net> - 1.2.1-1
- update to 1.2.1 (no change)
- use range dependencies on F27+
- allow Symfony 3
- raise dependency on bartlett/php-reflect 4.0

* Wed Mar  1 2017 Remi Collet <remi@remirepo.net> - 1.2.0-1
- update to 1.2.0 (no change)
- add the command man page

* Mon Oct 31 2016 Remi Collet <remi@fedoraproject.org> - 1.1.0-4
- switch to fedora/autoloader

* Mon Apr 18 2016 Remi Collet <remi@fedoraproject.org> - 1.1.0-3
- allow sebastian/version 2.0
- run test suite with both PHP 5 and 7 when available

* Thu Dec 10 2015 Remi Collet <remi@fedoraproject.org> - 1.1.0-1
- update to 1.1.0
- raise dependency on php >= 5.4.0
- allow php-reflect 4

* Tue Sep 29 2015 Remi Collet <remi@fedoraproject.org> - 1.0.1-1
- update to 1.0.1

* Sun Jun 28 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-6
- fix autoloader

* Fri Jun 26 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-5
- rewrite autoloader

* Mon Jun 22 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-4
- fix Autoload

* Fri May 22 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-2
- standard build (no bootstrap)

* Fri Apr  3 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-1
- update to 1.0.0

* Tue Mar 31 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.3.20150331gitdd58a0b
- git snapshot, post 1.0.0RC2
- cleanup EL-5 stuff

* Tue Mar 31 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.2.RC2
- update to 1.0.0RC2
- add umlwrite command
- add dependencies on symfony/console, symfony/class-loader,
  bartlett/php-reflect, sebastian/version
  and andrewsville/php-token-reflection
- run test suite during build, but ignore results for now
- open https://github.com/llaville/umlwriter/issues/1 test suite issue
- open https://github.com/llaville/umlwriter/issues/2 runtime issue

* Tue Mar 24 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.1.RC1
- Initial RPM package, version 1.0.0RC1