Skip to content

Commit

Permalink
Merge pull request #8 from studio24/show-summary_update
Browse files Browse the repository at this point in the history
Show summary update
  • Loading branch information
AlanJIsaacson authored Mar 30, 2021
2 parents 2d9d751 + 2666086 commit f04130f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/show-summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

use Symfony\Component\HttpClient\HttpClient;
use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;

desc('Display the build_summary from the webserver');
task('s24:show-summary', function () {
// Check for build file
$client = HttpClient::create();
$buildUrl = get('url') . '/_build_summary.json';
$response = $client->request('GET', $buildUrl);
$statusCode = $response->getStatusCode();

try {
$statusCode = $response->getStatusCode();
} catch (TransportExceptionInterface $e) {
writeLn(sprintf('<comment>The build_summary.json file is unavailable. HTTP transport error: %s</comment>', $e->getMessage()));
return;
}

if ($statusCode != '200') {
writeLn(sprintf('<comment>The build_summary.json file is unavailable with the status code</> <info>%s</> ', $statusCode));
Expand Down

0 comments on commit f04130f

Please sign in to comment.