@fleetbase/registry-bridge-engine 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
namespace Fleetbase\RegistryBridge\Console\Commands;
|
|
4
4
|
|
|
5
|
-
use Fleetbase\RegistryBridge\
|
|
5
|
+
use Fleetbase\RegistryBridge\Support\Utils;
|
|
6
6
|
use Illuminate\Console\Command;
|
|
7
7
|
|
|
8
8
|
class Initialize extends Command
|
|
@@ -28,7 +28,7 @@ class Initialize extends Command
|
|
|
28
28
|
*/
|
|
29
29
|
public function handle()
|
|
30
30
|
{
|
|
31
|
-
|
|
31
|
+
Utils::bootRegistryAuth(true);
|
|
32
32
|
|
|
33
33
|
return 0;
|
|
34
34
|
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Fleetbase\RegistryBridge\Console\Commands;
|
|
4
|
-
|
|
5
|
-
use Fleetbase\RegistryBridge\Models\RegistryExtension;
|
|
6
|
-
use Illuminate\Console\Command;
|
|
7
|
-
use Symfony\Component\Process\Exception\ProcessFailedException;
|
|
8
|
-
use Symfony\Component\Process\Process;
|
|
9
|
-
|
|
10
|
-
class PostInstallExtension extends Command
|
|
11
|
-
{
|
|
12
|
-
/**
|
|
13
|
-
* The name and signature of the console command.
|
|
14
|
-
*
|
|
15
|
-
* @var string
|
|
16
|
-
*/
|
|
17
|
-
protected $signature = 'registry:post-install {extensionId}';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The console command description.
|
|
21
|
-
*
|
|
22
|
-
* @var string
|
|
23
|
-
*/
|
|
24
|
-
protected $description = 'Post install an extension by running necessary commands';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Execute the console command.
|
|
28
|
-
*
|
|
29
|
-
* @return int
|
|
30
|
-
*/
|
|
31
|
-
public function handle()
|
|
32
|
-
{
|
|
33
|
-
$extensionId = $this->argument('extensionId');
|
|
34
|
-
$extension = RegistryExtension::disableCache()->where('public_id', $extensionId)->first();
|
|
35
|
-
|
|
36
|
-
if ($extension) {
|
|
37
|
-
$this->postInstallExtension($extension);
|
|
38
|
-
$this->info('Post install commands executed successfully.');
|
|
39
|
-
} else {
|
|
40
|
-
$this->error('Extension not found.');
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Post install extension commands.
|
|
48
|
-
*/
|
|
49
|
-
public function postInstallExtension(RegistryExtension $extension): void
|
|
50
|
-
{
|
|
51
|
-
if (isset($extension->currentBundle)) {
|
|
52
|
-
$composerJson = $extension->currentBundle->meta['composer.json'];
|
|
53
|
-
if ($composerJson) {
|
|
54
|
-
$extensionPath = base_path('vendor/' . $composerJson['name']);
|
|
55
|
-
|
|
56
|
-
$commands = [
|
|
57
|
-
'rm -rf /fleetbase/.pnpm-store',
|
|
58
|
-
'rm -rf node_modules',
|
|
59
|
-
'pnpm install',
|
|
60
|
-
'pnpm build',
|
|
61
|
-
];
|
|
62
|
-
|
|
63
|
-
$this->info('Running post install for: ' . $extension->name);
|
|
64
|
-
$this->info('Extension install path: ' . $extensionPath);
|
|
65
|
-
foreach ($commands as $command) {
|
|
66
|
-
$this->info('Running extension post install command: `' . $command . '`');
|
|
67
|
-
$process = Process::fromShellCommandline($command, $extensionPath);
|
|
68
|
-
$process->run(function ($type, $buffer) {
|
|
69
|
-
if (Process::ERR === $type) {
|
|
70
|
-
$this->error($buffer);
|
|
71
|
-
} else {
|
|
72
|
-
$this->info($buffer);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
// Check if the process was successful
|
|
77
|
-
if (!$process->isSuccessful()) {
|
|
78
|
-
throw new ProcessFailedException($process);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|