summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--autoload.php.in17
-rw-r--r--php-hamcrest.spec41
2 files changed, 26 insertions, 32 deletions
diff --git a/autoload.php.in b/autoload.php.in
deleted file mode 100644
index 2112c71..0000000
--- a/autoload.php.in
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-require __DIR__ . '/Hamcrest.php';
-
-spl_autoload_register(
- function($class) {
- static $classes = null;
- if ($classes === null) {
- $classes = array(
- ___CLASSLIST___
- );
- }
- $cn = strtolower($class);
- if (isset($classes[$cn])) {
- require __DIR__ . $classes[$cn];
- }
- }
-);
diff --git a/php-hamcrest.spec b/php-hamcrest.spec
index 435d700..d11eebe 100644
--- a/php-hamcrest.spec
+++ b/php-hamcrest.spec
@@ -1,4 +1,4 @@
-# spec file for php-hamcrest
+# remirepo/fedora spec file for php-hamcrest
#
# Copyright (c) 2015 Remi Collet
# License: CC-BY-SA
@@ -6,42 +6,41 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit a68ffcabdeeb2c7c253073ab49c86a91a551d8dd
+%global gh_commit b37020aa976fa52d3de9aa904aa2522dc518f79c
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner hamcrest
%global gh_project hamcrest-php
-%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+%global with_tests 0%{!?_without_tests:1}
Name: php-hamcrest
-Version: 1.2.0
+Version: 1.2.2
Release: 1%{?dist}
Summary: PHP port of Hamcrest Matchers
Group: Development/Libraries
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
-
-# Autoloader template
-Source1: autoload.php.in
+Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}-%{gh_short}.tar.gz
# Use generated autoloader instead of composer one
Patch0: bootstrap-autoload.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
-BuildRequires: %{_bindir}/phpab
-BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-composer(theseer/autoload)
+%if %{with_tests}
+BuildRequires: php-composer(phpunit/phpunit)
# composer.json
# "php": ">=5.3.2"
BuildRequires: php(language) >= 5.3.2
-# From phpcompatinfo report for 1.2.0
+# From phpcompatinfo report for 1.2.2
BuildRequires: php-dom
BuildRequires: php-pcre
BuildRequires: php-spl
+%endif
Requires: php(language) >= 5.3.2
-# From phpcompatinfo report for 1.2.0
+# From phpcompatinfo report for 1.2.2
Requires: php-dom
Requires: php-pcre
Requires: php-spl
@@ -57,6 +56,9 @@ but subsequently ported to many other languages.
a literal translation of the original Java API for Hamcrest,
with a few Exceptions, mostly down to PHP language barriers.
+To use this library, you just have to add, in your project:
+ require_once '%{_datadir}/php/Hamcrest/autoload.php';
+
%prep
%setup -q -n %{gh_project}-%{gh_commit}
@@ -70,10 +72,15 @@ mv hamcrest/Hamcrest.php hamcrest/Hamcrest/Hamcrest.php
%build
# Library autoloader
%{_bindir}/phpab \
- --template %{SOURCE1} \
--output hamcrest/Hamcrest/autoload.php \
hamcrest/Hamcrest
+cat << 'EOF' | tee -a hamcrest/Hamcrest/autoload.php
+
+// Functions
+require __DIR__ . '/Hamcrest.php';
+EOF
+
# Test suite autoloader
%{_bindir}/phpab \
--output tests/autoload.php \
@@ -90,7 +97,7 @@ cp -pr hamcrest/* %{buildroot}%{_datadir}/php
%check
%if %{with_tests}
cd tests
-%{_bindir}/phpunit
+%{_bindir}/phpunit --verbose
%else
: Test suite disabled
%endif
@@ -104,10 +111,14 @@ rm -rf %{buildroot}
%defattr(-,root,root,-)
%{!?_licensedir:%global license %%doc}
%license LICENSE.txt
-%doc CHANGES.txt README.md composer.json TODO.txt
+%doc CHANGES.txt README.md TODO.txt
+%doc composer.json
%{_datadir}/php/Hamcrest
%changelog
+* Thu Oct 15 2015 Remi Collet <remi@fedoraproject.org> - 1.2.2-1
+- update to 1.2.2
+
* Mon Jan 5 2015 Remi Collet <remi@fedoraproject.org> - 1.2.0-1
- initial package \ No newline at end of file