Release of v3.2.2-alpha5

Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
2024-06-21 01:32:05 +02:00
parent 894d691897
commit 7a680bb734
159 changed files with 12830 additions and 7619 deletions

View File

@@ -48,14 +48,28 @@ final class Grep extends ExtendingGrep implements GrepInterface
try
{
$path->index = $this->contents->get($path->owner, $path->repo, 'super-powers.json', $path->branch);
$this->contents->load_($path->base ?? null, $path->token ?? null);
$path->index = $this->contents->get($path->organisation, $path->repository, 'super-powers.json', $path->read_branch);
$this->contents->reset_();
}
catch (\Exception $e)
{
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
if ('super-powers' === $path->repository && 'joomla' !== $path->organisation && (empty($path->base) || $path->base === 'https://git.vdm.dev'))
{
// give heads-up about the overriding feature
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BHTTPSGITVDMDEVSB_CAN_BE_USED_TO_OVERRIDE_ANY_POWERBR_BUT_HAS_NOT_YET_BEEN_SET_IN_YOUR_ACCOUNT_AT_HTTPSGITVDMDEVSBR_SMALLTHIS_IS_AND_OPTIONAL_FEATURESMALL', $path->path, $path->organisation),
'Message'
);
}
else
{
// give error
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
}
$path->index = null;
}
@@ -161,50 +175,48 @@ final class Grep extends ExtendingGrep implements GrepInterface
*/
protected function getRemote(object $path, string $guid): ?object
{
$power = null;
if (empty($path->index->{$guid}->settings) || empty($path->index->{$guid}->code))
{
return null;
return $power;
}
// get the settings
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
$this->contents->load_($path->base ?? null, $path->token ?? null);
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $path->read_branch)) !== null &&
isset($power->guid))
{
// get the code
if (($code = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->power, $path->branch)) !== null)
if (($code = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->power, $path->read_branch)) !== null)
{
// set the git details in params
$power->params = (object) [
'git' => [
'owner' => $path->owner,
'repo' => $path->repo,
'branch' => $path->branch
]
'source' => ['guid' => $path->guid ?? null]
];
$power->main_class_code = $code;
return $power;
}
}
$this->contents->reset_();
return null;
return $power;
}
/**
* Load the remote file
*
* @param string $owner The repository owner
* @param string $repo The repository name
* @param string $path The repository path to file
* @param string|null $branch The repository branch name
* @param string $organisation The repository organisation
* @param string $repository The repository name
* @param string $path The repository path to file
* @param string|null $branch The repository branch name
*
* @return mixed
* @since 3.2.0
*/
protected function loadRemoteFile(string $owner, string $repo, string $path, ?string $branch)
protected function loadRemoteFile(string $organisation, string $repository, string $path, ?string $branch)
{
try
{
$data = $this->contents->get($owner, $repo, $path, $branch);
$data = $this->contents->get($organisation, $repository, $path, $branch);
}
catch (\Exception $e)
{