diff --git a/src/Buse/Command/AbstractCommand.php b/src/Buse/Command/AbstractCommand.php index 286c27d..7eb80cb 100644 --- a/src/Buse/Command/AbstractCommand.php +++ b/src/Buse/Command/AbstractCommand.php @@ -12,6 +12,8 @@ class AbstractCommand extends Command implements ContainerAwareInterface { + const MAX_PROCESSES = 10; + private $container; private $groups = []; @@ -143,10 +145,14 @@ public function display(array $repositories, array $formatters) protected function runProcesses(array $repositories, array $processes, array $formatters) { + $running = 0; while (count($processes) > 0) { foreach ($processes as $i => $process) { if (!$process->isStarted()) { - $process->start(); + if ($running < self::MAX_PROCESSES) { + $running++; + $process->start(); + } continue; } @@ -161,6 +167,7 @@ protected function runProcesses(array $repositories, array $processes, array $fo if (!$process->isRunning()) { $formatters[$i]->finish($process->getExitCode()); + $running--; unset($processes[$i]); } } diff --git a/src/Buse/Command/CloneCommand.php b/src/Buse/Command/CloneCommand.php index 42a494c..b7a809e 100644 --- a/src/Buse/Command/CloneCommand.php +++ b/src/Buse/Command/CloneCommand.php @@ -42,7 +42,7 @@ protected function cloneGroup($group, $repositoriesConfig, $prefix) $dir = $prefix.$dir; $repositories[] = $dir; - $formatters[] = new Spinner(sprintf('Cloning %s...', $url), 'Done'); + $formatters[] = new Spinner(sprintf('Waiting to clone %s...', $url), 'Done'); $processes[] = $this->getProcess($dir, 'git', ['clone', $url, $dir]); } diff --git a/src/Buse/Command/Fetch.php b/src/Buse/Command/Fetch.php index dc8f353..08549a1 100644 --- a/src/Buse/Command/Fetch.php +++ b/src/Buse/Command/Fetch.php @@ -38,7 +38,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $formatters = []; $processes = []; foreach ($repositories as $repo) { - $formatters[] = new Spinner(sprintf('fetching %s...', $remote), 'Done'); + $formatters[] = new Spinner(sprintf('Waiting to fetch %s...', $remote), 'Done'); $processes[] = $this->getProcess($repo, 'git', $args); } diff --git a/src/Buse/Command/Pull.php b/src/Buse/Command/Pull.php index 218b955..0a295b8 100644 --- a/src/Buse/Command/Pull.php +++ b/src/Buse/Command/Pull.php @@ -69,7 +69,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $formatters = []; $processes = []; foreach ($repositories as $repo) { - $formatters[] = new Spinner(sprintf('pulling %s...', $ref)); + $formatters[] = new Spinner(sprintf('Waiting to pull %s...', $ref)); $processes[] = $this->getProcess($repo, 'git', $args); } diff --git a/src/Buse/Command/Push.php b/src/Buse/Command/Push.php index 8bef932..c2399dc 100644 --- a/src/Buse/Command/Push.php +++ b/src/Buse/Command/Push.php @@ -51,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $formatters = []; $processes = []; foreach ($repositories as $repo) { - $formatters[] = new Spinner(sprintf('pushing %s...', $ref)); + $formatters[] = new Spinner(sprintf('Waiting to push %s...', $ref)); $processes[] = $this->getProcess($repo, 'git', $args); } diff --git a/src/Buse/Command/Tag.php b/src/Buse/Command/Tag.php index 08fef77..324ff30 100644 --- a/src/Buse/Command/Tag.php +++ b/src/Buse/Command/Tag.php @@ -61,10 +61,10 @@ protected function displayTags(array $repositories) protected function createTag(InputInterface $input, array $repositories, $tagName) { $args = ['tag']; - $message = 'tagging tag %s...'; + $message = 'Waiting to tag %s...'; if ($input->getOption('delete')) { $args[] = '--delete'; - $message = 'deleting tag %s...'; + $message = 'Waiting to delete tag %s...'; } $args[] = $tagName;