/** * @param InputInterface $input The input instance * @param OutputInterface $output The output instance */ protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>First getting all dependencies</info>'); $this->guzzle = new Client('http://packagist.org'); $medusaConfig = $input->getArgument('config'); $config = json_decode(file_get_contents($medusaConfig)); $repos = array(); if (!$config) { throw new \Exception($medusaConfig . ': invalid json configuration'); } foreach ($config->repositories as $repository) { if (property_exists($repository, 'name')) { $repos[] = $repository->name; } } foreach ($config->require as $dependency) { $output->writeln(' - Getting dependencies for <info>' . $dependency . '</info>'); $resolver = new DependencyResolver($dependency); $deps = $resolver->resolve(); $repos = array_merge($repos, $deps); } $repos = array_unique($repos); $output->writeln('<info>Create mirror repositories</info>'); foreach ($repos as $repo) { $command = $this->getApplication()->find('add'); $arguments = array('command' => 'add', 'package' => $repo, 'config' => $medusaConfig); $input = new ArrayInput($arguments); $returnCode = $command->run($input, $output); } }
protected function mirrorPackagistAndRepositories($withDependencies, $package) { $deps = array($package); if ($withDependencies) { $resolver = new DependencyResolver($package); $deps = $resolver->resolve(); } foreach ($deps as $package) { $this->output->writeln(' - Mirroring <info>' . $package . '</info>'); $this->getGitRepo($package); $this->output->writeln(''); $this->updateSatisConfig($package); } }