[php-phpunit-PHPUnit-SkeletonGenerator] - update to 2.0.0 - add generated autoloader - switch from php-ezc-ConsoleTools to php-symfony-Conso

Remi Collet remi at fedoraproject.org
Tue May 13 13:43:01 UTC 2014


commit 8079e1d00351099414c8f3fd1b6a97867052c11b
Author: Remi Collet <remi at fedoraproject.org>
Date:   Tue May 13 15:42:48 2014 +0200

    - update to 2.0.0
    - add generated autoloader
    - switch from php-ezc-ConsoleTools to php-symfony-Console
    - add dependency on php-phpunit-Version

 .gitignore                                      |    1 +
 autoload.php.in                                 |   31 ++++++++++
 php-phpunit-PHPUnit-SkeletonGenerator-rpm.patch |   34 +++++++++++
 php-phpunit-PHPUnit-SkeletonGenerator.spec      |   68 ++++++++++++++---------
 sources                                         |    2 +-
 5 files changed, 108 insertions(+), 28 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index c33ae5e..04a66c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ package-*.xml
 /PHPUnit_SkeletonGenerator-1.2.0.tgz
 /PHPUnit_SkeletonGenerator-1.2.1.tgz
 /phpunit-skeleton-generator-1.2.1.tar.gz
+/phpunit-skeleton-generator-2.0.0.tar.gz
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 4f6cbe6..d836693 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}
+Version:        2.0.0
+Release:        1%{?dist}
 Summary:        Tool that can generate skeleton test classes
 
 Group:          Development/Libraries
@@ -26,20 +26,36 @@ 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
+
 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
@@ -50,38 +66,30 @@ 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
 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
 
 
 %if %{with_tests}
 %check
 phpunit \
-  --test-suffix .phpt \
   -d date.timezone=UTC \
+  --bootstrap src/autoload.php \
   tests
 %endif
 
@@ -94,7 +102,7 @@ fi
 
 
 %files
-%doc README.markdown ChangeLog.markdown LICENSE
+%doc README.md LICENSE composer.json
 %{_bindir}/phpunit-skelgen
 %dir %{php_home}/SebastianBergmann
 %dir %{php_home}/SebastianBergmann/PHPUnit
@@ -102,6 +110,12 @@ fi
 
 
 %changelog
+* Tue May 13 2014 Remi Collet <remi at 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 at fedoraproject.org> - 1.2.1-4
 - cleanup pear registry
 
diff --git a/sources b/sources
index 743de5a..eadacac 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-2dcae746b005967bd5559bfdc6eb0b0e  phpunit-skeleton-generator-1.2.1.tar.gz
+28e986fbcd7dc41c7d85f1487b79666e  phpunit-skeleton-generator-2.0.0.tar.gz


More information about the scm-commits mailing list