From 5f2c0154a67050af8203ea93331122f3e317d3c2 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 16 May 2017 09:38:36 +0200 Subject: switch to fedora/autoloader --- .gitignore | 7 +++++ apigen-rpm.patch | 87 +++++++++++++++++++++++++------------------------------- apigen.spec | 44 ++++++++++++++++++---------- composer.json | 60 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 63 deletions(-) create mode 100644 .gitignore create mode 100644 composer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/apigen-rpm.patch b/apigen-rpm.patch index 0a7e887..bc167f9 100644 --- a/apigen-rpm.patch +++ b/apigen-rpm.patch @@ -1,6 +1,6 @@ diff -up ./bin/apigen.rpm ./bin/apigen ---- ./bin/apigen.rpm 2015-10-30 13:44:43.000000000 +0100 -+++ ./bin/apigen 2015-11-03 08:06:32.480579189 +0100 +--- ./bin/apigen.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./bin/apigen 2017-05-16 09:15:18.037164467 +0200 @@ -1,7 +1,7 @@ #!/usr/bin/env php register(); -+} ++\Fedora\Autoloader\Autoload::addPsr4('ApiGen\\', __DIR__); + -+$fedoraClassLoader->addPrefix('ApiGen\\', dirname(__DIR__)); ++\Fedora\Autoloader\Dependencies::required(array( ++ '/usr/share/php/Symfony/Component/OptionsResolver/autoload.php', ++ '/usr/share/php/Symfony/Component/Console/autoload.php', ++ '/usr/share/php/Symfony/Component/Yaml/autoload.php', ++ '/usr/share/php/TokenReflection/autoload.php', ++ '/usr/share/php/Michelf/markdown-autoload.php', ++ '/usr/share/php/Nette/Application/autoload.php', ++ '/usr/share/php/Nette/Bootstrap/autoload.php', ++ '/usr/share/php/Nette/DI/autoload.php', ++ '/usr/share/php/Nette/Neon/autoload.php', ++ '/usr/share/php/Nette/Mail/autoload.php', ++ '/usr/share/php/Nette/RobotLoader/autoload.php', ++ '/usr/share/php/Nette/SafeStream/autoload.php', ++ '/usr/share/php/Latte/autoload.php', ++ '/usr/share/php/Tracy/autoload.php', ++ '/usr/share/php/FSHL/autoload.php', ++ '/usr/share/php/Kdyby/Events/autoload.php', ++)); + -+// Dependencies -+$fedoraClassLoader->addPrefix('Symfony\\Component\\', $vendor); -+$fedoraClassLoader->addPrefix('TokenReflection\\', $vendor); -+$fedoraClassLoader->addPrefix('Michelf\\', $vendor); -+ -+require_once $vendor . '/Nette/Application/autoload.php'; -+require_once $vendor . '/Nette/Bootstrap/autoload.php'; -+require_once $vendor . '/Nette/DI/autoload.php'; -+require_once $vendor . '/Nette/Neon/autoload.php'; -+require_once $vendor . '/Nette/Mail/autoload.php'; -+require_once $vendor . '/Nette/RobotLoader/autoload.php'; -+require_once $vendor . '/Nette/SafeStream/autoload.php'; -+require_once $vendor . '/Latte/autoload.php'; -+require_once $vendor . '/Tracy/autoload.php'; -+require_once $vendor . '/FSHL/autoload.php'; -+require_once $vendor . '/Kdyby/Events/autoload.php'; diff -up ./src/Configuration/ConfigurationOptionsResolver.php.rpm ./src/Configuration/ConfigurationOptionsResolver.php ---- ./src/Configuration/ConfigurationOptionsResolver.php.rpm 2015-10-30 13:44:43.000000000 +0100 -+++ ./src/Configuration/ConfigurationOptionsResolver.php 2015-11-03 08:06:32.481579194 +0100 +--- ./src/Configuration/ConfigurationOptionsResolver.php.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./src/Configuration/ConfigurationOptionsResolver.php 2017-05-16 09:15:18.038164473 +0200 @@ -231,10 +231,10 @@ class ConfigurationOptionsResolver private function getTemplateConfigPathFromTheme($theme) { @@ -73,8 +68,8 @@ diff -up ./src/Configuration/ConfigurationOptionsResolver.php.rpm ./src/Configur throw new ConfigurationException(CO::TEMPLATE_THEME . ' ' . $theme . ' is not supported.'); diff -up ./src/DI/ApiGenExtension.php.rpm ./src/DI/ApiGenExtension.php ---- ./src/DI/ApiGenExtension.php.rpm 2015-11-03 08:08:42.874167346 +0100 -+++ ./src/DI/ApiGenExtension.php 2015-11-03 08:09:24.816356528 +0100 +--- ./src/DI/ApiGenExtension.php.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./src/DI/ApiGenExtension.php 2017-05-16 09:15:18.038164473 +0200 @@ -61,10 +61,6 @@ class ApiGenExtension extends CompilerEx $application = $builder->getDefinition($builder->getByType('ApiGen\Console\Application')); @@ -87,8 +82,8 @@ diff -up ./src/DI/ApiGenExtension.php.rpm ./src/DI/ApiGenExtension.php } } diff -up ./src/DI/apigen.services.neon.rpm ./src/DI/apigen.services.neon ---- ./src/DI/apigen.services.neon.rpm 2015-11-03 08:08:48.525192830 +0100 -+++ ./src/DI/apigen.services.neon 2015-11-03 08:08:55.423223948 +0100 +--- ./src/DI/apigen.services.neon.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./src/DI/apigen.services.neon 2017-05-16 09:15:18.038164473 +0200 @@ -1,7 +1,6 @@ services: # commands @@ -98,8 +93,8 @@ diff -up ./src/DI/apigen.services.neon.rpm ./src/DI/apigen.services.neon # configuration - ApiGen\Configuration\Configuration diff -up ./src/Theme/ThemeConfigPathResolver.php.rpm ./src/Theme/ThemeConfigPathResolver.php ---- ./src/Theme/ThemeConfigPathResolver.php.rpm 2015-10-30 13:44:43.000000000 +0100 -+++ ./src/Theme/ThemeConfigPathResolver.php 2015-11-03 08:06:32.481579194 +0100 +--- ./src/Theme/ThemeConfigPathResolver.php.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./src/Theme/ThemeConfigPathResolver.php 2017-05-16 09:15:18.038164473 +0200 @@ -38,7 +38,7 @@ class ThemeConfigPathResolver { $allowedPaths = [ @@ -110,20 +105,16 @@ diff -up ./src/Theme/ThemeConfigPathResolver.php.rpm ./src/Theme/ThemeConfigPath foreach ($allowedPaths as $allowedPath) { diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php ---- ./tests/bootstrap.php.rpm 2015-10-30 13:44:43.000000000 +0100 -+++ ./tests/bootstrap.php 2015-11-03 08:10:14.113578889 +0100 -@@ -1,7 +1,13 @@ +--- ./tests/bootstrap.php.rpm 2017-05-11 14:38:12.000000000 +0200 ++++ ./tests/bootstrap.php 2017-05-16 09:23:26.130041699 +0200 +@@ -1,7 +1,9 @@ addPrefix("ApiGen\\Tests\\", __DIR__); -+$Loader->register(); -+ -+require_once $vendor . '/Mockery/autoload.php'; ++\Fedora\Autoloader\Autoload::addPsr4('ApiGen\\Tests\\', __DIR__); $tempDir = __DIR__ . '/temp/' . getmypid(); define('TEMP_DIR', $tempDir); diff --git a/apigen.spec b/apigen.spec index bbaf795..0198504 100644 --- a/apigen.spec +++ b/apigen.spec @@ -17,7 +17,7 @@ Name: %{c_project} Version: 4.1.2 -%global specrel 3 +%global specrel 4 Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} Summary: PHP source code API generator @@ -32,26 +32,40 @@ Source1: makesrc.sh # and drop Herrera dependencies (only used for phar selfupdate command) Patch0: %{name}-rpm.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) BuildRequires: php(language) >= 5.4 +BuildRequires: php-composer(nette/application) < 3 BuildRequires: php-composer(nette/application) >= 2.2 +BuildRequires: php-composer(nette/bootstrap) < 3 BuildRequires: php-composer(nette/bootstrap) >= 2.2 +BuildRequires: php-composer(nette/di) < 3 BuildRequires: php-composer(nette/di) >= 2.2 +BuildRequires: php-composer(nette/neon) < 3 BuildRequires: php-composer(nette/neon) >= 2.2 +BuildRequires: php-composer(nette/mail) < 3 BuildRequires: php-composer(nette/mail) >= 2.2 +BuildRequires: php-composer(nette/robot-loader) < 3 BuildRequires: php-composer(nette/robot-loader) >= 2.2 +BuildRequires: php-composer(nette/safe-stream) < 3 BuildRequires: php-composer(nette/safe-stream) >= 2.2 +BuildRequires: php-composer(latte/latte) < 3 BuildRequires: php-composer(latte/latte) >= 2.2 +BuildRequires: php-composer(tracy/tracy) < 3 BuildRequires: php-composer(tracy/tracy) >= 2.2 +BuildRequires: php-composer(kukulich/fshl) < 3 BuildRequires: php-composer(kukulich/fshl) >= 2.1 +BuildRequires: php-composer(andrewsville/php-token-reflection) < 2 BuildRequires: php-composer(andrewsville/php-token-reflection) >= 1.4 +BuildRequires: php-composer(michelf/php-markdown) < 2 BuildRequires: php-composer(michelf/php-markdown) >= 1.4 BuildRequires: php-composer(kdyby/events) >= 2.0 +BuildRequires: php-composer(symfony/options-resolver) < 3 BuildRequires: php-composer(symfony/options-resolver) >= 2.6.1 +BuildRequires: php-composer(symfony/console) < 3 BuildRequires: php-composer(symfony/console) >= 2.6 +BuildRequires: php-composer(symfony/yaml) < 3 BuildRequires: php-composer(symfony/yaml) >= 2.6 BuildRequires: php-composer(apigen/theme-default) >= 1.0.1 BuildRequires: php-composer(apigen/theme-bootstrap) >= 1.1.2 @@ -62,7 +76,7 @@ BuildRequires: php-spl BuildRequires: php-tokenizer BuildRequires: php-zip # Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) # from composer.json, "require-dev": { # "mockery/mockery": "~0.9", # "herrera-io/box": "~1.6" @@ -138,7 +152,7 @@ Requires: php-spl Requires: php-tokenizer Requires: php-zip # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # composer name Provides: php-composer(%{c_project}/%{c_project}) = %{version} @@ -172,7 +186,6 @@ fi %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{_datadir}/php cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor} @@ -185,23 +198,21 @@ rm tests/Templating/Filters/Helpers/LinkBuilderTest.php rm tests/DI/ApiGenExtensionTest.php sed -e 's:@BUILDROOT@:%{buildroot}:' -i tests/bootstrap.php -: Run test suite -%{_bindir}/phpunit --verbose -if which php70; then - php70 %{_bindir}/phpunit --verbose -fi +# PHP 7.2: PHP Fatal error: Exception in Nette\Bridges\ApplicationLatte\Template::__toString(): Unknown macro {}, did you mean {l}? in ... + +: Run test suite +for cmd in php php56 php70 php71; do + if which $cmd; then + $cmd %{_bindir}/phpunit --verbose + fi +done %else : Test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -211,6 +222,9 @@ rm -rf %{buildroot} %changelog +* Tue May 16 2017 Remi Collet - 4.1.2-4 +- switch to fedora/autoloader + * Thu Aug 4 2016 Remi Collet - 4.1.2-3 - ignore test failed because of deprecation messages - ignore kdyby/events max version diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..3a4e743 --- /dev/null +++ b/composer.json @@ -0,0 +1,60 @@ +{ + "name": "apigen/apigen", + "description": "PHP source code API generator", + "keywords": ["documentation", "phpdoc", "generator", "api"], + "homepage": "http://apigen.org/", + "license": "MIT", + "authors": [ + { "name": "Tomáš Votruba", "email": "tomas.vot@gmail.com" }, + { "name": "Olivier Laviale", "homepage": "https://github.com/olvlvl" }, + { "name": "Jaroslav Hanslík", "homepage": "https://github.com/kukulich" }, + { "name": "Ondřej Nešpor", "homepage": "https://github.com/andrewsville" }, + { "name": "David Grudl", "homepage": "http://davidgrudl.com" } + ], + "require": { + "php": ">=5.4", + "nette/application": "~2.2", + "nette/bootstrap": "~2.2", + "nette/di": "~2.2", + "nette/neon": "~2.2", + "nette/mail": "~2.2", + "nette/robot-loader": "~2.2", + "nette/safe-stream": "~2.2", + "latte/latte": ">=2.2.0,<2.3.5", + "tracy/tracy": "~2.2", + + "kukulich/fshl": "~2.1", + "andrewsville/php-token-reflection": "~1.4", + "michelf/php-markdown": "~1.4", + "kdyby/events": "~2.0", + "symfony/options-resolver": "~2.6.1", + "symfony/console": "~2.6", + "symfony/yaml": "~2.6", + "herrera-io/phar-update": "~2.0", + + "apigen/theme-default": "~1.0.1", + "apigen/theme-bootstrap": "~1.1.2" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "herrera-io/box": "~1.6" + }, + "autoload": { + "psr-4": { + "ApiGen\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "ApiGen\\Tests\\": "tests" + } + }, + "bin": [ + "bin/apigen" + ], + "extra": { + "branch-alias": { + "dev-master": "4.1.0-dev" + } + } +} -- cgit