public function executeActions(Repository $repository, InputInterface $input, OutputInterface $output, array &$synchronizedPaths = array()) { $this->environment->setRepository($repository); $path = $this->environment->getPlaceholderReplacer()->replace($this->environment->getConfiguration()->getStoragePath() . DIRECTORY_SEPARATOR . $this->environment->getConfiguration()->getDirectoryScheme(), $this->environment); $this->environment->setPath($path); switch ($repository->getType()) { case Repository::TYPE_GIT: $vcs = new GitRepository($path); if ($input->getOption('sync')) { $sync = new SyncCommand(); $sync->setEnvironment($this->environment); $sync->sync($repository, $input, $output, $synchronizedPaths); $this->environment->setRepository($repository); $this->environment->setPath($path); } if (!$vcs->isInitialized()) { throw new NotSynchronizedRepository(sprintf('The repository %s/%s is not synchronized', $repository->getOwner(), $repository->getName())); } $vcs->checkout()->force()->execute($repository->getRealRef()); break; default: // TODO throw new \Exception('Incomplete implementation'); } $action = $this->environment->getConfiguration()->getAction(); if (!$action) { throw new IncompleteConfigurationException('No actions configured'); } if ($output->getVerbosity() > OutputInterface::VERBOSITY_NORMAL) { $output->writeln(sprintf(' * <info>ccabs:repositories:execute</info> run action on repository <comment>%s</comment>', $path)); } $this->environment->setVcs($vcs); $action->run($this->environment); $this->environment->setVcs(null); $this->environment->setPath(null); $this->environment->setRepository(null); }
/** * @covers \ContaoCommunityAlliance\BuildSystem\Repository\GitRepository::isInitialized */ public function testIsInitialized() { $this->assertTrue($this->initializedGitRepository->isInitialized()); $this->assertFalse($this->uninitializedGitRepository->isInitialized()); }