summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-05-13 15:32:31 +0200
committerRemi Collet <fedora@famillecollet.com>2014-05-13 15:32:31 +0200
commitd8e3eb5f3b1593e76f236149fe214746bf9e2cf9 (patch)
tree126ee739e3ccf348e8b712cffe89985464997367
parent9ae2ee4c1c2e9d670802784323e2470c16e822b7 (diff)
php-phpunit-PHPUnit-SkeletonGenerator: 2.0.0
-rw-r--r--autoload.php.in31
-rw-r--r--php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch34
-rw-r--r--php-phpunit-PHPUnit-SkeletonGenerator.spec68
3 files changed, 106 insertions, 27 deletions
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 @@
+<?php
+/* inspired from autoload from version 1.2.1 */
+
+$phpdir = '/usr/share/php';
+
+require_once $phpdir.'/Text/Template/Autoload.php';
+
+require_once $phpdir.'/SebastianBergmann/Version/autoload.php';
+
+require_once $phpdir.'/Symfony/Component/ClassLoader/UniversalClassLoader.php';
+$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
+$loader->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
+ <?php
+ /**
+ * phpunit-skeleton-generator
+@@ -42,23 +42,7 @@
+ * @since File available since Release 1.0.0
+ */
+
+-$loaded = false;
+-
+-foreach (array(__DIR__ . '/../../autoload.php', __DIR__ . '/vendor/autoload.php') as $file) {
+- if (file_exists($file)) {
+- require $file;
+- $loaded = true;
+- break;
+- }
+-}
+-
+-if (!$loaded) {
+- die(
+- 'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+- 'wget http://getcomposer.org/composer.phar' . PHP_EOL .
+- 'php composer.phar install' . PHP_EOL
+- );
+-}
++require '/usr/share/php/SebastianBergmann/PHPUnit/SkeletonGenerator/autoload.php';
+
+ $application = new SebastianBergmann\PHPUnit\SkeletonGenerator\CLI\Application;
+ $application->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 <remi@fedoraproject.org> - 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 <remi@fedoraproject.org> - 1.2.1-4
- cleanup pear registry