Apply plugin modifications to Composer

@param Composer    $composer
@param IOInterface $inputOutput

@throws \Symfony\Component\Process\Exception\RuntimeException
@throws \RuntimeException
173007
public function activate(Composer $composer, IOInterface $inputOutput)
    {
        $this->composer = $composer;
        $this->inputOutput = $inputOutput;

        $packageDirectory = $this->composer->getConfig()->get('vendor-dir')
            . DIRECTORY_SEPARATOR . 'zooroyal' . DIRECTORY_SEPARATOR . 'coding-standard';
        $this->process = new Process('npm install --prefix ' . $packageDirectory);
        $this->process->setTimeout(300);
    }
1128702
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $plugin = $input->getArgument('plugin');

        $pluginExp = explode('/', $plugin);

        $packageDir = config_path().'/'.$pluginExp[0];
        $configFile = $pluginExp[1].'.php';

        if (!file_exists($packageDir)) {
            $publish = true;
        } else {
            $helper = $this->getHelper('question');
            $question = new ConfirmationQuestion(
                "$plugin already has a config script in place, are you sure you want to overwrite it? ",
                false,
                '/^yes|y/i'
            );

            $publish = $helper->ask($input, $output, $question);
        }

        if ($publish) {
            mkdir($packageDir);
            $pluginConfig = app_path().'/../vendor/'.$plugin.'/config.php';
            $publishConfig = $packageDir.'/'.$configFile;

            $file = fopen($pluginConfig, 'r');
            $content = fread($file, filesize($pluginConfig));
            fclose($file);

            $file = fopen($publishConfig, 'w');
            fwrite($file, $content);
            fclose($file);

            $output->writeln("<info>Configuration for $plugin published</info>");
        }
    }
187899
public static function addInstallers(Config $config, Composer $composer, IOInterface $io)
    {
        $im = $composer->getInstallationManager();

        $im->addInstaller(new BowerInstaller($config, $io, $composer, Assets::createType('bower')));
        $im->addInstaller(new AssetInstaller($config, $io, $composer, Assets::createType('npm')));
    }
174037
protected function execute(InputInterface $input, OutputInterface $output) : void
    {
        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);
        $repo   = new Repository();
        $args   = new Config\Options(['file' => $input->getOption('message')]);
        $name   = $input->getArgument('hook');
        $class  = '\\CaptainHook\\App\\Runner\\Hook\\' . Util::getHookCommand($name);

        /** @var \CaptainHook\App\Runner\Hook $hook */
        $hook = new $class($io, $config, $repo, $args);
        $hook->run();
    }
239364
public function activate(Composer $composer, IOInterface $io): void
    {
        $this->installer = new Installer($io, $composer);
        $this->vendorPath = $composer->getConfig()->get('vendor-dir');
        $composer->getInstallationManager()->addInstaller($this->installer);
    }
280577
public function activate(Composer $composer, IOInterface $io)
    {
        $this->composer = $composer;
        $this->io = $io;
        if(isset($this->composer->getPackage()->getExtra()['auto-require']['vendor-name'])) {
            $this->vendorName = $this->composer->getPackage()->getExtra()['auto-require']['vendor-name'];
        } else {
            $this->vendorName = 'yourpackage';
        }
        if(isset($this->composer->getPackage()->getExtra()['auto-require']['path-scheme'])) {
            $this->pathScheme = $this->composer->getPackage()->getExtra()['auto-require']['path-scheme'];
        } else {
            $this->pathScheme = '{vendorName}/{vendorName}.{name}';
        }
    }
196007
private function executeInNamespace(ComposerApplication $application, $namespace, InputInterface $input, OutputInterface $output)
    {
        if (!file_exists($namespace)) {
            mkdir($namespace, 0777, true);
        }

        $this->chdir($namespace);

        // some plugins require access to composer file e.g. Symfony Flex
        if (!file_exists(Factory::getComposerFile())) {
            file_put_contents(Factory::getComposerFile(), '{}');
        }
        
        $input = new StringInput((string) $input . ' --working-dir=.');

        $this->getIO()->writeError('<info>Run with <comment>' . $input->__toString() . '</comment></info>', true, IOInterface::VERBOSE);
        
        return $application->doRun($input, $output);
    }
1305292
public function uninstall(Composer $composer, IOInterface $io, $pluginName)
    {
        $plugin = $this->prepare(__FUNCTION__, $composer, $io, $pluginName);
        
        if ($plugin) {
            $result = $this->wp(function () use ($plugin) {
                return uninstall_plugin($plugin);
            });
            
            $this->succeeded(__FUNCTION__, $pluginName, $result === true || $result === null);
        }
    }
462491
public function execute(InputInterface $input, OutputInterface $output)
    {
        $inOut     = $this->wrapIo($input, $output);
        $container = $this->createContainer($this->getComposer(), static::NAME);

        $argAction = static::ARG_ACTION;
        $action    = $inOut->getArgument($argAction);
        switch ($action) {
            case static::ACTION_CONNECT:
                $this->executeConnect($container, $inOut);
                break;
            case static::ACTION_CREATE:
                $this->executeCreate($container, $inOut);
                break;
            default:
                $inOut->writeError("Unknown value `$action` for argument `$argAction`." . PHP_EOL);
                break;
        }
    }
33133
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $parse_command     = $this->getApplication()->find('project:parse');
        $transform_command = $this->getApplication()->find('project:transform');

        $parse_input = new ArrayInput(
            array(
                 'command'              => 'project:parse',
                 '--filename'           => $input->getOption('filename'),
                 '--directory'          => $input->getOption('directory'),
                 '--encoding'           => $input->getOption('encoding'),
                 '--extensions'         => $input->getOption('extensions'),
                 '--ignore'             => $input->getOption('ignore'),
                 '--ignore-tags'        => $input->getOption('ignore-tags'),
                 '--hidden'             => $input->getOption('hidden'),
                 '--ignore-symlinks'    => $input->getOption('ignore-symlinks'),
                 '--markers'            => $input->getOption('markers'),
                 '--title'              => $input->getOption('title'),
                 '--target'             => $input->getOption('cache-folder') ?: $input->getOption('target'),
                 '--force'              => $input->getOption('force'),
                 '--validate'           => $input->getOption('validate'),
                 '--visibility'         => $input->getOption('visibility'),
                 '--defaultpackagename' => $input->getOption('defaultpackagename'),
                 '--sourcecode'         => $input->getOption('sourcecode'),
                 '--parseprivate'       => $input->getOption('parseprivate'),
                 '--progressbar'        => $input->getOption('progressbar'),
                 '--log'                => $input->getOption('log')
            ),
            $this->getDefinition()
        );

        $return_code = $parse_command->run($parse_input, $output);
        if ($return_code !== 0) {
            return $return_code;
        }

        $transform_input = new ArrayInput(
            array(
                 'command'       => 'project:transform',
                 '--source'      => $input->getOption('cache-folder') ?: $input->getOption('target'),
                 '--target'      => $input->getOption('target'),
                 '--template'    => $input->getOption('template'),
                 '--progressbar' => $input->getOption('progressbar'),
                 '--log'         => $input->getOption('log')
            )
        );
        $return_code = $transform_command->run($transform_input, $output);
        if ($return_code !== 0) {
            return $return_code;
        }

        if ($output->getVerbosity() === OutputInterface::VERBOSITY_DEBUG) {
            /** @var ProjectDescriptorBuilder $descriptorBuilder */
            $descriptorBuilder = $this->getService('descriptor.builder');
            file_put_contents('ast.dump', serialize($descriptorBuilder->getProjectDescriptor()));
        }

        return 0;
    }
863078
public function activate(Composer $composer, IOInterface $io)
    {
        $this->io         = $io;
        $this->filesystem = new Filesystem();

        $installer = new WPPlatformInstaller($io, $composer);
        $composer->getInstallationManager()->addInstaller($installer);
        $installer = new WordPressCoreInstaller($io, $composer);
        $composer->getInstallationManager()->addInstaller($installer);
    }
759600
public function activate(Composer $composer, IOInterface $io)
    {
        $rootPackage = $composer->getPackage();
        if (isset($rootPackage)) {
            // Ensure we get the root package rather than its alias.
            while ($rootPackage instanceof AliasPackage) {
                $rootPackage = $rootPackage->getAliasOf();
            }

            // Make sure the root package can override the available scripts.
            if (method_exists($rootPackage, 'setScripts')) {
                $scripts = $rootPackage->getScripts();
                $scripts['post-update-cmd']['c33s-construction-kit-installer'] = 'C33s\ConstructionKit\ConstructionKitBuildingBlocksDetector::refreshBuildingBlocks';
                $rootPackage->setScripts($scripts);
            }
        }
    }
893976
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Available templates:');
        foreach ($this->factory->getAllNames() as $template_name) {
            $output->writeln('* '.$template_name);
        }
        $output->writeln('');
    }
94336
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->setIo($input, $output);

        $sourceDir = $this->container['config']['source.directory'];
        $outputDir = $this->container['config']['build.directory'];

        $output->writeln("<info>Compiling <path>{$sourceDir}</path> into <path>{$outputDir}</path></info>");

        $total = $this->runTimedTask(function () use ($sourceDir, $outputDir) {

            if ( ! $this->input->getOption('no-clean')) {
                $this->runCleanTask($outputDir);
            }

            $this->runBuildTask($sourceDir, $outputDir);

            if ( ! $this->input->getOption('no-gulp')) {
                $this->runGulpTask();
            }

        });

        $output->writeln("<info>Built in <time>{$total}ms</time></info>");
    }
903835
protected function initMultiVcsRepositories(Composer $composer, IOInterface $io)
    {
        $repoDownloader = new GitMultiRepoDownloader($io, $composer->getConfig());
        foreach ($this->getVcsTypes() as $type) {
            $composer->getDownloadManager()
                ->setDownloader($type, $repoDownloader);
            $composer->getRepositoryManager()
                ->setRepositoryClass($type, $this->getMultiRepositoryClassName());
        }

        return $this;
    }
1001102
protected function execute(InputInterface $input, OutputInterface $output)
    {
        /* @var $composer Composer */
        $composer = $this->getContainer()->get('anime_db.composer');
        $composer->setIO(new ConsoleIO($input, $output, $this->getHelperSet()));

        /* @var $github GitHub */
        $github = $this->getContainer()->get('anime_db.client.github');

        // search tag with new version of application
        $output->writeln('Search for a new version of the application');
        $tag = $github->getLastRelease('anime-db/anime-db');
        $tag['version'] = Composer::getVersionCompatible($tag['name']);
        $current_version = Composer::getVersionCompatible($composer->getRootPackage()->getPrettyVersion());

        // update itself
        if ($tag && version_compare($tag['version'], $current_version) == 1) {
            $this->doUpdateItself($tag, $composer, $output);
        } else {
            $output->writeln('<info>Application has already been updated to the latest version</info>');
        }
        unset($github, $tag, $current_version);

        // update from composer
        if ($composer->getInstaller()->run() === 0) {
            $output->writeln('<info>Update requirements has been completed</info>');
        } else {
            $output->writeln('<error>During updating dependencies error occurred</error>');
        }
        $output->writeln('<info>Updating the application has been completed<info>');
    }
459077
public static function create(IOInterface $io, Composer $composer, InputInterface $input): BaseInstaller
    {
        $config    = $composer->getConfig();
        $installer = new BaseInstaller(
            $io,
            $config,
            $composer->getPackage(),
            $composer->getDownloadManager(),
            $composer->getRepositoryManager(),
            $composer->getLocker(),
            $composer->getInstallationManager(),
            $composer->getEventDispatcher(),
            $composer->getAutoloadGenerator()
        );

        [$preferSource, $preferDist] = self::getPreferredInstallOptions($config, $input);

        $optimize      = self::getOption($input, 'optimize-autoloader')    || (bool) $config->get('optimize-autoloader');
        $authoritative = self::getOption($input, 'classmap-authoritative') || (bool) $config->get('classmap-authoritative');
        $apcu          = self::getOption($input, 'apcu-autoloader')        || (bool) $config->get('apcu-autoloader');

        $installer
            ->disablePlugins()
            ->setPreferSource($preferSource)
            ->setPreferDist($preferDist)
            ->setDryRun(self::getOption($input, 'dry-run'))
            ->setVerbose(self::getOption($input, 'verbose'))
            ->setDevMode(! self::getOption($input, 'no-dev'))
            ->setSuggestedPackagesReporter(new SuggestedPackagesReporter(new NullIO()))
            ->setDumpAutoloader(! self::getOption($input, 'no-autoloader'))
            ->setRunScripts(! self::getOption($input, 'no-scripts'))
            ->setOptimizeAutoloader($optimize)
            ->setClassMapAuthoritative($authoritative)
            ->setApcuAutoloader($apcu)
            ->setIgnorePlatformRequirements(self::getOption($input, 'ignore-platform-reqs'))
            ->setUpdate(true);

        return $installer;
    }