diff --git a/src/ActivationReminder/Composer/CommandProvider.php b/src/ActivationReminder/Composer/CommandProvider.php new file mode 100644 index 0000000000000000000000000000000000000000..d25a1978351227a8ff72bb8e5415bc8078b55b58 --- /dev/null +++ b/src/ActivationReminder/Composer/CommandProvider.php @@ -0,0 +1,18 @@ +<?php + +namespace WPDesk\ActivationReminder\Composer; + +/** + * Links plugin commands handlers to composer + * + * @package WPDesk\ActivationReminder\Composer + */ +class CommandProvider implements \Composer\Plugin\Capability\CommandProvider +{ + public function getCommands() + { + return [ + new PrepareActivationReminderCommand(), + ]; + } +} \ No newline at end of file diff --git a/src/ActivationReminder/Composer/Plugin.php b/src/ActivationReminder/Composer/Plugin.php index 838f4bb3d01b848c98c5644763b3af0072494ea9..e7bb64dff3779befddf2fea4006b7bed8d9aa3ba 100644 --- a/src/ActivationReminder/Composer/Plugin.php +++ b/src/ActivationReminder/Composer/Plugin.php @@ -67,12 +67,21 @@ class Plugin implements PluginInterface, EventSubscriberInterface { $this->io = $io; } + /** + * @inheritDoc + */ + public function getCapabilities(): array + { + return [ + \Composer\Plugin\Capability\CommandProvider::class => CommandProvider::class + ]; + } /** * @param Event $event */ public function generateReminder(Event $event) { - error_log('generate reminder'); + passthru("composer prepare-activation-reminder"); } } diff --git a/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php b/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php new file mode 100644 index 0000000000000000000000000000000000000000..b19531666db30b8541a81931f1b51d59c84be50c --- /dev/null +++ b/src/ActivationReminder/Composer/PrepareActivationReminderCommand.php @@ -0,0 +1,36 @@ +<?php + +namespace WPDesk\ActivationReminder\Composer; + +use Composer\Command\BaseCommand; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + + +/** + * Can prepare activation reminder for plugin. + * + * @package WPDesk\Composer\GitPlugin\Command + */ +class PrepareActivationReminderCommand extends BaseCommand +{ + + protected function configure() + { + $this + ->setName('prepare-activation-reminder') + ->setDescription('Prepares activation reminder for WP Desk plugin.'); + } + + /** + * Execute command. + * + * @param InputInterface $input + * @param OutputInterface $output + * @return int|void|null + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $output->writeln("Activation reminder created."); + } +}