Ejemplo n.º 1
0
 /**
  * @param $dependency_manager
  * @param $token
  * @return Updater
  */
 public function create($dependency_manager, $full_name, $token)
 {
     $this->logger->debug(__METHOD__);
     switch ($dependency_manager) {
         case 'composer':
             $manager = new ComposerDependencyManager();
             break;
         case 'npm':
             $manager = new NpmDependencyManager();
             break;
         default:
             throw new Exception("{$dependency_manager} is not supported");
             // throw exception
     }
     $client = new Client();
     $this->logger->debug(sprintf("Client::setEnterpriseUrl() %s", $this->git_hub_host));
     if (!empty($this->git_hub_host)) {
         // seems there's a bug here?
         //$client->setEnterpriseUrl($this->git_hub_host);
     }
     $git_hub_repo = new GitHubRepository($client, $full_name, $token, $this->logger);
     $git_hub_repo->authenticate();
     $temp_dir = $this->repository_dir . '/' . rand();
     $file_system = new FileSystem($temp_dir);
     $file_system->makeDirectory();
     return new Updater($git_hub_repo, $manager, $file_system, $this->logger);
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function complete()
 {
     $this->logger->debug(__METHOD__);
     $this->file_system->removeDirectory();
 }