summaryrefslogtreecommitdiffstats
path: root/php-phpspec-php-diff.spec
blob: 27eb26ae3221712961549b09b6c7a80166c76f59 (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
# spec file for php-phpspec-php-diff
#
# Copyright (c) 2015 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
%global gh_commit    30e103d19519fe678ae64a60d77884ef3d71b28a
%global gh_short     %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner     phpspec
%global gh_project   php-diff

Name:           php-phpspec-php-diff
Version:        1.0.2
Release:        1%{?dist}
Summary:        A library for generating differences between two hashable objects

Group:          Development/Libraries
# LICENSE text is inclued in the README file
License:        BSD
URL:            https://github.com/%{gh_owner}/%{gh_project}
Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz

# Fix example to use our generated autoloader
Patch0:         %{gh_project}-example.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
# For minimal test
BuildRequires:  php-cli
# To generate an autoloader
BuildRequires:  %{_bindir}/phpab

Requires:       php(language)
Requires:       php-pcre

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


%description
A comprehensive library for generating differences between two hashable
objects (strings or arrays). Generated differences can be rendered in
all of the standard formats including:
 * Unified
 * Context
 * Inline HTML
 * Side by Side HTML

The logic behind the core of the diff engine (ie, the sequence matcher)
is primarily based on the Python difflib package. The reason for doing
so is primarily because of its high degree of accuracy.


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

%patch0 -p0


%build
: Generate a simple autoloader
%{_bindir}/phpab --output lib/autoload.php lib


%install
# No namespace, so use a package specific dir
rm -rf       %{buildroot}
mkdir -p     %{buildroot}%{_datadir}/php/phpspec/php-diff
cp -pr lib/* %{buildroot}%{_datadir}/php/phpspec/php-diff


%check
# Not really a test... but should work without error
cd example
%{_bindir}/php -d include_path=%{buildroot}%{_datadir}/php example.php >/dev/null


%clean
rm -rf %{buildroot}


%files
%defattr(-,root,root,-)
%doc README example
%doc composer.json
%{_datadir}/php/phpspec


%changelog
* Tue Feb 17 2015 Remi Collet <remi@fedoraproject.org> - 1.0.2-1
- initial package