From 06b5eef23467eb332eb7da40a89c90195a0a25ab Mon Sep 17 00:00:00 2001 From: "Ronald A. Richardson" Date: Fri, 19 Jul 2024 18:52:58 +0800 Subject: [PATCH] fixed init command --- composer.json | 2 +- extension.json | 2 +- package.json | 2 +- server/src/Console/Commands/Initialize.php | 4 +- .../Console/Commands/PostInstallExtension.php | 84 ------------------- .../RegistryBridgeServiceProvider.php | 1 - 6 files changed, 5 insertions(+), 90 deletions(-) delete mode 100644 server/src/Console/Commands/PostInstallExtension.php diff --git a/composer.json b/composer.json index e866be6..e138de2 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "fleetbase/registry-bridge", - "version": "0.0.6", + "version": "0.0.7", "description": "Internal Bridge between Fleetbase API and Extensions Registry", "keywords": [ "fleetbase-extension", diff --git a/extension.json b/extension.json index 124f2e4..03c64c5 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Registry Bridge", - "version": "0.0.6", + "version": "0.0.7", "description": "Internal Bridge between Fleetbase API and Extensions Registry", "repository": "https://github.com/fleetbase/registry-bridge", "license": "AGPL-3.0-or-later", diff --git a/package.json b/package.json index 0f7e54f..872f5bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fleetbase/registry-bridge-engine", - "version": "0.0.6", + "version": "0.0.7", "description": "Internal Bridge between Fleetbase API and Extensions Registry", "fleetbase": { "route": "extensions" diff --git a/server/src/Console/Commands/Initialize.php b/server/src/Console/Commands/Initialize.php index e86b3f2..365e4bb 100644 --- a/server/src/Console/Commands/Initialize.php +++ b/server/src/Console/Commands/Initialize.php @@ -2,7 +2,7 @@ namespace Fleetbase\RegistryBridge\Console\Commands; -use Fleetbase\RegistryBridge\Providers\RegistryBridgeServiceProvider; +use Fleetbase\RegistryBridge\Support\Utils; use Illuminate\Console\Command; class Initialize extends Command @@ -28,7 +28,7 @@ class Initialize extends Command */ public function handle() { - RegistryBridgeServiceProvider::bootRegistryAuth(true); + Utils::bootRegistryAuth(true); return 0; } diff --git a/server/src/Console/Commands/PostInstallExtension.php b/server/src/Console/Commands/PostInstallExtension.php deleted file mode 100644 index 7e7e736..0000000 --- a/server/src/Console/Commands/PostInstallExtension.php +++ /dev/null @@ -1,84 +0,0 @@ -argument('extensionId'); - $extension = RegistryExtension::disableCache()->where('public_id', $extensionId)->first(); - - if ($extension) { - $this->postInstallExtension($extension); - $this->info('Post install commands executed successfully.'); - } else { - $this->error('Extension not found.'); - } - - return 0; - } - - /** - * Post install extension commands. - */ - public function postInstallExtension(RegistryExtension $extension): void - { - if (isset($extension->currentBundle)) { - $composerJson = $extension->currentBundle->meta['composer.json']; - if ($composerJson) { - $extensionPath = base_path('vendor/' . $composerJson['name']); - - $commands = [ - 'rm -rf /fleetbase/.pnpm-store', - 'rm -rf node_modules', - 'pnpm install', - 'pnpm build', - ]; - - $this->info('Running post install for: ' . $extension->name); - $this->info('Extension install path: ' . $extensionPath); - foreach ($commands as $command) { - $this->info('Running extension post install command: `' . $command . '`'); - $process = Process::fromShellCommandline($command, $extensionPath); - $process->run(function ($type, $buffer) { - if (Process::ERR === $type) { - $this->error($buffer); - } else { - $this->info($buffer); - } - }); - - // Check if the process was successful - if (!$process->isSuccessful()) { - throw new ProcessFailedException($process); - } - } - } - } - } -} diff --git a/server/src/Providers/RegistryBridgeServiceProvider.php b/server/src/Providers/RegistryBridgeServiceProvider.php index e342aee..eec22e0 100644 --- a/server/src/Providers/RegistryBridgeServiceProvider.php +++ b/server/src/Providers/RegistryBridgeServiceProvider.php @@ -27,7 +27,6 @@ class RegistryBridgeServiceProvider extends CoreServiceProvider * @var array */ public $commands = [ - \Fleetbase\RegistryBridge\Console\Commands\PostInstallExtension::class, \Fleetbase\RegistryBridge\Console\Commands\Initialize::class, ];