1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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';
|