2016-04-28 19:37:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Installer;
|
|
|
|
|
|
|
|
use Composer\Plugin\Capability\CommandProvider;
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use Composer\Command\BaseCommand;
|
|
|
|
|
|
|
|
class CommandProvider implements CommandProvider
|
|
|
|
{
|
|
|
|
public function __construct(array $args)
|
|
|
|
{
|
2016-04-28 20:12:26 +00:00
|
|
|
if (!$args['composer'] instanceof \Composer\Composer) {
|
|
|
|
throw new \RuntimeException('Expected a "composer" key');
|
|
|
|
}
|
|
|
|
if (!$args['io'] instanceof \Composer\IO\IOInterface) {
|
|
|
|
throw new \RuntimeException('Expected an "io" key');
|
|
|
|
}
|
|
|
|
if (!$args['plugin'] instanceof Plugin8) {
|
|
|
|
throw new \RuntimeException('Expected a "plugin" key with my own plugin');
|
|
|
|
}
|
2016-04-28 19:37:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getCommands()
|
|
|
|
{
|
|
|
|
return array(new Command);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Command extends BaseCommand
|
|
|
|
{
|
|
|
|
protected function configure()
|
|
|
|
{
|
|
|
|
$this->setName('custom-plugin-command');
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
|
|
{
|
2016-04-28 20:12:26 +00:00
|
|
|
$output->writeln('Executing');
|
|
|
|
|
2016-04-28 19:37:34 +00:00
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}
|