6 # H::T does not support gzip/deflate out of the box, but you know what?
7 # THAT'S OK BECAUSE TRAVIS' LOGSERVER DOESN'T EITHER </headdesk>
12 ( my $build_id = $ARGV[0]||'' ) =~ /^[0-9]+$/
13 or die "Expecting a numeric build id as argument\n";
15 my $base_url = "http://api.travis-ci.org/builds/$build_id";
16 print "Retrieving $base_url\n";
18 my $resp = ( my $ua = HTTP::Tiny->new )->get( $base_url );
19 die "Unable to retrieve $resp->{url}: $resp->{status}\n$resp->{content}\n\n"
20 unless $resp->{success};
23 { ( ($_->{id}||'') =~ /^([0-9]+)$/ ) ? [ $1 => $_->{number} ] : () }
24 @{( eval { decode_json( $resp->{content} )->{matrix} } || [] )}
25 ) or die "Unable to find any jobs:\n$resp->{content}\n\n";
27 my $dir = "TravisCI_build_$build_id";
33 my $log_url = "http://api.travis-ci.org/jobs/$job->[0]/log.txt";
34 my $dest_fn = "$dir/job_$job->[1].$job->[0].log";
36 print "Retrieving $log_url into $dest_fn\n";
38 $resp = $ua->mirror( $log_url, $dest_fn );
39 warn "Error retrieving $resp->{url}: $resp->{status}\n$resp->{content}\n\n"
40 unless $resp->{success};