summaryrefslogtreecommitdiffstats
path: root/php-Analog.spec
blob: 1bd20c1ff7436b2c542dd90981528b3d4d236580 (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
# remirepo spec file for php-Analog, from:
#
# Fedora spec file for php-Analog
#
# License: MIT
# http://opensource.org/licenses/MIT
#
# Please preserve changelog entries
#
%global commit 718ac1dad4577a15cadadab01b79d1923f5a9c6d
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global real_name Analog
%global minus_name analog

%global devver 0

Name:           php-Analog
Summary:        PHP micro logging package
Version:        1.0.13
%if %{devver}
Release:        1git%{shortcommit}%{?dist}
%else
Release:        1%{?dist}
%endif
Source0:        https://github.com/jbroadway/%{real_name}/archive/%{commit}/%{minus_name}-%{version}-%{shortcommit}.tar.gz
URL:            https://github.com/jbroadway/analog
License:        MIT

BuildArch:      noarch
BuildRequires:  php-composer(fedora/autoloader)
# For tests
%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
%global phpunit %{_bindir}/phpunit6
BuildRequires:  phpunit6 >= 6.5
%else
%global phpunit %{_bindir}/phpunit
BuildRequires:  %{phpunit}
%endif
BuildRequires:  php-composer(psr/log)

# from composer.json,  "require": {
#                "psr/log": "1.*",
#                "php": ">=5.3.2"
Requires:       php(language) >= 5.3.2
Requires:       php-composer(psr/log)
# From phpcompatinfo report
Requires:       php-curl
Requires:       php-date
Requires:       php-json
Requires:       php-pcre
Requires:       php-reflection
Requires:       php-spl
Requires:       php-xml
# mongo is optional
# Autoloader
Requires:       php-composer(fedora/autoloader)

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


%description
MicroPHP logging package based on the idea of using closures for
configurability and extensibility. It functions as a static class,
but you can completely control the writing of log messages through
a closure function (aka anonymous functions).

Analog also comes with over a dozen pre-written handlers,
with examples for each in the examples folder. These include:
- Amon - Send logs to the Amon server monitoring tool
- Buffer - Buffer messages to send all at once (works with File,
  Mail, Stderr, and Variable handlers)
- File - Append messages to a file
- FirePHP - Send messages to FirePHP browser plugin
- GELF - Send message to the Graylog2 log management server
- Ignore - Do nothing
- LevelBuffer - Buffer messages and send only if sufficient error
  level reached
- LevelName - Convert log level numbers to names in log output
- Mail - Send email notices
- Mongo - Save to MongoDB collection, requires php-pecl-mongodb
  package to be installed
- Multi - Send different log levels to different handlers
- Post - Send messages over HTTP POST to another machine
- Slackbot - Post messages to Slack via Slackbot
- Stderr - Send messages to STDERR
- Syslog - Send messages to syslog
- Threshold - Only writes log messages above a certain threshold
- Variable - Buffer messages to a variable reference.

So while it's a micro class, it's highly extensible and very capable
out of the box too.

Autoloader: %{_datadir}/php/%{real_name}/autoload.php


%prep
%setup -qn %{minus_name}-%{commit}


%build
cat << 'EOF' | tee -a lib/%{real_name}/autoload.php
<?php
/* Autoloader for analog/analog and its dependencies */

require_once '%{_datadir}/php/Fedora/Autoloader/autoload.php';

\Fedora\Autoloader\Autoload::addPsr4('Analog\\', __DIR__);
\Fedora\Autoloader\Dependencies::required(array(
        '%{_datadir}/php/Psr/Log/autoload.php',
));
EOF


%install
rm -rf %{buildroot}

# install framework files
install -d %{buildroot}%{_datadir}/php
cp -a lib/%{real_name} %{buildroot}%{_datadir}/php/


%check
: Use and test our autoloader
cat <<EOF | tee tests/bootstrap.php
<?php
require '%{buildroot}%{_datadir}/php/%{real_name}/autoload.php';
EOF

: Upstream test suite
ret=0
for cmdarg in "php %{phpunit}" php71 php72 php73 php74; do
  if which $cmdarg; then
    set $cmdarg
    $1 ${2:-%{_bindir}/phpunit6} --verbose || ret=1
  fi
done
exit $ret


%files
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc README.md
%doc examples lib/%{real_name}.php
%doc composer.json
%dir %{_datadir}/php/%{real_name}
%{_datadir}/php/%{real_name}/*


%changelog
* Fri Jun 28 2019 Remi Collet <remi@remirepo.net> - 1.0.13-1
- update to 1.0.13
- use PHPUnit 6

* Tue Nov 14 2017 Remi Collet <remi@remirepo.net> - 1.0.10-1
- update to 1.0.10

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

* Thu Aug 11 2016 Remi Collet <remi@fedoraproject.org> - 1.0.8-1
- update to 1.0.8

* Thu May  5 2016 Remi Collet <remi@fedoraproject.org> - 1.0.7-2
- generate a simple autoloader (and use it for test suite)

* Thu May 05 2016 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.7-1
- Update to 1.0.7 (PHP7 compatible)

* Tue May 26 2015 Remi Collet <remi@fedoraproject.org> - 1.0.6-1
- update to 1.0.6
- composer dependencies
- add patch for PHP-7 (add Ignore, Null is deprecated)

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-5.git9ab4c9e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-4.git9ab4c9e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sun Feb 10 2013 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-4.git9ab4c9e
- Add patch for locked file (https://github.com/jbroadway/analog/issues/7)
- Remove licence file and patch applied upstream
- Change github source URL

* Sun Dec 30 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-2.git876d8a3bb
- Fix a typo
- Run tests, add relevant BR and patch

* Sun Dec 30 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-1.git876d8a3bb
- Fix version
- remove not needeed php-hash requirement
- remove php-mongo requirement (add a line in %%description)
- remove unneeded macro
- add LICENSE file (upstream bug https://github.com/jbroadway/analog/issues/2)

* Mon Dec 24 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0.1-1.git876d8a3bb
- Latest snapshot (bug fixes, new handlers)
- Fix Requires

* Sat Dec 01 2012 Johan Cwiklinski <johan AT x-tnd DOT be> - 1.0.0-1
- Initial packaging