From 109b620114e170b33263e63a78bc7808f06f58ca Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 1 Nov 2015 10:44:42 +0100 Subject: apigen: 4.1.1 - New pakckage --- Makefile | 4 ++ apigen-rpm.patch | 106 +++++++++++++++++++++++++++++ apigen.spec | 198 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ makesrc.sh | 28 ++++++++ 4 files changed, 336 insertions(+) create mode 100644 Makefile create mode 100644 apigen-rpm.patch create mode 100644 apigen.spec create mode 100755 makesrc.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..13af741 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../../common/Makefile + diff --git a/apigen-rpm.patch b/apigen-rpm.patch new file mode 100644 index 0000000..41a082c --- /dev/null +++ b/apigen-rpm.patch @@ -0,0 +1,106 @@ +diff -ruN ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/bin/apigen ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/bin/apigen +--- ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/bin/apigen 2015-10-30 13:44:43.000000000 +0100 ++++ ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/bin/apigen 2015-11-01 10:01:25.000000000 +0100 +@@ -1,7 +1,7 @@ + #!/usr/bin/env php + setDebugMode( ! Tracy\Debugger::$productionMode); + $configurator->setTempDirectory($tempDir); +-$configurator->addConfig(__DIR__ . '/../src/DI/config.neon'); +-$configurator->addParameters(['rootDir' => __DIR__ . '/..']); ++$configurator->addConfig('/usr/share/php/ApiGen/DI/config.neon'); ++$configurator->addParameters(['rootDir' => '/usr/share/php/ApiGen']); + $container = $configurator->createContainer(); + + +diff -ruN ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/autoload.php ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/autoload.php +--- ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/autoload.php 1970-01-01 01:00:00.000000000 +0100 ++++ ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/autoload.php 2015-11-01 09:32:57.000000000 +0100 +@@ -0,0 +1,32 @@ ++register(); ++} ++ ++$fedoraClassLoader->addPrefix('ApiGen\\', dirname(__DIR__)); ++ ++// 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'; ++require_once $vendor . '/Herrera/Phar/Update/autoload.php'; +diff -ruN ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/Configuration/ConfigurationOptionsResolver.php ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/Configuration/ConfigurationOptionsResolver.php +--- ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/Configuration/ConfigurationOptionsResolver.php 2015-10-30 13:44:43.000000000 +0100 ++++ ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/Configuration/ConfigurationOptionsResolver.php 2015-11-01 09:45:20.000000000 +0100 +@@ -231,10 +231,10 @@ + private function getTemplateConfigPathFromTheme($theme) + { + if ($theme === self::TEMPLATE_THEME_DEFAULT) { +- return $this->themeConfigPathResolver->resolve('/vendor/apigen/theme-default/src/config.neon'); ++ return $this->themeConfigPathResolver->resolve('/themes/theme-default/config.neon'); + + } elseif ($theme === self::TEMPLATE_THEME_BOOTSTRAP) { +- return $this->themeConfigPathResolver->resolve('/vendor/apigen/theme-bootstrap/src/config.neon'); ++ return $this->themeConfigPathResolver->resolve('/themes/theme-bootstrap/config.neon'); + } + + throw new ConfigurationException(CO::TEMPLATE_THEME . ' ' . $theme . ' is not supported.'); +diff -ruN ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/Theme/ThemeConfigPathResolver.php ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/Theme/ThemeConfigPathResolver.php +--- ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/src/Theme/ThemeConfigPathResolver.php 2015-10-30 13:44:43.000000000 +0100 ++++ ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/src/Theme/ThemeConfigPathResolver.php 2015-11-01 10:02:31.000000000 +0100 +@@ -38,7 +38,7 @@ + { + $allowedPaths = [ + $this->rootDir, +- $this->rootDir . '/../../..' ++ '/usr/share/apigen' + ]; + + foreach ($allowedPaths as $allowedPath) { +diff -ruN ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/tests/bootstrap.php ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/tests/bootstrap.php +--- ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5-old/tests/bootstrap.php 2015-10-30 13:44:43.000000000 +0100 ++++ ApiGen-e9aff53d56d2b74104dee2b88396eb614e9717d5/tests/bootstrap.php 2015-11-01 09:49:31.000000000 +0100 +@@ -1,7 +1,14 @@ + addPrefix("ApiGen\\Tests\\", __DIR__); ++$Loader->register(); ++ ++require_once $vendor . '/Mockery/autoload.php'; ++require_once $vendor . '/Herrera/Box/autoload.php'; + + $tempDir = __DIR__ . '/temp/' . getmypid(); + define('TEMP_DIR', $tempDir); diff --git a/apigen.spec b/apigen.spec new file mode 100644 index 0000000..f86ceac --- /dev/null +++ b/apigen.spec @@ -0,0 +1,198 @@ +# remirepo/fedora spec file for apigen +# +# Copyright (c) 2015 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global gh_commit e9aff53d56d2b74104dee2b88396eb614e9717d5 +#global gh_date 20150728 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner ApiGen +%global gh_project ApiGen +%global ns_vendor ApiGen +%global c_project apigen +%global with_tests 0%{!?_without_tests:1} + +Name: %{c_project} +Version: 4.1.1 +%global specrel 1 +Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} +Summary: PHP source code API generator + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: %{name}-%{version}-%{gh_short}.tgz +# pull a git snapshot to get test sutie +Source1: makesrc.sh + +# Use RPM autoloader +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) >= 2.2 +BuildRequires: php-composer(nette/bootstrap) >= 2.2 +BuildRequires: php-composer(nette/di) >= 2.2 +BuildRequires: php-composer(nette/neon) >= 2.2 +BuildRequires: php-composer(nette/mail) >= 2.2 +BuildRequires: php-composer(nette/robot-loader) >= 2.2 +BuildRequires: php-composer(nette/safe-stream) >= 2.2 +BuildRequires: php-composer(latte/latte) >= 2.2 +BuildRequires: php-composer(tracy/tracy) >= 2.2 +BuildRequires: php-composer(kukulich/fshl) >= 2.1 +BuildRequires: php-composer(andrewsville/php-token-reflection) >= 1.4 +BuildRequires: php-composer(michelf/php-markdown) >= 1.4 +BuildRequires: php-composer(kdyby/events) >= 2.0 +BuildRequires: php-composer(symfony/options-resolver) >= 2.6.1 +BuildRequires: php-composer(symfony/console) >= 2.6 +BuildRequires: php-composer(symfony/yaml) >= 2.3 +BuildRequires: php-composer(herrera-io/phar-update) >= 2.0 +BuildRequires: php-composer(apigen/theme-default) >= 1.0.1 +BuildRequires: php-composer(apigen/theme-bootstrap) >= 1.1.2 +BuildRequires: php-iconv +BuildRequires: php-mbstring +BuildRequires: php-pcre +BuildRequires: php-spl +BuildRequires: php-tokenizer +BuildRequires: php-zip +# Autoloader +BuildRequires: php-composer(symfony/class-loader) +# from composer.json, "require-dev": { +# "mockery/mockery": "~0.9", +# "herrera-io/box": "~1.6" +# mockery 0.9.3 for autoloader +BuildRequires: php-composer(mockery/mockery) >= 0.9.3 +BuildRequires: php-composer(herrera-io/box) >= 1.6 +%endif + +# from composer.json, "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", +# "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" +Requires: php(language) >= 5.4 +Requires: php-composer(nette/application) >= 2.2 +Requires: php-composer(nette/application) < 3 +Requires: php-composer(nette/bootstrap) >= 2.2 +Requires: php-composer(nette/bootstrap) < 3 +Requires: php-composer(nette/di) >= 2.2 +Requires: php-composer(nette/di) < 3 +Requires: php-composer(nette/neon) >= 2.2 +Requires: php-composer(nette/neon) < 3 +Requires: php-composer(nette/mail) >= 2.2 +Requires: php-composer(nette/mail) < 3 +Requires: php-composer(nette/robot-loader) >= 2.2 +Requires: php-composer(nette/robot-loader) < 3 +Requires: php-composer(nette/safe-stream) >= 2.2 +Requires: php-composer(nette/safe-stream) < 3 +Requires: php-composer(latte/latte) >= 2.2 +Requires: php-composer(latte/latte) < 3 +Requires: php-composer(tracy/tracy) >= 2.2 +Requires: php-composer(tracy/tracy) < 3 +Requires: php-composer(kukulich/fshl) >= 2.1 +Requires: php-composer(kukulich/fshl) < 3 +Requires: php-composer(andrewsville/php-token-reflection) >= 1.4 +Requires: php-composer(andrewsville/php-token-reflection) < 2 +Requires: php-composer(michelf/php-markdown) >= 1.4 +Requires: php-composer(michelf/php-markdown) < 2 +Requires: php-composer(kdyby/events) >= 2.0 +Requires: php-composer(kdyby/events) < 3 +Requires: php-composer(symfony/options-resolver) >= 2.6.1 +Requires: php-composer(symfony/options-resolver) < 3 +Requires: php-composer(symfony/console) >= 2.6 +Requires: php-composer(symfony/console) < 3 +Requires: php-composer(symfony/yaml) >= 2.3 +Requires: php-composer(symfony/yaml) < 3 +Requires: php-composer(herrera-io/phar-update) >= 2.0 +Requires: php-composer(herrera-io/phar-update) < 3 +Requires: php-composer(apigen/theme-default) >= 1.0.1 +Requires: php-composer(apigen/theme-default) < 1.1 +Requires: php-composer(apigen/theme-bootstrap) >= 1.1.2 +Requires: php-composer(apigen/theme-bootstrap) < 1.2 +# from phpcompatinfo report for version 4.1.1 +Requires: php-iconv +Requires: php-mbstring +Requires: php-pcre +Requires: php-spl +Requires: php-tokenizer +Requires: php-zip +# Autoloader +Requires: php-composer(symfony/class-loader) + +# provides latte/latte +Provides: php-composer(%{c_project}/%{c_project}) = %{version} + + +%description +Smart and Readable Documentation for your PHP project. + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} + +%patch0 -p1 + + +%build +# Nothing + + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_datadir}/%{name}/themes +mkdir -p %{buildroot}%{_datadir}/php +cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor} + +install -Dpm 755 bin/%{name} %{buildroot}%{_bindir}/%{name} + +%check +%if %{with_tests} +sed -e 's:@BUILDROOT@:%{buildroot}:' -i tests/bootstrap.php +: Run test suite +%{_bindir}/phpunit --verbose +%else +: Test suite disabled +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{_bindir}/%{name} +%{_datadir}/php/%{ns_vendor} +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/themes + + +%changelog +* Sun Nov 1 2015 Remi Collet - 4.1.1-1 +- initial package \ No newline at end of file diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..e9a1ec5 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer-$VERSION.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." -- cgit