From add25be3818fe70d50e8e55a9b6b8d96ec3c314d Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 5 Oct 2021 23:36:38 -0300 Subject: [PATCH 1/5] Composer last version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e9a4303..f233687 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "composer-plugin-api": "^2.0" }, "require-dev": { - "composer/composer": "<=2.1.5", + "composer/composer": "^2.0", "phpunit/phpunit": "^9.4" }, "autoload": { From 9d69bdfa1fd3a7c692024a039ea41bbb37d7260a Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 5 Oct 2021 23:36:47 -0300 Subject: [PATCH 2/5] Remove alias of the real Composer commands --- src/Commands/CommandNaming.php | 4 +--- src/Commands/DumpAutoloadCommand.php | 2 +- src/Commands/InstallCommand.php | 2 +- src/Commands/UpdateCommand.php | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Commands/CommandNaming.php b/src/Commands/CommandNaming.php index f8892f7..e05aed7 100644 --- a/src/Commands/CommandNaming.php +++ b/src/Commands/CommandNaming.php @@ -10,14 +10,12 @@ trait CommandNaming * Define name, aliases and add plug and play option. * * @param string $command - * @param array $aliases * * @return void */ - public function naming(string $command, array $aliases = []) + public function naming(string $command) { $this->setName($command); - $this->setAliases($aliases); $this->addOption('plug-and-play', null, InputOption::VALUE_NONE, 'Run using plug and play plugin.'); $this->addOption('plug-and-play-pretend', null, InputOption::VALUE_NONE, 'Run pretending to use plug and play plugin.'); } diff --git a/src/Commands/DumpAutoloadCommand.php b/src/Commands/DumpAutoloadCommand.php index 57a6e66..65384d6 100644 --- a/src/Commands/DumpAutoloadCommand.php +++ b/src/Commands/DumpAutoloadCommand.php @@ -12,6 +12,6 @@ protected function configure() { parent::configure(); - $this->naming('plug-and-play:dump', ['dumpautoload', 'dump-autoload']); + $this->naming('plug-and-play:dump'); } } diff --git a/src/Commands/InstallCommand.php b/src/Commands/InstallCommand.php index 69bbba9..0e305d8 100644 --- a/src/Commands/InstallCommand.php +++ b/src/Commands/InstallCommand.php @@ -12,6 +12,6 @@ protected function configure() { parent::configure(); - $this->naming('plug-and-play:install', ['i', 'install']); + $this->naming('plug-and-play:install'); } } diff --git a/src/Commands/UpdateCommand.php b/src/Commands/UpdateCommand.php index 5cbdbb9..0adc785 100644 --- a/src/Commands/UpdateCommand.php +++ b/src/Commands/UpdateCommand.php @@ -12,6 +12,6 @@ protected function configure() { parent::configure(); - $this->naming('plug-and-play:update', ['u', 'update']); + $this->naming('plug-and-play:update'); } } From b8a75b1ef9a760cf4fc76070cb1268c14295dc7f Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 5 Oct 2021 23:37:51 -0300 Subject: [PATCH 3/5] Remove option `--plug-and-play` --- src/Commands/CommandNaming.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Commands/CommandNaming.php b/src/Commands/CommandNaming.php index e05aed7..b93eef8 100644 --- a/src/Commands/CommandNaming.php +++ b/src/Commands/CommandNaming.php @@ -16,7 +16,6 @@ trait CommandNaming public function naming(string $command) { $this->setName($command); - $this->addOption('plug-and-play', null, InputOption::VALUE_NONE, 'Run using plug and play plugin.'); $this->addOption('plug-and-play-pretend', null, InputOption::VALUE_NONE, 'Run pretending to use plug and play plugin.'); } } From 83ab85d8233012688f245e31233c30ed84701650 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 5 Oct 2021 23:43:38 -0300 Subject: [PATCH 4/5] Remove tests and option implementation --- src/Commands/ComposerCreator.php | 3 +- tests/Unit/ComposerCommandsTest.php | 66 ----------------------------- 2 files changed, 1 insertion(+), 68 deletions(-) diff --git a/src/Commands/ComposerCreator.php b/src/Commands/ComposerCreator.php index 42ff782..fd1669b 100644 --- a/src/Commands/ComposerCreator.php +++ b/src/Commands/ComposerCreator.php @@ -69,9 +69,8 @@ public function getComposer($required = true, $disablePlugins = null) protected function execute(InputInterface $input, OutputInterface $output) { $isTheCommand = $input->getFirstArgument() === $this->getName(); - $hasOption = $input->getOption('plug-and-play'); - if ($isTheCommand || $hasOption) { + if ($isTheCommand) { $this->usePlugAndPlay = true; $output->writeln('You are using Composer Plug and Play Plugin.'); } diff --git a/tests/Unit/ComposerCommandsTest.php b/tests/Unit/ComposerCommandsTest.php index c49f21e..eaaccbe 100644 --- a/tests/Unit/ComposerCommandsTest.php +++ b/tests/Unit/ComposerCommandsTest.php @@ -61,70 +61,4 @@ public function testListCommand() $this->assertStringContainsString('plug-and-play:install', $content); $this->assertStringContainsString('plug-and-play:update', $content); } - - public function testInstallCommand() - { - $application = new Application(); - $input = new StringInput("install --plug-and-play --plug-and-play-pretend -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('You are using Composer Plug and Play Plugin.', $output->fetch()); - } - - public function testUpdateCommand() - { - $application = new Application(); - $input = new StringInput("update --plug-and-play --plug-and-play-pretend -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('You are using Composer Plug and Play Plugin.', $output->fetch()); - } - - public function testDumpautoloadCommand() - { - $application = new Application(); - $input = new StringInput("dumpautoload --plug-and-play --plug-and-play-pretend -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('You are using Composer Plug and Play Plugin.', $output->fetch()); - } - - public function testIfOptionIsPresentInInstallCommand() - { - $application = new Application(); - $input = new StringInput("install --help -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('--plug-and-play', $output->fetch()); - } - - public function testIfOptionIsPresentInUpdateCommand() - { - $application = new Application(); - $input = new StringInput("update --help -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('--plug-and-play', $output->fetch()); - } - - public function testIfOptionIsPresentInDumpautoloadCommand() - { - $application = new Application(); - $input = new StringInput("dumpautoload --help -d {$this->directory}"); - $output = new BufferedOutput(); - - $application->doRun($input, $output); - - $this->assertStringContainsString('--plug-and-play', $output->fetch()); - } } From b3577cf42592c3a21027b772c8be1f3bc0496712 Mon Sep 17 00:00:00 2001 From: Eder Soares Date: Tue, 5 Oct 2021 23:45:01 -0300 Subject: [PATCH 5/5] Update readme --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d309a7c..8c9270a 100644 --- a/README.md +++ b/README.md @@ -21,15 +21,15 @@ Now, you can create or clone a [Composer](https://getcomposer.org/) package into and run: ```bash -composer install --plug-and-play +composer plug-and-play:install # or -composer update --plug-and-play +composer plug-and-play:update # or -composer dump-autoload --plug-and-play +composer plug-and-play:dump ``` ### Directories and files