Beispiel #1
0
 public function downloadFile(Update $update)
 {
     $targetFile = $this->getRunningFile();
     $this->logger->info(sprintf('Updating file "%s" to version "%s".', (string) $update->getVersion(), $targetFile));
     $url = $update->getUrl();
     $handler = new Ring\Client\CurlHandler();
     $response = $handler(['http_method' => 'GET', 'uri' => sprintf(':%s/%s', parse_url($url, PHP_URL_PORT), parse_url($url, PHP_URL_PATH)), 'headers' => ['scheme' => [parse_url($url, PHP_URL_SCHEME)], 'host' => [parse_url($url, PHP_URL_HOST)]], 'client' => ['save_to' => $targetFile]]);
     $response->wait();
     if (!$this->filesystem->exists($targetFile)) {
         $this->logger->error('The download of the new jarvis version failed for an unexpected reason');
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * @param Update $update
  * @param bool   $debug
  *
  * @return bool
  */
 public function downloadFile(Update $update, $debug = false)
 {
     $targetFile = $this->getRunningFile();
     $this->logger->info(sprintf('Updating file "%s" to version "%s".', (string) $update->getVersion(), $targetFile));
     $client = new \GuzzleHttp\Client(['debug' => $debug]);
     $client->request('GET', $update->getUrl(), ['sink' => $targetFile]);
     if (!$this->filesystem->exists($targetFile)) {
         $this->logger->error('The download of the new jarvis version failed for an unexpected reason');
         return false;
     }
     return true;
 }
Beispiel #3
0
 public function testIsNewer()
 {
     $this->assertTrue($this->update->isNewer(Version::create('1.0.0')));
 }
 public function testIsNewer()
 {
     $this->assertTrue($this->update->isNewer(Parser::toVersion('1.0.0')));
 }