summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-bartlett-umlwriter-rpm.patch89
-rw-r--r--php-bartlett-umlwriter.spec69
2 files changed, 150 insertions, 8 deletions
diff --git a/php-bartlett-umlwriter-rpm.patch b/php-bartlett-umlwriter-rpm.patch
new file mode 100644
index 0000000..5a09d6f
--- /dev/null
+++ b/php-bartlett-umlwriter-rpm.patch
@@ -0,0 +1,89 @@
+diff -up ./bin/umlwriter.rpm ./bin/umlwriter
+--- ./bin/umlwriter.rpm 2015-03-31 11:24:18.000000000 +0200
++++ ./bin/umlwriter 2015-03-31 11:29:43.000000000 +0200
+@@ -1,24 +1,36 @@
+-#!/usr/bin/env php
++#!/usr/bin/php
+ <?php
+ $appName = 'umlWriter';
+
+-if (\Phar::running()) {
+- $vendorDir = 'phar://' . strtolower($appName) . '.phar/vendor';
+-} else {
+- $baseDir = dirname(__DIR__);
+- $vendorDir = $baseDir . '/vendor';
+-
+- if (!file_exists($vendorDir . '/autoload.php')) {
+- $vendorDir = dirname(dirname($baseDir));
+- }
+-}
+-require_once $vendorDir . '/autoload.php';
++putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite');
+
+ if (PHP_SAPI !== 'cli') {
+ return;
+ }
+
++$vendorDir = '/usr/share/php';
++require_once $vendorDir . '/PhpParser/Autoloader.php';
++PhpParser\Autoloader::register();
++
++require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
++require_once $vendorDir . '/SebastianBergmann/Version/Version.php';
++
++use Symfony\Component\ClassLoader\UniversalClassLoader;
++
++$loader = new UniversalClassLoader();
++$loader->registerNamespaces(array(
++ 'Symfony\\Component' => $vendorDir,
++ 'Doctrine\\Common' => $vendorDir,
++ 'phpDocumentor\\Reflection' => $vendorDir,
++ 'Seld\\JsonLint' => $vendorDir,
++ 'JsonSchema' => $vendorDir,
++ 'Bartlett' => $vendorDir,
++ 'TokenReflection' => $vendorDir,
++));
++$loader->useIncludePath(true);
++$loader->register();
++
+ use Bartlett\UmlWriter\Console\Application;
+
+-$application = new Application($appName, '1.0');
++$application = new Application($appName, '@package_version@');
+ $application->run();
+diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
+--- ./tests/bootstrap.php.rpm 2015-03-31 09:46:46.000000000 +0200
++++ ./tests/bootstrap.php 2015-03-31 11:30:51.000000000 +0200
+@@ -1,6 +1,30 @@
+ <?php
+
+ $baseDir = dirname(__DIR__);
+-$vendorDir = $baseDir . '/vendor';
++$vendorDir = '/usr/share/php';
++putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite');
+
+-require_once $vendorDir . '/autoload.php';
++require_once $vendorDir . '/PhpParser/Autoloader.php';
++PhpParser\Autoloader::register();
++require_once $vendorDir . '/SebastianBergmann/Version/Version.php';
++require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
++
++use Symfony\Component\ClassLoader\UniversalClassLoader;
++
++$loader = new UniversalClassLoader();
++$loader->registerNamespaces(array(
++ 'Symfony\\Component' => $vendorDir,
++ 'Doctrine\\Common' => $vendorDir,
++ 'phpDocumentor\\Reflection' => $vendorDir,
++ 'Seld\\JsonLint' => $vendorDir,
++ 'JsonSchema' => $vendorDir,
++ 'Bartlett\\UmlWriter' => $baseDir . '/src',
++ 'Bartlett\\Tests\\UmlWriter' => $baseDir . '/tests',
++ 'Bartlett' => $vendorDir,
++ 'TokenReflection' => $vendorDir,
++));
++
++$loader->register();
++
++# Class not catched by autoloader
++require $vendorDir . '/Bartlett/Reflect.php';
diff --git a/php-bartlett-umlwriter.spec b/php-bartlett-umlwriter.spec
index bf7e229..d683511 100644
--- a/php-bartlett-umlwriter.spec
+++ b/php-bartlett-umlwriter.spec
@@ -6,16 +6,22 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit 0fe1c3a19280e4cd9f136ff3347ae9d0110758ca
+%global bootstrap 0
+%global gh_commit 48f1e73fd3716824830185342319e8217e87cc3e
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
#global gh_date 20150303
%global gh_owner llaville
%global gh_project umlwriter
-%global prever RC1
+%global prever RC2
+%if %{bootstrap}
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
+%else
+%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
+%endif
Name: php-bartlett-umlwriter
Version: 1.0.0
-%global specrel 1
+%global specrel 2
Release: %{?gh_short:0.%{specrel}.%{?gh_date:%{gh_date}git%{gh_short}}%{?prever}}%{!?gh_short:%{specrel}}%{?dist}
Summary: Create UML class diagrams from your PHP source
@@ -24,18 +30,42 @@ License: BSD
URL: http://php5.laurent-laville.org/umlwriter/
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{version}%{?prever}%{?gh_short:-%{gh_short}}.tar.gz
+# Autoloader for RPM - die composer !
+Patch0: %{name}-rpm.patch
+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
BuildRequires: php(language) >= 5.3.0
+%if %{with_tests}
+BuildRequires: %{_bindir}/phpunit
+BuildRequires: php-composer(symfony/console) >= 2.5
+BuildRequires: php-composer(sebastian/version) >= 1.0
+BuildRequires: php-composer(bartlett/php-reflect) >= 3.0
+BuildRequires: php-composer(andrewsville/php-token-reflection) >= 1.4
+%endif
# From composer.json
# "require": {
# "php": ">=5.3.0"
-# "suggest": {
-# "bartlett/php-reflect": "Reverse-engine compatible solution 1",
-# "andrewsville/php-token-reflection": "Reverse-engine compatible solution 2"
+# "symfony/console": "~2.5",
+# "sebastian/version": "~1.0"
Requires: php(language) >= 5.3.0
-# Notice, we do not require Reflect to avoid circular dependencies
+Requires: php-composer(symfony/console) >= 2.5
+Requires: php-composer(symfony/console) < 3
+Requires: php-composer(sebastian/version) >= 1.0
+Requires: php-composer(sebastian/version) < 2
+# "require-dev": {
+# "bartlett/php-reflect": "3.0.*@dev",
+# "andrewsville/php-token-reflection": "~1.4"
+# "suggest": {
+# "bartlett/php-reflect": "Reverse-engine, default solution",
+# "andrewsville/php-token-reflection": "Reverse-engine, alternative solution"
+Requires: php-composer(bartlett/php-reflect) >= 3.0
+Requires: php-composer(bartlett/php-reflect) < 4
+Requires: php-composer(andrewsville/php-token-reflection) >= 1.4
+Requires: php-composer(andrewsville/php-token-reflection) < 2
+# For our patch
+Requires: php-composer(symfony/class-loader)
Provides: php-composer(bartlett/umlwriter) = %{version}
@@ -56,8 +86,10 @@ interface and trait definitions in your PHP project.
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1 -b .rpm
+
sed -e 's/@package_version@/%{version}%{?prever}/' \
- -i $(find src -name \*.php)
+ -i $(find src -name \*.php) bin/umlwriter
%build
@@ -69,6 +101,16 @@ rm -rf %{buildroot}
mkdir -p %{buildroot}%{_datadir}/php
cp -pr src/Bartlett %{buildroot}%{_datadir}/php/Bartlett
+install -D -p -m 755 bin/umlwriter %{buildroot}%{_bindir}/umlwriter
+
+
+%check
+%if %{with_tests}
+%{_bindir}/phpunit -v || : Results ignored for now, known upstream issue #1
+%else
+: Test suite disabled
+%endif
+
%clean
rm -rf %{buildroot}
@@ -79,10 +121,21 @@ rm -rf %{buildroot}
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc composer.json README.* examples
+%{_bindir}/umlwriter
%dir %{_datadir}/php/Bartlett
%{_datadir}/php/Bartlett/UmlWriter
%changelog
+* Tue Mar 31 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.2.RC2
+- update to 1.0.0RC2
+- add umlwrite command
+- add dependencies on symfony/console, symfony/class-loader,
+ bartlett/php-reflect, sebastian/version
+ and andrewsville/php-token-reflection
+- run test suite during build, but ignore results for now
+- open https://github.com/llaville/umlwriter/issues/1 test suite issue
+- open https://github.com/llaville/umlwriter/issues/2 runtime issue
+
* Tue Mar 24 2015 Remi Collet <remi@fedoraproject.org> - 1.0.0-0.1.RC1
- Initial RPM package, version 1.0.0RC1 \ No newline at end of file