From d8e3eb5f3b1593e76f236149fe214746bf9e2cf9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 13 May 2014 15:32:31 +0200 Subject: php-phpunit-PHPUnit-SkeletonGenerator: 2.0.0 --- autoload.php.in | 31 +++++++++++ php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch | 34 +++++++++++++ php-phpunit-PHPUnit-SkeletonGenerator.spec | 68 +++++++++++++++---------- 3 files changed, 106 insertions(+), 27 deletions(-) create mode 100644 autoload.php.in create mode 100644 php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch diff --git a/autoload.php.in b/autoload.php.in new file mode 100644 index 0000000..ed4d26b --- /dev/null +++ b/autoload.php.in @@ -0,0 +1,31 @@ +registerNamespaces(array( + 'Symfony\\Component\\Console' => $phpdir, + 'Symfony\\Component\\ClassLoader' => $phpdir, +)); +$loader->register(); + +spl_autoload_register( + function($class) { + static $classes = null; + if ($classes === null) { + $classes = array( + ___CLASSLIST___ + ); + } + $cn = strtolower($class); + if (isset($classes[$cn])) { + require ___BASEDIR___$classes[$cn]; + } + } +); diff --git a/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch b/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch new file mode 100644 index 0000000..7f370df --- /dev/null +++ b/php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch @@ -0,0 +1,34 @@ +diff -up phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen.rpm phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen +--- phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen.rpm 2014-05-13 15:03:03.000000000 +0200 ++++ phpunit-skeleton-generator-e933d394bdfacec34b7ff4e8fc53c625e09e9721/phpunit-skelgen 2014-05-13 15:04:42.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env php ++#!/usr/bin/php + run(); diff --git a/php-phpunit-PHPUnit-SkeletonGenerator.spec b/php-phpunit-PHPUnit-SkeletonGenerator.spec index 6741115..f947eb8 100644 --- a/php-phpunit-PHPUnit-SkeletonGenerator.spec +++ b/php-phpunit-PHPUnit-SkeletonGenerator.spec @@ -6,19 +6,19 @@ # # Please, preserve the changelog entries # -%global gh_commit 8a524d3a65ebebc89ce63c937b9e5a4b305e90e1 +%global gh_commit e933d394bdfacec34b7ff4e8fc53c625e09e9721 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner sebastianbergmann %global gh_project phpunit-skeleton-generator %global php_home %{_datadir}/php %global pear_name PHPUnit_SkeletonGenerator %global pear_channel pear.phpunit.de -# Circular dependency with phpunit +# Missing dep to run test %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: php-phpunit-PHPUnit-SkeletonGenerator -Version: 1.2.1 -Release: 4%{?dist}.1 +Version: 2.0.0 +Release: 1%{?dist} Summary: Tool that can generate skeleton test classes Group: Development/Libraries @@ -26,21 +26,37 @@ 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 + +# Autoloader for RPM - die composer ! +Patch0: %{name}-rpm.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.3 +BuildRequires: %{_bindir}/phpab +%if %{with_tests} +BuildRequires: %{_bindir}/phpunit +BuildRequires: php-phpunit-Text-Template >= 1.2 +BuildRequires: php-phpunit-Version >= 1.0 +BuildRequires: php-symfony-console >= 2.4 +BuildRequires: php-symfony-classloader >= 2.4 +# BuildRequires: "mikey179/vfsStream": "~1.2" +%endif +# From composer.json Requires: php(language) >= 5.3.3 +Requires: php-phpunit-Text-Template >= 1.2 +Requires: php-phpunit-Version >= 1.0 +Requires: php-symfony-console >= 2.4 +# Need for our autoloader patch +Requires: php-symfony-classloader >= 2.4 +# From phpcompatinfo report from 2.0.0 Requires: php-date Requires: php-pcre -Requires: php-reflection Requires: php-spl Requires: php-tokenizer -Requires: php-phpunit-Text-Template >= 1.1.1 -Requires: php-pear(components.ez.no/ConsoleTools) >= 1.6 - -# For compatibility with PEAR mode -Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} %description @@ -51,24 +67,16 @@ and vice versa. %prep %setup -q -n %{gh_project}-%{gh_commit} -rm src/autoload.php.in +%patch0 -p1 -b .rpm -# Fix loader -sed -e 's:/usr/bin/env php:%{_bindir}/php:' \ - -e 's:@php_bin@:%{php_home}:' \ - -i phpunit-skelgen.php +find . -type f -name \*.rpm -print | xargs rm %build -# Empty build section, most likely nothing required. - -# If upstream drop Autoload.php, command to generate it. -# Also remember to fix the command to use it. - -#phpab \ -# --output src/autoload.php \ -# --template src/autoload.php.in \ -# src +phpab \ + --output src/autoload.php \ + --template %{SOURCE1} \ + src %install @@ -76,7 +84,7 @@ rm -rf %{buildroot} mkdir -p %{buildroot}%{php_home}/SebastianBergmann/PHPUnit cp -pr src %{buildroot}%{php_home}/SebastianBergmann/PHPUnit/SkeletonGenerator -install -D -p -m 755 phpunit-skelgen.php %{buildroot}%{_bindir}/phpunit-skelgen +install -D -p -m 755 phpunit-skelgen %{buildroot}%{_bindir}/phpunit-skelgen %clean @@ -86,8 +94,8 @@ rm -rf %{buildroot} %if %{with_tests} %check phpunit \ - --test-suffix .phpt \ -d date.timezone=UTC \ + --bootstrap src/autoload.php \ tests %endif @@ -101,7 +109,7 @@ fi %files %defattr(-,root,root,-) -%doc README.markdown ChangeLog.markdown LICENSE +%doc README.md LICENSE composer.json %{_bindir}/phpunit-skelgen %dir %{php_home}/SebastianBergmann %dir %{php_home}/SebastianBergmann/PHPUnit @@ -109,6 +117,12 @@ fi %changelog +* Tue May 13 2014 Remi Collet - 2.0.0-1 +- update to 2.0.0 +- add generated autoloader +- switch from php-ezc-ConsoleTools to php-symfony-Console +- add dependency on php-phpunit-Version + * Wed Apr 30 2014 Remi Collet - 1.2.1-4 - cleanup pear registry -- cgit