Release of v5.1.1-beta1

Add JCB new package engine.
This commit is contained in:
2025-06-18 19:49:35 +00:00
parent 3b502eb09b
commit 70718936b4
464 changed files with 34151 additions and 13973 deletions

View File

@@ -13,10 +13,14 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower as Power;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower;
use VDM\Joomla\Componentbuilder\Package\Service\Power;
use VDM\Joomla\Service\Database;
use VDM\Joomla\Service\Model;
use VDM\Joomla\Service\Data;
use VDM\Joomla\Componentbuilder\Power\Service\Git;
use VDM\Joomla\Componentbuilder\Power\Service\Github;
use VDM\Joomla\Github\Service\Utilities as GithubUtilities;
use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
@@ -51,10 +55,14 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new JoomlaPower())
->registerServiceProvider(new Power())
->registerServiceProvider(new Database())
->registerServiceProvider(new Model())
->registerServiceProvider(new Data())
->registerServiceProvider(new Git())
->registerServiceProvider(new Github())
->registerServiceProvider(new GithubUtilities())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities())

View File

@@ -65,78 +65,66 @@ final class Grep extends ExtendingGrep implements GrepInterface
}
/**
* Get a remote joomla power
* Get a remote joomla power object from a repository.
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
* @param object $path The repository path details
* @param string $guid The global unique ID of the power
*
* @return object|null
* @since 3.2.0
* @since 5.1.1
*/
protected function getRemote(object $path, string $guid): ?object
{
$power = null;
if (empty($path->index->{$guid}->path))
$relative_path = $path->index[$this->entity]->{$guid}->path ?? null;
if (empty($relative_path))
{
return $power;
return null;
}
// get the branch name
$branch = $this->getBranchName($path);
$branch = $this->getBranchName($path);
$guid_field = $this->getGuidField();
$settings_name = $this->getSettingsName();
$readme_enabled = $this->hasItemReadme();
// get the guid_field key
$guid_field = $this->getGuidField();
// get the settings path
$settings_path = $this->getSettingsPath();
// set the target system
$target = $path->target ?? 'gitea';
$this->contents->setTarget($target);
// load the base and token if set
$this->loadApi($this->contents, $path->base ?? null, $path->token ?? null);
$this->loadApi(
$this->contents,
$target === 'gitea' ? ($path->base ?? null) : null,
$path->token ?? null
);
// get the settings
if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/' . $settings_path, $branch)) !== null &&
isset($power->{$guid_field}))
$power = $this->loadRemoteFile(
$path->organisation,
$path->repository,
"{$relative_path}/{$settings_name}",
$branch
);
if ($power === null || !isset($power->{$guid_field}))
{
// set the git details in params
$path_guid = $path->guid ?? null;
if ($path_guid !== null)
$this->contents->reset_();
return null;
}
$path_guid = $path->guid ?? null;
$branch_field = $this->getBranchField();
if ($branch_field === 'write_branch' && $path_guid !== null)
{
$this->setRepoItemSha($power, $path, "{$relative_path}/{$settings_name}", $branch, "{$path_guid}-settings");
if ($readme_enabled)
{
// get the Settings meta
if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/' . $settings_path, $branch)) !== null &&
isset($meta->sha))
{
if (isset($power->params) && is_object($power->params) &&
isset($power->params->source) && is_array($power->params->source))
{
$power->params->source[$path_guid . '-settings'] = $meta->sha;
}
else
{
$power->params = (object) [
'source' => [$path_guid . '-settings' => $meta->sha]
];
}
}
// get the README meta
if (($meta = $this->contents->metadata($path->organisation, $path->repository, $path->index->{$guid}->path . '/README.md', $branch)) !== null &&
isset($meta->sha))
{
if (isset($power->params) && is_object($power->params) &&
isset($power->params->source) && is_array($power->params->source))
{
$power->params->source[$path_guid . '-readme'] = $meta->sha;
}
else
{
$power->params = (object) [
'source' => [$path_guid . '-readme' => $meta->sha]
];
}
}
$readme_name = $this->getItemReadmeName();
$this->setRepoItemSha($power, $path, "{$relative_path}/{$readme_name}", $branch, "{$path_guid}-readme");
}
}
// reset back to the global base and token
$this->contents->reset_();
return $power;

View File

@@ -22,45 +22,108 @@ use VDM\Joomla\Interfaces\Readme\ItemInterface;
final class Item implements ItemInterface
{
/**
* Get an item readme
* Generate a README for a Joomla! Power entity in Markdown format.
*
* @param object $item An item details.
* This includes the system name, description, settings table, and usage instructions.
*
* @return string
* @since 3.2.2
* @param object $item The Joomla! Power item definition.
*
* @return string The generated README as Markdown.
* @since 3.2.2
*/
public function get(object $item): string
{
// build readme
$readme = ["```
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ ██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ ██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ ██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ ██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```"];
// system name
$readme[] = "# " . $item->system_name;
$readme = [];
// Title and system name
$readme[] = '### Joomla! Power';
$readme[] = '# ' . ($item->system_name ?? 'error: missing system name');
$readme[] = '';
// Description block
if (!empty($item->description))
{
$readme[] = "\n" . $item->description;
$readme[] = trim($item->description);
$readme[] = '';
}
$readme[] = "\nThe Joomla! Power feature allows you to use Joomla classes in your project without manually managing their namespaces. JCB will automatically add the correct namespaces to your files. If Joomla classes change in future versions, such as from Joomla 3 to 5, JCB will update them for you.\n\nHowever, if there are breaking changes in function names, you may need to make some manual adjustments. The Joomla Power Key (JPK) helps you easily search for these classes.\n\nBy using the JPK (Joomla Power Key) in your custom code (replacing the class name in your code with the JPK), JCB will automatically pull the Joomla! Power from the repository into your project.\n\nTo add this specific power to your project in JCB:\n\n> simply use this JPK\n```\n" . 'Joomla---' . str_replace('-', '_', $item->guid) . '---Power' . "\n```\n> remember to replace the `---` with `___` to activate this Joomla! Power in your code";
// Settings table
if (!empty($item->settings) && (is_array($item->settings) || is_object($item->settings)))
{
$readme[] = $this->buildSettingsTable($item->settings);
$readme[] = '';
}
// yes you can remove this, but why?
$readme[] = "\n---\n```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n";
// Usage instructions
$guid = $item->guid ?? 'error_missing_guid';
$readme[] = '> This Joomla! Power lets you seamlessly integrate and future-proof Joomla classes in your custom code.';
$readme[] = '';
$readme[] = 'To add this specific power to your project in JCB:';
$readme[] = '';
$readme[] = 'Simply use this JPK:';
$readme[] = '```';
$readme[] = 'Joomla---' . str_replace('-', '_', $guid) . '---Power';
$readme[] = '```';
$readme[] = '> Remember to replace the `---` with `___` to activate this Joomla! Power in your code.';
$readme[] = '';
// Footer
$readme[] = <<<MD
### Used in [Joomla Component Builder](https://www.joomlacomponentbuilder.com) - [Source](https://git.vdm.dev/joomla/Component-Builder) - [Mirror](https://github.com/vdm-io/Joomla-Component-Builder) - [Download](https://git.vdm.dev/joomla/pkg-component-builder/releases)
---
[![Joomla Volunteer Portal](https://img.shields.io/badge/-Joomla-gold?logo=joomla)](https://volunteers.joomla.org/joomlers/1396-llewellyn-van-der-merwe "Join Llewellyn on the Joomla Volunteer Portal: Shaping the Future Together!") [![Octoleo](https://img.shields.io/badge/-Octoleo-black?logo=linux)](https://git.vdm.dev/octoleo "--quiet") [![Llewellyn](https://img.shields.io/badge/-Llewellyn-ffffff?logo=gitea)](https://git.vdm.dev/Llewellyn "Collaborate and Innovate with Llewellyn on Git: Building a Better Code Future!") [![Telegram](https://img.shields.io/badge/-Telegram-blue?logo=telegram)](https://t.me/Joomla_component_builder "Join Llewellyn and the Community on Telegram: Building Joomla Components Together!") [![Mastodon](https://img.shields.io/badge/-Mastodon-9e9eec?logo=mastodon)](https://joomla.social/@llewellyn "Connect and Engage with Llewellyn on Joomla Social: Empowering Communities, One Post at a Time!") [![X (Twitter)](https://img.shields.io/badge/-X-black?logo=x)](https://x.com/llewellynvdm "Join the Conversation with Llewellyn on X: Where Ideas Take Flight!") [![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=github)](https://github.com/Llewellynvdm "Build, Innovate, and Thrive with Llewellyn on GitHub: Turning Ideas into Impact!") [![YouTube](https://img.shields.io/badge/-YouTube-ff0000?logo=youtube)](https://www.youtube.com/@OctoYou "Explore, Learn, and Create with Llewellyn on YouTube: Your Gateway to Inspiration!") [![n8n](https://img.shields.io/badge/-n8n-black?logo=n8n)](https://n8n.io/creators/octoleo "Effortless Automation and Impactful Workflows with Llewellyn on n8n!") [![Docker Hub](https://img.shields.io/badge/-Docker-grey?logo=docker)](https://hub.docker.com/u/llewellyn "Llewellyn on Docker: Containerize Your Creativity!") [![Open Collective](https://img.shields.io/badge/-Donate-green?logo=opencollective)](https://opencollective.com/joomla-component-builder "Donate towards JCB: Help Llewellyn financially so he can continue developing this great tool!") [![GPG Key](https://img.shields.io/badge/-GPG-blue?logo=gnupg)](https://git.vdm.dev/Llewellyn/gpg "Unlock Trust and Security with Llewellyn's GPG Key: Your Gateway to Verified Connections!")
MD;
return implode("\n", $readme);
}
/**
* Builds a Markdown table with details about each setting.
*
* The table includes columns: Namespace (inline `use ...;` code style) and Joomla Version (as shield badge).
*
* @param array|object $settings Associative array or object containing settings.
*
* @return string The generated Markdown output.
* @since 5.1.1
*/
protected function buildSettingsTable(array|object $settings): string
{
$settings = (array) $settings;
$markdown = [];
// Table header
$markdown[] = '| Namespace | Joomla Version |';
$markdown[] = '|-----------|----------------|';
foreach ($settings as $setting)
{
$setting = (array) $setting;
// Inline namespace string as `use Namespace\Class;`
$namespace = isset($setting['namespace'])
? '`use ' . $setting['namespace'] . ';`'
: '`—`';
// Map version to badge label
$versionMap = [
'0' => ['All', 'purple'],
'3' => ['Joomla 3', 'blue'],
'4' => ['Joomla 4', 'green'],
'5' => ['Joomla 5', 'brightgreen']
];
$versionCode = (string) ($setting['joomla_version'] ?? '0');
[$label, $color] = $versionMap[$versionCode] ?? ['Unknown', 'lightgrey'];
$versionBadge = "![{$label}](https://img.shields.io/badge/{$label}-{$color}?style=flat-square)";
$markdown[] = "| {$namespace} | {$versionBadge} |";
}
return implode("\n", $markdown);
}
}

View File

@@ -16,69 +16,87 @@ use VDM\Joomla\Interfaces\Readme\MainInterface;
/**
* Compiler Power Main Readme
* Compiler Joomla Power Main Readme
*
* @since 3.2.0
*/
final class Main implements MainInterface
{
/**
* Get Main Readme
* Generate the main README for the JCB Joomla Powers repository in Markdown format.
*
* @param array $items All items of this repository.
* This README explains the purpose and function of Joomla Powers (JPKs), including dynamic class resolution,
* namespace management, and automatic `use` statement injection. It also lists all powers in this repository.
*
* @return string
* @since 3.2.0
* @param array $items All items (Joomla Powers) assigned to this repository.
*
* @return string The full generated Markdown README.
* @since 3.2.0
*/
public function get(array $items): string
{
// build readme
$readme = ["```
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝
```"];
$readme = [];
// default description of super powers
$readme[] = "\n### What is JCB Joomla Powers?\nThe Joomla Component Builder (JCB) Joomla Power features are designed to enhance JCB's functionality and streamline the development process. The Joomla powers enable developers to effectively leverage Joomla classes in their custom code without needing to manually add the `use` statements for those classes to the file headers. JCB automatically updates these `use` statements in the necessary headers when it detects a Joomla power key in the custom code.\n
\n
By doing this, we can control the `use` statements dynamically from a central point. This is particularly beneficial when transitioning from Joomla 3 to Joomla 4, as it allows us to seamlessly switch from certain classes to their respective Joomla framework classes and vice versa. Maintaining these `use` statements in the Joomla Power area ensures that JCB handles the inclusion and updating of class names to prevent conflicts with other classes.\n
\n
This approach is convenient and allows developers to focus on the bespoke parts of their application logic without worrying about class declarations.\n
\nThis repository contains an index (see below) of all the Joomla! Powers within the JCB core GUI. These Joomla! Powers are automatically added to the repository by our maintainers, ensuring a well-organized and accessible collection of Joomla Classes are maintained.\n";
// Header
$readme[] = '# Joomla! Power';
$readme[] = '';
// get the readme body
// Description
$readme[] = '### What Are Joomla Powers in JCB?';
$readme[] = <<<MD
Joomla Powers in JCB are a smart way to include Joomla classes in your custom code — **without hardcoding their full class names or import paths**.
Instead of writing `\\Joomla\\CMS\\Factory::getApplication()->enqueueMessage(...);` manually, you can simply place a **Joomla Power Key (JPK)** in your code, like this:
```
Joomla---39403062_84fb_46e0_bac4_0023f766e827---Power::getApplication()->enqueueMessage(...);
```
> Replace each `---` with `___` when using the key inside your code.
JCB will automatically:
- Resolve this JPK to the correct class path for your current Joomla version.
- Add the correct `use` statement to the top of the file.
- Detect and resolve naming collisions by automatically generating an `as` alias (e.g., `use Joomla\CMS\Factory as CMSFactory;`).
- Replace the JPK in your code with the correct class name (either the original or aliased name).
---
MD;
// Why explanation
$readme[] = '### Why This Matters';
$readme[] = <<<MD
Joomla occasionally moves classes between namespaces (e.g., from `Joomla\CMS\` to `Joomla\Framework\`).
By using JPKs, you no longer need to manually update class paths when switching between Joomla 3, 4, or 5+.
**Your code becomes version-independent** — JCB handles the class namespacing and **use statement** injection during compilation.
You write clean, readable logic — and JCB ensures compatibility under the hood.
---
MD;
// What can be found here
$readme[] = '### What's in This Repository?';
$readme[] = <<<MD
This repository contains a **index of Joomla Powers** to be used in a JCB instance.
The list below shows all Joomla Powers available in this repository — each one usable via its unique JPK.
---
MD;
// Dynamic list of joomla powers
$readme[] = $this->readmeBuilder($items);
$readme[] = '';
$readme[] = <<<MD
### All used in [Joomla Component Builder](https://www.joomlacomponentbuilder.com) - [Source](https://git.vdm.dev/joomla/Component-Builder) - [Mirror](https://github.com/vdm-io/Joomla-Component-Builder) - [Download](https://git.vdm.dev/joomla/pkg-component-builder/releases)
// yes you can remove this, but why?
$readme[] = "\n---\n```
██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗
██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗
██║██║ ██║██║ ██║██╔████╔██║██║ ███████║
██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║
╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║
╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝
██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗
██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗
██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝
██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗
██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║
╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝
```\n> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)\n\n";
---
[![Joomla Volunteer Portal](https://img.shields.io/badge/-Joomla-gold?logo=joomla)](https://volunteers.joomla.org/joomlers/1396-llewellyn-van-der-merwe "Join Llewellyn on the Joomla Volunteer Portal: Shaping the Future Together!") [![Octoleo](https://img.shields.io/badge/-Octoleo-black?logo=linux)](https://git.vdm.dev/octoleo "--quiet") [![Llewellyn](https://img.shields.io/badge/-Llewellyn-ffffff?logo=gitea)](https://git.vdm.dev/Llewellyn "Collaborate and Innovate with Llewellyn on Git: Building a Better Code Future!") [![Telegram](https://img.shields.io/badge/-Telegram-blue?logo=telegram)](https://t.me/Joomla_component_builder "Join Llewellyn and the Community on Telegram: Building Joomla Components Together!") [![Mastodon](https://img.shields.io/badge/-Mastodon-9e9eec?logo=mastodon)](https://joomla.social/@llewellyn "Connect and Engage with Llewellyn on Joomla Social: Empowering Communities, One Post at a Time!") [![X (Twitter)](https://img.shields.io/badge/-X-black?logo=x)](https://x.com/llewellynvdm "Join the Conversation with Llewellyn on X: Where Ideas Take Flight!") [![GitHub](https://img.shields.io/badge/-GitHub-181717?logo=github)](https://github.com/Llewellynvdm "Build, Innovate, and Thrive with Llewellyn on GitHub: Turning Ideas into Impact!") [![YouTube](https://img.shields.io/badge/-YouTube-ff0000?logo=youtube)](https://www.youtube.com/@OctoYou "Explore, Learn, and Create with Llewellyn on YouTube: Your Gateway to Inspiration!") [![n8n](https://img.shields.io/badge/-n8n-black?logo=n8n)](https://n8n.io/creators/octoleo "Effortless Automation and Impactful Workflows with Llewellyn on n8n!") [![Docker Hub](https://img.shields.io/badge/-Docker-grey?logo=docker)](https://hub.docker.com/u/llewellyn "Llewellyn on Docker: Containerize Your Creativity!") [![Open Collective](https://img.shields.io/badge/-Donate-green?logo=opencollective)](https://opencollective.com/joomla-component-builder "Donate towards JCB: Help Llewellyn financially so he can continue developing this great tool!") [![GPG Key](https://img.shields.io/badge/-GPG-blue?logo=gnupg)](https://git.vdm.dev/Llewellyn/gpg "Unlock Trust and Security with Llewellyn's GPG Key: Your Gateway to Verified Connections!")
MD;
return implode("\n", $readme);
}

View File

@@ -53,7 +53,7 @@ final class Config extends ExtendingConfig implements ConfigInterface
* @var string
* @since 3.2.2
*/
// [DEFAULT] protected string $suffix_key = '---Power';
protected string $suffix_key = '---Power';
/**
* The main readme file path
@@ -63,6 +63,14 @@ final class Config extends ExtendingConfig implements ConfigInterface
*/
// [DEFAULT] protected string $main_readme_path = 'README.md';
/**
* The item readme file name
*
* @var string
* @since 5.1.1
*/
// [DEFAULT] protected string $item_readme_name = 'README.md';
/**
* The index file path (index of all items)
*
@@ -80,12 +88,12 @@ final class Config extends ExtendingConfig implements ConfigInterface
// [DEFAULT] protected string $src_path = 'src';
/**
* The item settings file path
* The item settings file name (item data)
*
* @var string
* @since 3.2.2
*/
// [DEFAULT] protected string $settings_path = 'item.json';
// [DEFAULT] protected string $settings_name = 'item.json';
/**
* The item guid=unique field
@@ -143,12 +151,7 @@ final class Config extends ExtendingConfig implements ConfigInterface
*
* @var array
* @since 5.0.3
protected array $placeholders = [
'[['.'[NamespacePrefix]]]' => 'VDM',
'[['.'[ComponentNamespace]]]' => 'Componentbuilder',
'[['.'[Component]]]' => 'Componentbuilder',
'[['.'[component]]]' => 'componentbuilder'
];
protected array $placeholders = [];
[DEFAULT] */
}

View File

@@ -53,9 +53,11 @@ final class Set extends ExtendingSet implements SetInterface
$repo->repository, // The repository name.
$this->index_map_IndexSettingsPath($item), // The file path.
json_encode($item, JSON_PRETTY_PRINT), // The file content.
'Update ' . $item->system_name, // The commit message.
'Update ' . $item_name, // The commit message.
$sha, // The blob SHA of the old file.
$repo->write_branch // The branch name.
$repo->write_branch, // The branch name.
$repo->author_name, // The author name.
$repo->author_email // The author email.
);
$success = is_object($result);
@@ -84,8 +86,10 @@ final class Set extends ExtendingSet implements SetInterface
$repo->repository, // The repository name.
$this->index_map_IndexSettingsPath($item), // The file path.
json_encode($item, JSON_PRETTY_PRINT), // The file content.
'Create ' . $item->system_name, // The commit message.
$repo->write_branch // The branch name.
'Create ' . $this->index_map_IndexName($item), // The commit message.
$repo->write_branch, // The branch name.
$repo->author_name, // The author name.
$repo->author_email // The author email.
);
return is_object($result);
@@ -113,11 +117,13 @@ final class Set extends ExtendingSet implements SetInterface
$this->git->update(
$repo->organisation, // The owner name.
$repo->repository, // The repository name.
$this->index_map_IndexPath($item) . '/README.md', // The file path.
$this->index_map_IndexReadmePath($item), // The file path.
$this->itemReadme->get($item), // The file content.
'Update ' . $item->system_name . ' readme file', // The commit message.
'Update ' . $this->index_map_IndexName($item) . ' readme file', // The commit message.
$sha, // The blob SHA of the old file.
$repo->write_branch // The branch name.
$repo->write_branch, // The branch name.
$repo->author_name, // The author name.
$repo->author_email // The author email.
);
}
@@ -135,10 +141,12 @@ final class Set extends ExtendingSet implements SetInterface
$this->git->create(
$repo->organisation, // The owner name.
$repo->repository, // The repository name.
$this->index_map_IndexPath($item) . '/README.md', // The file path.
$this->index_map_IndexReadmePath($item), // The file path.
$this->itemReadme->get($item), // The file content.
'Create ' . $item->system_name . ' readme file', // The commit message.
$repo->write_branch // The branch name.
'Create ' . $this->index_map_IndexName($item) . ' readme file', // The commit message.
$repo->write_branch, // The branch name.
$repo->author_name, // The author name.
$repo->author_email // The author email.
);
}
}

View File

@@ -15,8 +15,6 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\JoomlaPower\Config;
use VDM\Joomla\Componentbuilder\Power\Table;
use VDM\Joomla\Componentbuilder\Package\MessageBus;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Remote\Config as RemoteConfig;
use VDM\Joomla\Componentbuilder\Power\Remote\Get;
@@ -42,14 +40,8 @@ class JoomlaPower implements ServiceProviderInterface
*/
public function register(Container $container)
{
$container->alias(Config::class, 'Config')
->share('Config', [$this, 'getConfig'], true);
$container->alias(Table::class, 'Power.Table')->alias('Table', 'Power.Table')
->share('Power.Table', [$this, 'getPowerTable'], true);
$container->alias(MessageBus::class, 'Power.Message')
->share('Power.Message', [$this, 'getMessageBus'], true);
$container->alias(Config::class, 'Joomla.Power.Config')->alias('Config', 'Joomla.Power.Config')
->share('Joomla.Power.Config', [$this, 'getConfig'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
@@ -83,32 +75,6 @@ class JoomlaPower implements ServiceProviderInterface
return new Config();
}
/**
* Get The Power Table Class.
*
* @param Container $container The DI container.
*
* @return Table
* @since 5.1.1
*/
public function getPowerTable(Container $container): Table
{
return new Table();
}
/**
* Get The Message Bus Class.
*
* @param Container $container The DI container.
*
* @return MessageBus
* @since 5.2.1
*/
public function getMessageBus(Container $container): MessageBus
{
return new MessageBus();
}
/**
* Get The Grep Class.
*
@@ -121,9 +87,10 @@ class JoomlaPower implements ServiceProviderInterface
{
return new Grep(
$container->get('Joomla.Power.Remote.Config'),
$container->get('Gitea.Repository.Contents'),
$container->get('Git.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_joomla_paths
$container->get('Power.Tracker'),
$container->get('Joomla.Power.Config')->approved_joomla_paths
);
}
@@ -155,7 +122,9 @@ class JoomlaPower implements ServiceProviderInterface
return new Get(
$container->get('Joomla.Power.Remote.Config'),
$container->get('Joomla.Power.Grep'),
$container->get('Data.Item')
$container->get('Data.Item'),
$container->get('Power.Tracker'),
$container->get('Power.Message')
);
}
@@ -175,9 +144,10 @@ class JoomlaPower implements ServiceProviderInterface
$container->get('Data.Items'),
$container->get('Joomla.Power.Readme.Item'),
$container->get('Joomla.Power.Readme.Main'),
$container->get('Gitea.Repository.Contents'),
$container->get('Git.Repository.Contents'),
$container->get('Power.Tracker'),
$container->get('Power.Message'),
$container->get('Config')->approved_joomla_paths
$container->get('Joomla.Power.Config')->approved_joomla_paths
);
}