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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist
--- ./bin/phpreflect.json.dist.rpm 2015-04-04 15:15:47.860245093 +0200
+++ ./bin/phpreflect.json.dist 2015-04-04 15:16:37.420443972 +0200
@@ -6,6 +6,19 @@
}
],
"plugins": [
+ {
+ "name": "Cache",
+ "class": "Bartlett\\Reflect\\Plugin\\CachePlugin",
+ "options": {
+ "adapter": "DoctrineCacheAdapter",
+ "backend": {
+ "class": "Doctrine\\Common\\Cache\\FilesystemCache",
+ "args": [
+ "%{HOME}/.cache/php-reflect"
+ ]
+ }
+ }
+ }
],
"analysers": [
],
diff -up ./bin/phpreflect.rpm ./bin/phpreflect
--- ./bin/phpreflect.rpm 2015-04-03 08:47:14.000000000 +0200
+++ ./bin/phpreflect 2015-04-04 15:21:07.510527397 +0200
@@ -1,23 +1,39 @@
-#!/usr/bin/env php
+#!/usr/bin/php
<?php
$appName = 'phpReflect';
if (\Phar::running()) {
$vendorDir = 'phar://' . strtolower($appName) . '.phar/vendor';
} else {
- $baseDir = dirname(__DIR__);
- $vendorDir = $baseDir . '/vendor';
+ putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite');
- if (!file_exists($vendorDir . '/autoload.php')) {
- $vendorDir = dirname(dirname($baseDir));
- }
+ $vendorDir = '/usr/share/php';
if (!getenv("BARTLETTRC")) {
putenv("BARTLETTRC=" . strtolower($appName) . '.json');
}
}
-$loader = require_once $vendorDir . '/autoload.php';
-$loader->setUseIncludePath(true);
+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,
+ 'Psr\\Log' => $vendorDir,
+ 'Monolog' => $vendorDir,
+ 'Bartlett' => $vendorDir,
+));
+$loader->useIncludePath(true);
+$loader->register();
if (PHP_SAPI !== 'cli') {
return;
@@ -28,5 +44,5 @@ use Bartlett\Reflect\Console\Application
Environment::setScanDir();
-$application = new Application($appName, '3.0');
+$application = new Application($appName, '@package_version@');
$application->run();
diff -up ./src/Bartlett/Reflect/Console/Application.php.rpm ./src/Bartlett/Reflect/Console/Application.php
--- ./src/Bartlett/Reflect/Console/Application.php.rpm 2015-04-03 08:47:14.000000000 +0200
+++ ./src/Bartlett/Reflect/Console/Application.php 2015-04-04 15:15:24.203150166 +0200
@@ -82,7 +82,7 @@ class Application extends BaseApplicatio
$jsonFile = './' . getenv("BARTLETTRC");
}
- parent::__construct($appName, '@package_version@');
+ parent::__construct($appName, $appVersion);
$this->release = $appVersion;
$defaultAnalyser = (strcasecmp($appName, 'phpcompatinfo') === 0)
diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
--- ./tests/bootstrap.php.rpm 2015-04-03 08:47:14.000000000 +0200
+++ ./tests/bootstrap.php 2015-04-04 15:15:24.203150166 +0200
@@ -1,11 +1,9 @@
<?php
$baseDir = dirname(__DIR__);
-$vendorDir = $baseDir . '/vendor';
+$vendorDir = '/usr/share/php';
-$loader = require_once $vendorDir . '/autoload.php';
-$loader->addClassMap(
- array(
+$tab = array(
'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
=> __DIR__ . '/Analyser/FooAnalyser.php',
'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
@@ -14,5 +12,24 @@ $loader->addClassMap(
=> __DIR__ . '/Model/GenericModelTest.php',
'Bartlett\Tests\Reflect\Environment\YourLogger'
=> __DIR__ . '/Environment/YourLogger.php',
- )
);
+require_once $vendorDir . '/PhpParser/Autoloader.php';
+PhpParser\Autoloader::register();
+
+require_once $vendorDir . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
+
+use Symfony\Component\ClassLoader\UniversalClassLoader;
+
+$loader = new UniversalClassLoader();
+$loader->registerNamespaces(array(
+ 'Bartlett\\Tests\\Reflect' => $baseDir . '/tests',
+ 'Bartlett\\UmlWriter' => $vendorDir,
+ 'Bartlett' => $baseDir . '/src',
+ 'Monolog' => $vendorDir,
+));
+$loader->useIncludePath(true);
+$loader->register();
+
+foreach ($tab as $class => $file) {
+ require_once $file;
+}
diff -up ./tests/Environment/YourLogger.php.rpm ./tests/Environment/YourLogger.php
--- ./tests/Environment/YourLogger.php.rpm 2015-04-03 08:47:14.000000000 +0200
+++ ./tests/Environment/YourLogger.php 2015-04-04 15:15:24.203150166 +0200
@@ -14,6 +14,7 @@ class YourLogger extends Logger
if (!file_exists($tempDir)) {
mkdir($tempDir, 0755, true);
}
+ date_default_timezone_set('UTC');
$filename = sprintf('phpreflect-%s.log', date('Ymd'));
$stream = new RotatingFileHandler("$tempDir/$filename", 30);
|