Implement common abstract base command
This commit is contained in:
@@ -14,7 +14,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class PackageBuildCommand extends BaseCommand
|
||||
class PackageBuildCommand extends PackageCommand
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -48,7 +48,7 @@ class PackageBuildCommand extends BaseCommand
|
||||
}
|
||||
|
||||
if ($registry) {
|
||||
$credentials = new InsecureStore();
|
||||
$credentials = $this->getCredentialsStore();
|
||||
|
||||
$providers = [
|
||||
'gitea' => new GiteaProvider($credentials)
|
||||
|
||||
26
src/Command/PackageCommand.php
Normal file
26
src/Command/PackageCommand.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace NoccyLabs\Composer\PackagePlugin\Command;
|
||||
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Composer\Command\BaseCommand;
|
||||
use NoccyLabs\Composer\PackagePlugin\Package\PackageBuilder;
|
||||
use NoccyLabs\Composer\PackagePlugin\Package\PackagePublisher;
|
||||
use NoccyLabs\Composer\PackagePlugin\Project\ProjectInfo;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\Credentials\InsecureStore;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\Credentials\StoreInterface;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\Gitea\GiteaProvider;
|
||||
use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
abstract class PackageCommand extends BaseCommand
|
||||
{
|
||||
|
||||
public function getCredentialsStore(): StoreInterface
|
||||
{
|
||||
return new InsecureStore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class PackageLoginCommand extends BaseCommand
|
||||
class PackageLoginCommand extends PackageCommand
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class PackageLoginCommand extends BaseCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$credentials = new InsecureStore();
|
||||
$credentials = $this->getCredentialsStore();
|
||||
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class PackagePublishCommand extends BaseCommand
|
||||
class PackagePublishCommand extends PackageCommand
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class PackagePublishCommand extends BaseCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$credentials = new InsecureStore();
|
||||
$credentials = $this->getCredentialsStore();
|
||||
|
||||
$registry = $input->getArgument("registry");
|
||||
$version = $input->getArgument("version");
|
||||
|
||||
@@ -13,7 +13,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
|
||||
class PackageUnpublishCommand extends BaseCommand
|
||||
class PackageUnpublishCommand extends PackageCommand
|
||||
{
|
||||
protected function configure(): void
|
||||
{
|
||||
@@ -28,7 +28,7 @@ class PackageUnpublishCommand extends BaseCommand
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$credentials = new InsecureStore();
|
||||
$credentials = $this->getCredentialsStore();
|
||||
|
||||
$providers = [
|
||||
'gitea' => new GiteaProvider($credentials)
|
||||
|
||||
Reference in New Issue
Block a user