Release of v4.0.1-alpha5
Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
@@ -13,9 +13,11 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
|
||||
|
||||
|
||||
use Joomla\Registry\Registry as JoomlaRegistry;
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use Joomla\CMS\Factory as JoomlaFactory;
|
||||
use Joomla\Input\Input;
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Utilities\StringHelper;
|
||||
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
|
||||
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
|
||||
|
||||
|
||||
@@ -43,9 +45,9 @@ class Config extends BaseConfig
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Input|null $input Input
|
||||
* @param Registry|null $params The component parameters
|
||||
* @param Registry|null $config The Joomla configuration
|
||||
* @param Input|null $input Input
|
||||
* @param JoomlaRegistry|null $params The component parameters
|
||||
* @param JoomlaRegistry|null $config The Joomla configuration
|
||||
*
|
||||
* @throws \Exception
|
||||
* @since 3.2.0
|
||||
@@ -65,7 +67,7 @@ class Config extends BaseConfig
|
||||
*/
|
||||
protected function getGiteausername(): ?string
|
||||
{
|
||||
return $this->custom_gitea_username ?? $this->params->get('gitea_username');
|
||||
return $this->params->get('gitea_username');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,66 +78,7 @@ class Config extends BaseConfig
|
||||
*/
|
||||
protected function getGiteatoken(): ?string
|
||||
{
|
||||
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
|
||||
}
|
||||
|
||||
/**
|
||||
* get Add Custom Gitea URL
|
||||
*
|
||||
* @return int the add switch
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getAddcustomgiteaurl(): int
|
||||
{
|
||||
return $this->params->get('add_custom_gitea_url', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* get Custom Gitea URL
|
||||
*
|
||||
* @return string the custom gitea url
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getCustomgiteaurl(): ?string
|
||||
{
|
||||
if ($this->add_custom_gitea_url == 2)
|
||||
{
|
||||
return $this->params->get('custom_gitea_url');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Custom Gitea Username
|
||||
*
|
||||
* @return string the custom access token
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getCustomgiteausername(): ?string
|
||||
{
|
||||
if ($this->add_custom_gitea_url == 2)
|
||||
{
|
||||
return $this->params->get('custom_gitea_username');
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get Custom Gitea Access Token
|
||||
*
|
||||
* @return string the custom access token
|
||||
* @since 3.2.0
|
||||
*/
|
||||
protected function getCustomgiteatoken(): ?string
|
||||
{
|
||||
if ($this->add_custom_gitea_url == 2)
|
||||
{
|
||||
return $this->params->get('custom_gitea_token');
|
||||
}
|
||||
|
||||
return null;
|
||||
return $this->params->get('gitea_token');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,11 +92,6 @@ class Config extends BaseConfig
|
||||
// the VDM default organisation is [joomla]
|
||||
$organisation = 'joomla';
|
||||
|
||||
if ($this->add_custom_gitea_url == 2)
|
||||
{
|
||||
return $this->params->get('super_powers_core_organisation', $organisation);
|
||||
}
|
||||
|
||||
return $organisation;
|
||||
}
|
||||
|
||||
@@ -168,45 +106,66 @@ class Config extends BaseConfig
|
||||
// some defaults repos we need by JCB
|
||||
$repos = [];
|
||||
|
||||
// only add custom init with custom gitea
|
||||
$paths = null;
|
||||
if ($this->add_custom_gitea_url == 2)
|
||||
{
|
||||
$paths = $this->params->get('super_powers_core_repos');
|
||||
}
|
||||
|
||||
// get the users own power repo (can overwrite all)
|
||||
if (!empty($this->gitea_username))
|
||||
if ($this->gitea_username !== null)
|
||||
{
|
||||
$repos[$this->gitea_username . '.super-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'super-powers', 'branch' => 'master'];
|
||||
$repos[$this->gitea_username . '.super-powers'] = (object) [
|
||||
'organisation' => $this->gitea_username,
|
||||
'repository' => 'super-powers',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
}
|
||||
|
||||
if (!empty($paths) && is_array($paths))
|
||||
{
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$owner = $path->owner ?? null;
|
||||
$repo = $path->repo ?? null;
|
||||
if ($owner !== null && $repo !== null)
|
||||
{
|
||||
// we make sure to get only the objects
|
||||
$repos = ["{$owner}.{$repo}" => $path] + $repos;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-compiler', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'jcb-packager', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'phpseclib', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.search'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'search', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.minify'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'minify', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.psr'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'psr', 'branch' => 'master'];
|
||||
$repos[$this->super_powers_core_organisation . '.fof'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'fof', 'branch' => 'master'];
|
||||
}
|
||||
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'super-powers',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.jcb-compiler'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'jcb-compiler',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.jcb-packager'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'jcb-packager',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.phpseclib'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'phpseclib',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.search'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'search',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'gitea',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.openai'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'openai',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.minify'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'minify',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.psr'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'psr',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
$repos[$this->super_powers_core_organisation . '.fof'] = (object) [
|
||||
'organisation' => $this->super_powers_core_organisation,
|
||||
'repository' => 'fof',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
|
||||
return $repos;
|
||||
}
|
||||
@@ -830,19 +789,14 @@ class Config extends BaseConfig
|
||||
// some defaults repos we need by JCB
|
||||
$approved = $this->super_powers_core_repos;
|
||||
|
||||
if (!$this->add_own_powers)
|
||||
{
|
||||
return array_values($approved);
|
||||
}
|
||||
$paths = RepoHelper::get(1); // super powers = 1
|
||||
|
||||
$paths = $this->params->get('approved_paths');
|
||||
|
||||
if (!empty($paths))
|
||||
if ($paths !== null)
|
||||
{
|
||||
foreach ($paths as $path)
|
||||
{
|
||||
$owner = $path->owner ?? null;
|
||||
$repo = $path->repo ?? null;
|
||||
$owner = $path->organisation ?? null;
|
||||
$repo = $path->repository ?? null;
|
||||
if ($owner !== null && $repo !== null)
|
||||
{
|
||||
// we make sure to get only the objects
|
||||
@@ -879,11 +833,19 @@ class Config extends BaseConfig
|
||||
// some defaults repos we need by JCB
|
||||
$repos = [];
|
||||
// get the users own power repo (can overwrite all)
|
||||
if (!empty($this->gitea_username))
|
||||
if ($this->gitea_username !== null)
|
||||
{
|
||||
$repos[$this->gitea_username . '.joomla-powers'] = (object) ['owner' => $this->gitea_username, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
||||
$repos[$this->gitea_username . '.joomla-powers'] = (object) [
|
||||
'organisation' => $this->gitea_username,
|
||||
'repository' => 'joomla-powers',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
}
|
||||
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) ['owner' => $this->joomla_powers_core_organisation, 'repo' => 'joomla-powers', 'branch' => 'master'];
|
||||
$repos[$this->joomla_powers_core_organisation . '.joomla-powers'] = (object) [
|
||||
'organisation' => $this->joomla_powers_core_organisation,
|
||||
'repository' => 'joomla-powers',
|
||||
'read_branch' => 'master'
|
||||
];
|
||||
|
||||
return $repos;
|
||||
}
|
||||
|
Reference in New Issue
Block a user