diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-05-03 19:02:26 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-05-03 19:02:26 +0200 |
commit | e17c9b8c0f11d87a3b96e8bd61f2308ac9015a1c (patch) | |
tree | 74d88105ae3fe753eb804b5dde1693e6e851fc4d | |
parent | f0d031b84187d26cf8de4d2f7bd774d83454550f (diff) |
php-phpunit-phploc: 2.0.5, sources from github
-rw-r--r-- | autoload.php.in | 25 | ||||
-rw-r--r-- | php-phpunit-phploc.spec | 111 | ||||
-rw-r--r-- | phploc-rpm.patch | 34 |
3 files changed, 124 insertions, 46 deletions
diff --git a/autoload.php.in b/autoload.php.in new file mode 100644 index 0000000..52a3f0c --- /dev/null +++ b/autoload.php.in @@ -0,0 +1,25 @@ +<?php +/* Inspired from autoload from version 2.0.3 */ + +require_once 'SebastianBergmann/FinderFacade/autoload.php'; +require_once 'SebastianBergmann/Git/autoload.php'; +require_once 'SebastianBergmann/Version/autoload.php'; +require_once 'Symfony/Component/Console/autoloader.php'; + +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-phploc.spec b/php-phpunit-phploc.spec index b874639..5376a5a 100644 --- a/php-phpunit-phploc.spec +++ b/php-phpunit-phploc.spec @@ -1,39 +1,53 @@ -%{!?pear_metadir: %global pear_metadir %{pear_phpdir}} -%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}} -%global pear_name phploc +%global gh_commit d177c22e2a08e448f7bdfa762045f7bd086834d7 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner sebastianbergmann +%global gh_project phploc +%global php_home %{_datadir}/php/SebastianBergmann %global pear_channel pear.phpunit.de +%global with_tests %{?_without_tests:0}%{!?_without_tests:1} Name: php-phpunit-phploc -Version: 2.0.4 +Version: 2.0.5 Release: 1%{?dist} Summary: A tool for quickly measuring the size of a PHP project Group: Development/Libraries License: BSD -URL: http://sebastianbergmann.github.com/phploc/ -Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz + +# Autoload template +Source1: autoload.php.in + +# Fix for RPM, use autoload +Patch0: %{gh_project}-rpm.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -BuildRequires: php-pear(PEAR) >= 1.9.4 -BuildRequires: php-channel(%{pear_channel}) - -Requires(post): %{__pear} -Requires(postun): %{__pear} -# From package.xml +BuildRequires: php(language) >= 5.3.3 +BuildRequires: %{_bindir}/phpab +%if %{with_tests} +BuildRequires: %{_bindir}/phpunit +BuildRequires: php-phpunit-FinderFacade >= 1.1.0 +BuildRequires: php-phpunit-git >= 1.0.0 +BuildRequires: php-phpunit-Version >= 1.0.3 +BuildRequires: php-symfony-console >= 2.2.0 +%endif + +# From composer.json Requires: php(language) >= 5.3.3 -Requires: php-tokenizer -Requires: php-pear(PEAR) >= 1.9.4 -Requires: php-channel(%{pear_channel}) -Requires: php-pear(pear.symfony.com/Console) >= 2.2.0 -Requires: php-pear(%{pear_channel}/FinderFacade) >= 1.1.0 -Requires: php-pear(%{pear_channel}/Git) >= 1.0.0 -Requires: php-pear(%{pear_channel}/Version) >= 1.0.0 -# From phpcompatinfo report for version 2.0.3 +Requires: php-phpunit-FinderFacade >= 1.1.0 +Requires: php-phpunit-git >= 1.0.0 +Requires: php-phpunit-Version >= 1.0.3 +Requires: php-symfony-console >= 2.2.0 +# From phpcompatinfo report for version 2.0.5 Requires: php-dom Requires: php-spl +Requires: php-tokenizer +# For compat Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} +Provides: phploc = %{version} %description @@ -45,54 +59,59 @@ need to get a quick understanding of a project's size. %prep -%setup -q -c -[ -f package2.xml ] || mv package.xml package2.xml -%{__mv} package2.xml %{pear_name}-%{version}/%{name}.xml -cd %{pear_name}-%{version} +%setup -q -n %{gh_project}-%{gh_commit} + +%patch0 -p1 -b .rpm + %build -cd %{pear_name}-%{version} -# Empty build section, most likely nothing required. +phpab \ + --output src/autoload.php \ + --template %{SOURCE1} \ + src %install -cd %{pear_name}-%{version} -%{__rm} -rf %{buildroot} docdir -%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml +rm -rf %{buildroot} +mkdir -p %{buildroot}%{php_home} +cp -pr src %{buildroot}%{php_home}/PHPLOC + +install -D -p -m 755 phploc %{buildroot}%{_bindir}/phploc -# Clean up unnecessary files -%{__rm} -rf %{buildroot}%{pear_metadir}/.??* -# Install XML package description -%{__mkdir} -p %{buildroot}%{pear_xmldir} -%{__install} -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} +%if %{with_tests} +%check +phpunit \ + --bootstrap src/autoload.php \ + -d date.timezone=UTC \ + tests +%endif %clean -%{__rm} -rf %{buildroot} +rm -rf %{buildroot} %post -%{__pear} install --nodeps --soft --force --register-only \ - %{pear_xmldir}/%{name}.xml >/dev/null || : - - -%postun -if [ $1 -eq 0 ] ; then - %{__pear} uninstall --nodeps --ignore-errors --register-only \ - %{pear_channel}/%{pear_name} >/dev/null || : +if [ -x %{_bindir}/pear ]; then + %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \ + %{pear_channel}/%{pear_name} >/dev/null || : fi %files %defattr(-,root,root,-) -%doc %{pear_docdir}/%{pear_name} -%{pear_xmldir}/%{name}.xml -%{pear_phpdir}/SebastianBergmann/PHPLOC +%doc LICENSE README.md composer.json +%{php_home}/PHPLOC %{_bindir}/phploc %changelog +* Sat May 3 2014 Remi Collet <remi@fedoraproject.org> - 2.0.5-1 +- update to 2.0.5 +- sources from github +- run test suite during build + * Wed Dec 18 2013 Remi Collet <remi@fedoraproject.org> - 2.0.4-1 - Update to 2.0.4 diff --git a/phploc-rpm.patch b/phploc-rpm.patch new file mode 100644 index 0000000..fc04bb6 --- /dev/null +++ b/phploc-rpm.patch @@ -0,0 +1,34 @@ +diff -up ./phploc.rpm ./phploc +--- ./phploc.rpm 2014-05-03 18:50:56.000000000 +0200 ++++ ./phploc 2014-05-03 18:51:38.000000000 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env php ++#!/usr/bin/php + <?php + /** + * phploc +@@ -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 'SebastianBergmann/PHPLOC/autoload.php'; + + $application = new SebastianBergmann\PHPLOC\CLI\Application; + $application->run(); |