Initial commit

This commit is contained in:
2025-12-28 15:26:33 +01:00
parent 078f2bf6a7
commit 13b61ce3a8
18 changed files with 652 additions and 19 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace NoccyLabs\Composer\PackagePlugin\Package;
use NoccyLabs\Composer\PackagePlugin\Project\ProjectInfo;
use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
use Symfony\Component\Console\Output\OutputInterface;
class PackagePublisher
{
public function __construct(
public readonly RegistryFactory $registryFactory,
public readonly OutputInterface $output,
)
{
}
public function publish(ProjectInfo $project, string $registryUri): void
{
// $this->output->writeln("Resolving registry for <comment>{$registryUri}</>...");
$registry = $this->registryFactory->createRegistryFromUri($registryUri);
$this->output->writeln("Publishing package file <info>{$project->filename}</> to <comment>{$registry->server}</> as <comment>{$registry->owner}</>...");
$registry->publishPackageVersion($project);
}
public function unpublish(ProjectInfo $project, string $registryUri): void
{
// $this->output->writeln("Resolving registry for <comment>{$registryUri}</>...");
$registry = $this->registryFactory->createRegistryFromUri($registryUri);
$this->output->writeln("Unpublishing package <options=bold>{$project->name}</>@<options=bold>{$project->version}</> from <comment>{$registry->server}</> for <comment>{$registry->owner}</>...");
$registry->unpublishPackageVersion($project);
}
}