Ejemplo n.º 1
0
 /**
  * Bootstrap the Bitbucket API for Repositories.
  *
  * @param  RepositoryInterface $repo
  * @return Repository
  */
 private function bootstrapApi(RepositoryInterface $repo)
 {
     $api = new Repository();
     $credentials = new Basic($repo->getUsername(), $repo->getPassword());
     $api->setCredentials($credentials);
     return $api;
 }
Ejemplo n.º 2
0
 /**
  * Create a new strategy instance.
  *
  * @param  StackInterface      $stack
  * @param  RepositoryInterface $repository
  * @return StrategyInterface
  * @throws StrategyNotFoundException
  */
 public function newInstance(StackInterface $stack, RepositoryInterface $repository)
 {
     $strategy = $repository->getType();
     if (!array_key_exists($strategy, $this->strategies)) {
         throw new StrategyNotFoundException(sprintf('Unable to find a strategy for `%s`', $strategy));
     }
     $class = $this->strategies[$strategy];
     if (!$this->isClassImplementingInterface($class, self::CLASS_INTERFACE)) {
         throw new \RuntimeException(sprintf('%s does not implement %s', $class, self::CLASS_INTERFACE));
     }
     return new $class($stack, $repository);
 }
Ejemplo n.º 3
0
 /**
  * Output the initialization message.
  *
  * @param  OutputInterface     $output
  * @param  RepositoryInterface $repository
  * @return void
  */
 private function outputInitialization(OutputInterface $output, RepositoryInterface $repository)
 {
     return $output->writeln(sprintf('Creating a %s %s repo called `%s/%s` on %s', $repository->getPrivate() ? 'private' : 'public', $repository->getType(), $repository->getAccount(), $repository->getName(), $repository->getService()));
 }
Ejemplo n.º 4
0
 /**
  * Get the path to the cloned vcs directory.
  *
  * @return string
  */
 protected function getClonedVcsPath()
 {
     return $this->getClonePath() . DIRECTORY_SEPARATOR . '.' . $this->repository->getType();
 }