Release of v5.0.1-alpha5

Add repositories for better integration with gitea. Refactored the Data classes. Add new Data classes.
This commit is contained in:
2024-06-21 03:25:28 +02:00
parent fc6b04cb5c
commit c51ef999a9
120 changed files with 8945 additions and 3699 deletions

View File

@@ -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;
}

View File

@@ -15,7 +15,9 @@ namespace VDM\Joomla\Componentbuilder\Compiler;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Service\Crypt;
use VDM\Joomla\Componentbuilder\Service\Server;
use VDM\Joomla\Componentbuilder\Service\Database;
use VDM\Joomla\Service\Database;
use VDM\Joomla\Service\Model as BaseModel;
use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Compiler\Service\Model;
use VDM\Joomla\Componentbuilder\Compiler\Service\Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Service\Event;
@@ -149,6 +151,8 @@ abstract class Factory implements FactoryInterface
->registerServiceProvider(new Crypt())
->registerServiceProvider(new Server())
->registerServiceProvider(new Database())
->registerServiceProvider(new BaseModel())
->registerServiceProvider(new Data())
->registerServiceProvider(new Model())
->registerServiceProvider(new Compiler())
->registerServiceProvider(new Event())

View File

@@ -21,7 +21,6 @@ use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Utilities\String\ClassfunctionHelper;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Config;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Customcode;
@@ -102,43 +101,43 @@ class Power implements PowerInterface
protected array $retry = [];
/**
* Compiler Config
* The Config Class.
*
* @var Config
* @var Config
* @since 3.2.0
**/
*/
protected Config $config;
/**
* Compiler Placeholder
* The Placeholder Class.
*
* @var Placeholder
* @var Placeholder
* @since 3.2.0
**/
*/
protected Placeholder $placeholder;
/**
* Compiler Customcode
* The Customcode Class.
*
* @var Customcode
* @var Customcode
* @since 3.2.0
**/
*/
protected Customcode $customcode;
/**
* Compiler Customcode in Gui
* The Gui Class.
*
* @var Gui
* @var Gui
* @since 3.2.0
**/
*/
protected Gui $gui;
/**
* The JCB Superpower class
* The Super Class.
*
* @var Superpower
* @var Superpower
* @since 3.2.0
**/
*/
protected Superpower $superpower;
/**
@@ -158,23 +157,22 @@ class Power implements PowerInterface
/**
* Constructor.
*
* @param Config|null $config The compiler config object.
* @param Placeholder|null $placeholder The compiler placeholder object.
* @param Customcode|null $customcode The compiler customcode object.
* @param Gui|null $gui The compiler customcode gui object.
* @param Superpower|null $superpower The JCB superpower object.
* @param Config $config The Config Class.
* @param Placeholder $placeholder The Placeholder Class.
* @param Customcode $customcode The Customcode Class.
* @param Gui $gui The Gui Class.
* @param Superpower $superpower The Super Class.
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Config $config = null, ?Placeholder $placeholder = null,
?Customcode $customcode = null, ?Gui $gui = null, ?Superpower $superpower = null)
public function __construct(Config $config, Placeholder $placeholder,
Customcode $customcode, Gui $gui, Superpower $superpower)
{
$this->config = $config ?: Compiler::_('Config');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->customcode = $customcode ?: Compiler::_('Customcode');
$this->gui = $gui ?: Compiler::_('Customcode.Gui');
$this->superpower = $superpower ?: Compiler::_('Superpower');
$this->config = $config;
$this->placeholder = $placeholder;
$this->customcode = $customcode;
$this->gui = $gui;
$this->superpower = $superpower;
$this->db = Factory::getDbo();
$this->app = Factory::getApplication();
}

View File

@@ -19,9 +19,6 @@ use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector;
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update;
/**
@@ -55,15 +52,6 @@ class JoomlaPower implements ServiceProviderInterface
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
}
/**
@@ -97,8 +85,7 @@ class JoomlaPower implements ServiceProviderInterface
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Insert'),
$container->get('Joomla.Power.Update')
$container->get('Data.Item')
);
}
@@ -149,53 +136,6 @@ class JoomlaPower implements ServiceProviderInterface
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}
}

View File

@@ -15,10 +15,10 @@ namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power as Powers;
use VDM\Joomla\Componentbuilder\Power\Grep;
use VDM\Joomla\Componentbuilder\Power\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\Power\Infusion;
use VDM\Joomla\Componentbuilder\Power\Grep;
use VDM\Joomla\Componentbuilder\Compiler\Power\Autoloader;
use VDM\Joomla\Componentbuilder\Compiler\Power\Infusion;
use VDM\Joomla\Componentbuilder\Compiler\Power\Structure;
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
use VDM\Joomla\Componentbuilder\Compiler\Power\Plantuml;
@@ -26,9 +26,6 @@ use VDM\Joomla\Componentbuilder\Compiler\Power\Repo\Readme as RepoReadme;
use VDM\Joomla\Componentbuilder\Compiler\Power\Repos\Readme as ReposReadme;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert;
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
use VDM\Joomla\Componentbuilder\Power\Database\Update;
/**
@@ -83,19 +80,10 @@ class Power implements ServiceProviderInterface
$container->alias(Injector::class, 'Power.Injector')
->share('Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Power.Model.Upsert')
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Power.Insert')
->share('Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Power.Update')
->share('Power.Update', [$this, 'getUpdate'], true);
}
/**
* Get the Powers
* Get The Power Class.
*
* @param Container $container The DI container.
*
@@ -108,12 +96,13 @@ class Power implements ServiceProviderInterface
$container->get('Config'),
$container->get('Placeholder'),
$container->get('Customcode'),
$container->get('Customcode.Gui')
$container->get('Customcode.Gui'),
$container->get('Superpower')
);
}
/**
* Get the Superpower
* Get The Super Class.
*
* @param Container $container The DI container.
*
@@ -124,13 +113,12 @@ class Power implements ServiceProviderInterface
{
return new Superpower(
$container->get('Power.Grep'),
$container->get('Power.Insert'),
$container->get('Power.Update')
$container->get('Data.Item')
);
}
/**
* Get the Grep
* Get The Grep Class.
*
* @param Container $container The DI container.
*
@@ -147,7 +135,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Autoloader
* Get The Autoloader Class.
*
* @param Container $container The DI container.
*
@@ -164,7 +152,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Infusion
* Get The Infusion Class.
*
* @param Container $container The DI container.
*
@@ -187,7 +175,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Structure Builder
* Get The Structure Class.
*
* @param Container $container The DI container.
*
@@ -210,11 +198,11 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Parser
* Get The Parser Class.
*
* @param Container $container The DI container.
*
* @return Structure
* @return Parser
* @since 3.2.0
*/
public function getParser(Container $container): Parser
@@ -223,7 +211,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Plantuml Builder
* Get The Plantuml Class.
*
* @param Container $container The DI container.
*
@@ -236,7 +224,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Repo Readme Builder
* Get The Readme Class.
*
* @param Container $container The DI container.
*
@@ -252,7 +240,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Repos Readme Builder
* Get The Readme Class.
*
* @param Container $container The DI container.
*
@@ -268,7 +256,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Extractor
* Get The Extractor Class.
*
* @param Container $container The DI container.
*
@@ -281,7 +269,7 @@ class Power implements ServiceProviderInterface
}
/**
* Get the Compiler Power Injector
* Get The Injector Class.
*
* @param Container $container The DI container.
*
@@ -296,53 +284,6 @@ class Power implements ServiceProviderInterface
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Power.Model.Upsert'),
$container->get('Update')
);
}
}