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
|
diff -up ./bin/compatinfo-db.rpm ./bin/compatinfo-db
--- ./bin/compatinfo-db.rpm 2021-11-22 15:36:00.058660775 +0100
+++ ./bin/compatinfo-db 2021-11-22 15:37:05.390347473 +0100
@@ -4,7 +4,7 @@
gc_disable(); // performance boost
-require_once dirname(__DIR__) . '/config/bootstrap.php';
+require_once '/usr/share/php/Bartlett/CompatInfoDb/config/bootstrap.php';
use Bartlett\CompatInfoDb\Infrastructure\Framework\Symfony\DependencyInjection\ContainerFactory;
use Bartlett\CompatInfoDb\Presentation\Console\ApplicationInterface;
diff -up ./cli-config.php.rpm ./cli-config.php
diff -up ./config/bootstrap.php.rpm ./config/bootstrap.php
--- ./config/bootstrap.php.rpm 2021-11-22 10:58:42.000000000 +0100
+++ ./config/bootstrap.php 2021-11-22 15:36:00.058660775 +0100
@@ -6,6 +6,8 @@ if (\Phar::running()) {
];
} else {
$possibleAutoloadPaths = [
+ // RPM
+ __DIR__ . '/../autoload.php',
// local dev repository
__DIR__ . '/../vendor/autoload.php',
// dependency
diff -up ./config/set/default.php.rpm ./config/set/default.php
--- ./config/set/default.php.rpm 2021-11-22 10:58:42.000000000 +0100
+++ ./config/set/default.php 2021-11-22 15:36:00.058660775 +0100
@@ -72,7 +72,10 @@ return static function (ContainerConfigu
;
}
- $services->load('Bartlett\CompatInfoDb\\', __DIR__ . '/../../src');
+ $services->load('Bartlett\CompatInfoDb\\Application\\', __DIR__ . '/../../Application');
+ $services->load('Bartlett\CompatInfoDb\\Domain\\', __DIR__ . '/../../Domain');
+ $services->load('Bartlett\CompatInfoDb\\Infrastructure\\', __DIR__ . '/../../Infrastructure');
+ $services->load('Bartlett\CompatInfoDb\\Presentation\\', __DIR__ . '/../../Presentation');
$services->set(JsonFileHandler::class);
$services->set(VersionParser::class);
@@ -90,7 +93,7 @@ return static function (ContainerConfigu
$dbUrl = getenv('DATABASE_URL');
if (false === $dbUrl) {
- $dbUrl = 'sqlite:///${HOME}/.cache/bartlett/compatinfo-db.sqlite';
+ $dbUrl = 'sqlite:////usr/share/php-bartlett-php-compatinfo-db/compatinfo.sqlite';
putenv('DATABASE_URL=' . $dbUrl);
}
$connectionParams = ['url' => $dbUrl];
diff -up ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php
--- ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php.rpm 2021-11-22 15:39:04.750774992 +0100
+++ ./src/Infrastructure/Framework/Symfony/DependencyInjection/ContainerFactory.php 2021-11-22 15:44:27.715248779 +0100
@@ -23,7 +23,7 @@ class ContainerFactory
$containerBuilder = new ContainerBuilder();
$containerBuilder->addCompilerPass(new MessengerPass());
- $loader = new PhpFileLoader($containerBuilder, new FileLocator(dirname(__DIR__, 5) . '/config/set'));
+ $loader = new PhpFileLoader($containerBuilder, new FileLocator(dirname(__DIR__, 4) . '/config/set'));
$loader->load($set . '.php');
$containerBuilder->compile();
return $containerBuilder;
diff -up ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.rpm ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php
--- ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php.rpm 2021-11-22 10:58:42.000000000 +0100
+++ ./src/Infrastructure/Persistence/Doctrine/EntityManagerFactory.php 2021-11-22 15:36:00.058660775 +0100
@@ -31,6 +31,9 @@ final class EntityManagerFactory
public static function create(array $connection, bool $isDevMode, string $proxyDir, ?Cache $cache = null): EntityManagerInterface
{
$paths = [implode(DIRECTORY_SEPARATOR, [__DIR__, 'Entity'])];
+ // Static files in RPM mode
+ $isDevMode = false;
+ $proxyDir = dirname(__DIR__, 3) . '/proxies';
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode, $proxyDir, $cache);
if ($isDevMode) {
// suggested for DEV mode: see Doctrine ORM documentation
@@ -38,7 +41,7 @@ final class EntityManagerFactory
$config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_ALWAYS);
} else {
// lazy generation on PROD or TEST modes (i.e: CI)
- $config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS);
+ $config->setAutogenerateProxyClasses(AbstractProxyFactory::AUTOGENERATE_NEVER);
}
return EntityManager::create(self::connection($connection), $config);
diff -up ./src/Presentation/Console/Application.php.rpm ./src/Presentation/Console/Application.php
--- ./src/Presentation/Console/Application.php.rpm 2021-11-22 10:58:42.000000000 +0100
+++ ./src/Presentation/Console/Application.php 2021-11-22 15:36:00.058660775 +0100
@@ -14,8 +14,6 @@
namespace Bartlett\CompatInfoDb\Presentation\Console;
-use PackageVersions\Versions;
-
use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Application as SymfonyApplication;
@@ -53,20 +51,7 @@ class Application extends SymfonyApplica
*/
public function __construct(string $version = 'UNKNOWN')
{
- if ('UNKNOWN' === $version) {
- // composer or git outside world strategy
- $version = self::VERSION;
- } elseif (substr_count($version, '.') === 2) {
- // release is in X.Y.Z format
- } else {
- // composer or git strategy
- $version = Versions::getVersion('bartlett/php-compatinfo-db');
- list($ver, ) = explode('@', $version);
-
- if (strpos($ver, 'dev') === false) {
- $version = $ver;
- }
- }
+ $version = self::VERSION;
parent::__construct(self::NAME, $version);
}
diff -up ./cli-config.php.rpm ./cli-config.php
--- ./cli-config.php.rpm 2021-11-22 15:48:52.261030390 +0100
+++ ./cli-config.php 2021-11-22 15:48:54.913018175 +0100
@@ -5,7 +5,7 @@ use Bartlett\CompatInfoDb\Infrastructure
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
-require_once __DIR__ . '/config/bootstrap.php';
+require_once __DIR__ . '/src/config/bootstrap.php';
$container = (new ContainerFactory())->create();
|