From 7a7fc313351bc2298e84843a7865f1296cfc0c4b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 14 Apr 2016 18:01:28 +0200 Subject: php-phpdocumentor-reflection: 1.0.7 (new package, wip) --- LICENSE | 21 +++++ Makefile | 4 + composer.json | 31 +++++++ php-phpdocumentor-reflection.spec | 187 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 243 insertions(+) create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 composer.json create mode 100644 php-phpdocumentor-reflection.spec diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..792e404 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2010 Mike van Riel + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..91b0fd5 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +SRCDIR := $(shell pwd) +NAME := $(shell basename $(SRCDIR)) +include ../../common/Makefile + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..b716148 --- /dev/null +++ b/composer.json @@ -0,0 +1,31 @@ +{ + "name": "phpdocumentor/reflection", + "description": "Reflection library to do Static Analysis for PHP Projects", + "keywords": ["phpdoc", "phpDocumentor", "reflection", "static analysis"], + "homepage": "http://www.phpdoc.org", + "license": "MIT", + "autoload": { + "psr-0": { + "phpDocumentor": ["src/", "tests/unit/", "tests/mocks/"] + } + }, + "require": { + "php": ">=5.3.3", + "psr/log": "~1.0", + "nikic/php-parser": "~0.9.4", + "phpdocumentor/reflection-docblock": "~2.0" + }, + "suggests": { + "symfony/event-dispatcher": "~2.1" + }, + "require-dev": { + "behat/behat": "~2.4", + "phpunit/phpunit": "~4.0", + "mockery/mockery": "~0.8" + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/php-phpdocumentor-reflection.spec b/php-phpdocumentor-reflection.spec new file mode 100644 index 0000000..6dd20c7 --- /dev/null +++ b/php-phpdocumentor-reflection.spec @@ -0,0 +1,187 @@ +# spec file for php-phpdocumentor-reflection +# +# Copyright (c) 2016 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/4.0/ +# +# Please, preserve the changelog entries +# +%global gh_commit fc40c3f604ac2287eb5c314174d5109b2c699372 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) +%global gh_owner phpDocumentor +%global gh_project Reflection +%global with_tests 0%{!?_without_tests:1} + +%global with_php_parser 1 + +Name: php-phpdocumentor-reflection +Version: 1.0.7 +Release: 1%{?dist} +Summary: Reflection library to do Static Analysis for PHP Projects + +Group: Development/Libraries +License: MIT +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}.tar.gz + +%if %{with_php_parser} +# Temporary, bundled nikik/php-parser 0.9.4 +%global php_parser_owner nikic +%global php_parser_project PHP-Parser +%global php_parser_commit 1e5e280ae88a27effa2ae4aa2bd088494ed8594f +%global php_parser_version 0.9.4 +Source1: https://github.com/%{php_parser_owner}/%{php_parser_project}/archive/%{php_parser_commit}/%{php_parser_project}-%{php_parser_version}.tar.gz +Provides: bundled(nikik/php-parser) = %{php_parser_version} +%endif + +# Temporary, missing in old versions +Source2: https://raw.githubusercontent.com/phpDocumentor/Reflection/develop/LICENSE + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildArch: noarch +BuildRequires: php-theseer-autoload +# For tests +%if %{with_tests} +BuildRequires: php(language) >= 5.3.3 +BuildRequires: php-composer(psr/log) >= 1.0 +%if ! %{with_php_parser} +BuildRequires: php-composer(nikic/php-parser) >= 0.9.4 +%endif +BuildRequires: php-composer(phpdocumentor/reflection-docblock) >= 2.0 +# From composer.json, "require-dev": { +# "behat/behat": "~2.4", +# "phpunit/phpunit": "~4.0", +# "mockery/mockery": "~0.8" +BuildRequires: php-composer(phpunit/phpunit) >= 4.0 +BuildRequires: php-composer(mockery/mockery) >= 0.8 +%endif + +# From composer.json, require +# "php": ">=5.3.3", +# "psr/log": "~1.0", +# "nikic/php-parser": "~0.9.4", +# "phpdocumentor/reflection-docblock": "~2.0" +Requires: php(language) >= 5.3.3 +Requires: php-composer(psr/log) >= 1.0 +Requires: php-composer(psr/log) < 2 +%if ! %{with_php_parser} +Requires: php-composer(nikic/php-parser) >= 0.9.4 +Requires: php-composer(nikic/php-parser) < 0.10 +%endif +Requires: php-composer(phpdocumentor/reflection-docblock) >= 2.0 +Requires: php-composer(phpdocumentor/reflection-docblock) < 3 +# For autoloader +Requires: php-PsrLog >= 1.0.0-8 +# From phpcompatinfo report for 2.0.3 +Requires: php-pcre +Requires: php-spl + +Provides: php-composer(phpdocumentor/reflection) = %{version} + + +%description +Using this library it is possible to statically reflect one or more files +and create an object graph representing your application's structure, +including accompanying in-source documentation using DocBlocks. + +The information that this library provides is similar to what the (built-in) +Reflection extension of PHP provides; there are however several advantages +to using this library: + +* Due to its Static nature it does not execute procedural code in your + reflected files where Dynamic Reflection does. +* Because the none of the code is interpreted by PHP (and executed) + Static Reflection uses less memory. +* Can reflect complete files +* Can reflect a whole project by reflecting multiple files. +* Reflects the contents of a DocBlock instead of just mentioning there is one. +* Is capable of analyzing code written for any PHP version (starting at 5.2) + up to and including your installed PHP version. + +Features +* [Creates an object graph] containing the structure of your application much + like a site map shows the structure of a website. +* Can read and interpret code of any PHP version starting with 5.2 up to and + including your currently installed version of PHP. +* Due it's clean interface it can be in any application without a complex setup. + +Autoloader: %{_datadir}/php/phpDocumentor/Reflection/autoload.php + + +%prep +%setup -q -n %{gh_project}-%{gh_commit} -a 1 + +%if %{with_php_parser} +# Include PHPParser in this library, as old deprecated version required +mv %{php_parser_project}-%{php_parser_commit}/lib/PHPParser \ + src/phpDocumentor/Reflection/PHPParser +%endif + +cp %{SOURCE2} LICENSE + + +%build +: Generate library autoloader +%{_bindir}/phpab \ + --output src/phpDocumentor/Reflection/autoload.php \ + src/phpDocumentor/Reflection + +cat << 'EOF' | tee -a src/phpDocumentor/Reflection/autoload.php +// Dependencies +require_once '%{_datadir}/php/Psr/Log/autoload.php'; +require_once '%{_datadir}/php/phpDocumentor/Reflection/DocBlock/autoload.php'; +%if ! %{with_php_parser} +require_once '%{_datadir}/php/PhpParser/autoload.php'; +%endif +EOF + + +%install +rm -rf %{buildroot} +mkdir -p %{buildroot}%{_datadir}/php +cp -pr src/* %{buildroot}%{_datadir}/php + + +%check +%if %{with_tests} +: Fix path to Mockery +sed -e 's:vendor/mockery/mockery/library:/usr/share/php:' \ + phpunit.xml.dist > phpunit.xml + +: Create tests autoloader +mkdir vendor +%{_bindir}/phpab --output vendor/autoload.php tests + +cat << 'EOF' | tee -a vendor/autoload.php +require_once '%{_datadir}/php/Mockery/autoload.php'; +require_once '%{buildroot}%{_datadir}/php/phpDocumentor/Reflection/autoload.php'; +EOF + +%{_bindir}/phpunit --verbose + +if which php70; then + php70 %{_bindir}/phpunit --verbose +fi +%else +: Test suite disabled +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc *.md +%doc composer.json +%{_datadir}/php/phpDocumentor/Reflection/* + + +%changelog +* Thu Apr 14 2016 Remi Collet - 1.0.7-1 +- initial package, version 1.0.7 +- bundle nikik/php-parser 0.9.4 + -- cgit