Esempio n. 1
0
 protected function waitLoop(OutputInterface $output)
 {
     $start = time();
     $version = $this->version->getValue();
     while ($start + $this->timeout >= time()) {
         // todo - this line should get project name
         throw new Exception("todo");
         $versions = Composer::getLibraryVersions($this->getCommandRunner($output), $this->project);
         if (in_array($version, $versions)) {
             return;
         }
         // Wait
         $this->log($output, "Version {$version} not available; checking again in 20 seconds");
         // Progress bar for 20 seconds
         $progress = new ProgressBar($output, 20);
         $progress->start();
         for ($i = 0; $i < 20; $i++) {
             $progress->advance();
             sleep(1);
         }
         $progress->finish();
         $output->writeln('');
     }
     // Timeout
     throw new Exception("Waiting for version {$version} to be available timed out after " . $this->timeout . " seconds");
 }
Esempio n. 2
0
 /**
  * Get best version to install
  *
  * @param OutputInterface $output
  * @return string
  * @throws InvalidArgumentException
  */
 protected function getBestVersion(OutputInterface $output)
 {
     $this->log($output, 'Determining best version to install');
     // Find all versions for the given recipe
     $available = Composer::getLibraryVersions($this->getCommandRunner($output), $this->getRecipe());
     // Choose based on available and preference
     $versions = $this->getVersion()->getComposerVersions();
     foreach ($versions as $version) {
         if (in_array($version, $available)) {
             return $version;
         }
     }
     throw new InvalidArgumentException("Could not install project from version " . $this->version->getValue());
 }
Esempio n. 3
0
 /**
  * @param OutputInterface $output
  * @return string
  * @throws Exception
  */
 protected function getOAUTHToken(OutputInterface $output)
 {
     $token = getenv('GITHUB_API_TOKEN');
     if (empty($token)) {
         $token = Composer::getOAUTHToken($this->getCommandRunner($output));
     }
     if (empty($token)) {
         throw new Exception("Couldn't determine GitHub oAuth token. Please set GITHUB_API_TOKEN");
     }
     return $token;
 }