Beispiel #1
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn(["<comment>Loading directories to pull for: {$this->directory->getPath()}</comment>", '']);
     if ($this->directory->getSubdirectories()->isEmpty()) {
         $output->writeln('<error>No subdirectories found.</error>');
         return;
     }
     // Loop through all directories to search for repositories.
     foreach ($this->directory->getSubdirectories() as $subDirectory) {
         $quotedMatch = preg_quote(rtrim($input->getArgument('match'), DIRECTORY_SEPARATOR));
         if ($input->getArgument('match') && !preg_match("/{$quotedMatch}/", $subDirectory)) {
             $output->writeln("<comment>Skipped {$subDirectory}</comment>");
             continue;
         }
         // Instantiates package from directory.
         $package = new Package($subDirectory);
         $output->writeln(sprintf('<info>%s - version: %s</info>', $package->name, $package->latestTag));
         $package->push();
         // Return to original path.
         chdir($this->directory->getCurrentPath());
     }
 }