summaryrefslogtreecommitdiffstats
path: root/php-bartlett-PHP-Reflect-rpm.patch
blob: fd17d4c9127c8744833c8df5e97d42e126177313 (plain)
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
diff -up ./bin/phpreflect.json.dist.rpm ./bin/phpreflect.json.dist
--- ./bin/phpreflect.json.dist.rpm	2019-04-07 17:37:00.000000000 +0200
+++ ./bin/phpreflect.json.dist	2019-04-09 14:47:07.638174748 +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	2019-04-09 14:47:07.639174753 +0200
+++ ./bin/phpreflect	2019-04-09 14:53:18.251134771 +0200
@@ -6,28 +6,12 @@ declare(strict_types=1);
 
 gc_disable(); // performance boost
 
-$possibleAutoloadPaths = [
-    // local dev repository
-    __DIR__ . '/../vendor/autoload.php',
-    // dependency
-    __DIR__ . '/../../../../vendor/autoload.php',
-];
+$vendorDir = '/usr/share/php';
+if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) {
+    putenv('BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite');
+ }
 
-$isAutoloadFound = false;
-foreach ($possibleAutoloadPaths as $possibleAutoloadPath) {
-    if (file_exists($possibleAutoloadPath)) {
-        require_once $possibleAutoloadPath;
-        $isAutoloadFound = true;
-        break;
-    }
-}
-
-if ($isAutoloadFound === false) {
-    throw new RuntimeException(sprintf(
-        'Unable to find "vendor/autoload.php" in "%s" paths.',
-        implode('", "', $possibleAutoloadPaths)
-    ));
-}
+require_once $vendorDir . '/Bartlett/Reflect/autoload.php';
 
 $application = new \Bartlett\Reflect\Presentation\Console\Application('phpReflect');
 $application->run();
diff -up ./src/Reflect/Presentation/Console/Application.php.rpm ./src/Reflect/Presentation/Console/Application.php
--- ./src/Reflect/Presentation/Console/Application.php.rpm	2019-04-09 14:51:38.632607939 +0200
+++ ./src/Reflect/Presentation/Console/Application.php	2019-04-09 14:52:25.779857292 +0200
@@ -82,12 +82,7 @@ class Application extends \Symfony\Compo
 
     public function __construct(string $name = 'UNKNOWN')
     {
-        try {
-            $version = \Jean85\PrettyVersions::getVersion('bartlett/php-reflect')->getPrettyVersion();
-        } catch (\OutOfBoundsException $e) {
-            $version = 'UNKNOWN';
-        }
-        parent::__construct($name, $version);
+        parent::__construct($name, @VERSION@);
 
         $this->baseDir = dirname(dirname(dirname(dirname(__DIR__))));
     }
diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php
--- ./tests/bootstrap.php.rpm	2019-04-07 17:37:00.000000000 +0200
+++ ./tests/bootstrap.php	2019-04-09 14:47:07.639174753 +0200
@@ -1,11 +1,10 @@
 <?php
 
 $baseDir   = dirname(__DIR__);
-$vendorDir = $baseDir . '/vendor';
+$vendorDir = '/usr/share/php';
 
-$loader = require_once $vendorDir . '/autoload.php';
-$loader->addClassMap(
-    array(
+require_once '@BUILDROOT@/usr/share/php/Bartlett/Reflect/autoload.php';
+$tab = array(
         'Bartlett\Tests\Reflect\Analyser\FooAnalyser'
             => __DIR__ . '/Analyser/FooAnalyser.php',
         'Bartlett\Tests\Reflect\Analyser\BarAnalyser'
@@ -14,5 +13,13 @@ $loader->addClassMap(
             => __DIR__ . '/Model/GenericModelTest.php',
         'Bartlett\Tests\Reflect\Environment\YourLogger'
             => __DIR__ . '/Environment/YourLogger.php',
-    )
 );
+
+\Fedora\Autoloader\Autoload::addClassMap($tab, '/');
+\Fedora\Autoloader\Autoload::addPsr4('Bartlett\\Tests\\Reflect', $baseDir . '/tests');
+
+// Needed when installed for 'Bartlett\CompatInfo\Analyser\CompatibilityAnalyser'
+if (is_file('/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite')) {
+   putenv("BARTLETT_COMPATINFO_DB=/usr/share/php-bartlett-PHP-CompatInfo/compatinfo.sqlite");
+}
+