-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate license to AGPL v3, upgrade dependencies
- Loading branch information
Showing
13 changed files
with
919 additions
and
20 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"version": "0.0.1", | ||
"description": "Internal Bridge between Fleetbase API and Extensions Registry", | ||
"repository": "https://github.com/fleetbase/registry-bridge", | ||
"license": "MIT", | ||
"license": "AGPL-3.0-or-later", | ||
"author": "Fleetbase Pte Ltd <[email protected]>", | ||
"engine": "package.json", | ||
"api": "composer.json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
"name": "@fleetbase/registry-bridge-engine", | ||
"version": "0.0.1", | ||
"description": "Internal Bridge between Fleetbase API and Extensions Registry", | ||
"fleetbase": { | ||
"route": "extensions" | ||
}, | ||
"keywords": [ | ||
"fleetbase-extension", | ||
"fleetbase-registry-bridge", | ||
|
@@ -10,7 +13,7 @@ | |
"ember-engine" | ||
], | ||
"repository": "https://github.com/fleetbase/registry-bridge", | ||
"license": "MIT", | ||
"license": "AGPL-3.0-or-later", | ||
"author": "Fleetbase Pte Ltd <[email protected]>", | ||
"directories": { | ||
"app": "app", | ||
|
@@ -36,7 +39,7 @@ | |
}, | ||
"dependencies": { | ||
"@fleetbase/ember-core": "^0.2.11", | ||
"@fleetbase/ember-ui": "^0.2.16", | ||
"@fleetbase/ember-ui": "^0.2.17", | ||
"@babel/core": "^7.23.2", | ||
"@fortawesome/ember-fontawesome": "^0.4.1", | ||
"@fortawesome/fontawesome-svg-core": "^6.4.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
<?php | ||
|
||
namespace Fleetbase\RegistryBridge\Console\Commands; | ||
|
||
use Fleetbase\RegistryBridge\Models\RegistryExtension; | ||
use Illuminate\Console\Command; | ||
use Symfony\Component\Process\Exception\ProcessFailedException; | ||
use Symfony\Component\Process\Process; | ||
|
||
class PostInstallExtension extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'extension:post-install {extensionId}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Post install an extension by running necessary commands'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
$extensionId = $this->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. | ||
* | ||
* @param \Fleetbase\RegistryBridge\Models\RegistryExtension $extension | ||
* @return void | ||
*/ | ||
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); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.