blib/lib/auto/share/dist/Ukigumo-Server/eg/perlish-client.pl untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 54 CC 1 SCAR 6.9
CC
1
Cov
0%
run
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use utf8;
5 use Capture::Tiny qw(tee_merged);
6 use LWP::UserAgent;
7  
8 my $UKIGUMO_SERVER = 'http://localhost:9052';
9  
10 my $failed = 0;
11 sub run {
12 system(@_)==0 or die "FAIL: @_";
13 }
14  
15 my $body = tee_merged {
16 eval {
17 run("git pull");
18 run("git status");
19 run("perl Makefile.PL");
20 run("make test");
21 };
22 if ($@) {
23 $failed++;
24 warn $@;
25 }
26 };
27  
28 my $revision = substr( `git rev-parse HEAD`, 0, 10 ) || 'Unknown';
29 my $branch = `git branch|grep '^*'`;
30 $branch =~ s/^\* //;
31 $branch =~ s/\s*$//;
32 my $repository = `git remote -v | head -1| awk '{print \$2}'`;
33 $repository =~ s/\n//;
34  
35 print "'$revision', '$repository', '$branch'\n";
36  
37 my $ua = LWP::UserAgent->new();
38 my $res = $ua->post(
39 "$UKIGUMO_SERVER/api/v1/report/add",
40 [
41 status => $failed ? 2 : 1, # status code: SUCCESS:1, FAIL:2, N/A:3
42 project => 'MyProj', # project name
43 branch => $branch, # branch name
44 revision => $revision,
45 repo => $repository,
46 ]
47 );
48 $res->is_success or die $res->as_string;
49  
50 # and you can send a report to the developers.
51 # by ikachan, im.kayac.com, mail, etc.
52