Пример #1
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn(["<comment>Loading directories to tag 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) {
         if ($input->getArgument('match') && !preg_match("/{$input->getArgument('match')}/", $subDirectory)) {
             continue;
         }
         // Instantiates package from directory.
         /** @var Package $package */
         $package = new Package($subDirectory);
         $output->writeln(sprintf('<info>%s - version: %s</info>', $package->name, $package->latestTag));
         // files not committed?!
         if (!$input->getOption('force') && !$package->getChangesSinceLatestTag()) {
             $output->writeln('<comment>No commits detected since last tag, skipping.</comment>');
             continue;
         } else {
             $changes = $package->getChangesSinceLatestTag(false);
             if ($changes instanceof Collection) {
                 $changes->each(function ($item) use($output) {
                     $output->writeln($item);
                 });
             }
             $version = $this->askForVersion($input, $output, $package);
             if (empty($version)) {
                 $output->writeln('<comment>Skipped tagging, no version provided.</comment>');
                 continue;
             }
             if ($input->getOption('changelog')) {
                 $package->generateChangelog('changelogs', $package->latestTag, 'HEAD', $version);
                 $package->commit("Auto-generated changelog for {$version}.");
             }
             $package->addTag($version);
         }
         // Return to original path.
         chdir($this->directory->getCurrentPath());
     }
 }
Пример #2
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $output->writeLn(["<comment>Verifying status 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) {
         if ($input->getArgument('match') && !preg_match("/{$input->getArgument('match')}/", $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));
         // Show commit status, open, added and new.
         $output->writeln($package->getCommitState());
         $output->writeln($package->getUnpushedCommitState());
         $output->writeln($package->getChangesSinceLatestTag());
         // Return to original path.
         chdir($this->directory->getCurrentPath());
     }
 }