alienfile

filter: Statementstmt 76.4% 26 / 34 Branchbran 30.0% 6 / 20 Conditioncond 8.3% 1 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 48.1% 38 / 79 CC 15 SCAR 40.5
CC
15
Cov
50%
__ANON__
72.5
BEGIN
1.0
BEGIN
1.0
CRAP 57.5
↑ Summary blib/lib/Alien/ghostunnel.pm »
1 1 ▶use alienfile;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Path::Tiny qw( path );
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use File::Which qw( which );
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶configure {
Subroutine __ANON__: called CC=1 SCAR=0.0
6 1 requires 'Path::Tiny';
7 1 requires 'File::Which';
8 1 };
9  
10 1 plugin 'Probe::CommandLine' => (
11 command => 'ghostunnel',
12 args => '--version',
13 );
14  
15 1 ▶share {
Subroutine __ANON__: called CC=15 SCAR=42.8
16  
17 1 my $asset_name;
18  
19 1 my $cpu = meta->prop->{platform}->{cpu}->{arch}->{name};
20  
21 1 ▶ if($^O eq 'linux' && $cpu eq 'x86_64')
Branch: 4 branches
BranchTrueFalseTotal
if ($^O eq 'linux' and $cpu eq 'x86_64') { } 1 0 1
elsif ($^O eq 'darwin' and $cpu eq 'x86_64') { } 0 0 0
elsif ($^O eq 'darwin' and $cpu eq 'aarch64') { } 0 0 0
elsif ($^O eq 'MSWin32' and $cpu eq 'x86_64') { } 0 0 0
Condition33%1/3
$^O eq "linux" and $cpu eq "x86_64"
!ll&&!rl&&r
001
MC/DC0%0/2
$^O eq "linux" and $cpu eq "x86_64"
$^O eq "linux" $cpu eq "x86_64"
Truth table33%1/3
A and B
A= $^O eq "linux"B= $cpu eq "x86_64"
ABresult
0X0
100
111
22 {
23 1 $asset_name = 'ghostunnel-linux-amd64';
24 }
25 ▶ elsif($^O eq 'darwin' && $cpu eq 'x86_64')
Condition0%0/3
$^O eq "darwin" and $cpu eq "x86_64"
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "darwin" and $cpu eq "x86_64"
$^O eq "darwin" $cpu eq "x86_64"
Truth table0%0/3
A and B
A= $^O eq "darwin"B= $cpu eq "x86_64"
ABresult
0X0
100
111
26 {
27 0 $asset_name = 'ghostunnel-darwin-amd64';
28 }
29 ▶ elsif($^O eq 'darwin' && $cpu eq 'aarch64')
Condition0%0/3
$^O eq "darwin" and $cpu eq "aarch64"
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "darwin" and $cpu eq "aarch64"
$^O eq "darwin" $cpu eq "aarch64"
Truth table0%0/3
A and B
A= $^O eq "darwin"B= $cpu eq "aarch64"
ABresult
0X0
100
111
30 {
31 0 $asset_name = 'ghostunnel-darwin-arm64';
32 }
33 ▶ elsif($^O eq 'MSWin32' && $cpu eq 'x86_64')
Condition0%0/3
$^O eq "MSWin32" and $cpu eq "x86_64"
!ll&&!rl&&r
000
MC/DC0%0/2
$^O eq "MSWin32" and $cpu eq "x86_64"
$^O eq "MSWin32" $cpu eq "x86_64"
Truth table0%0/3
A and B
A= $^O eq "MSWin32"B= $cpu eq "x86_64"
ABresult
0X0
100
111
34 {
35 0 $asset_name = 'ghostunnel-windows-amd64';
36 }
37  
38 1 ▶ undef $asset_name if $ENV{ALIEN_GHOSTUNNEL_SOURCE};
Branch: 1 branch
BranchTrueFalseTotal
if $ENV{"ALIEN_GHOSTUNNEL_SOURCE"} 0 1 1
39  
40 1 ▶ plugin 'Download::GitHub' => (
Branch: 1 branch
BranchTrueFalseTotal
$asset_name ? : 1 0 1
41 github_user => 'ghostunnel',
42 github_repo => 'ghostunnel',
43 $asset_name ? (asset => 1, asset_name => qr/^$asset_name$/, asset_format => 'f') : (),
44 );
45  
46 1 ▶ if($asset_name)
Branch: 2 branches
BranchTrueFalseTotal
if ($asset_name) { } 1 0 1
elsif (my $go = which('go')) { } 0 0 0
47 {
48 1 my $exe = "ghostunnel";
49 1 ▶ $exe .= ".exe" if $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
if $^O eq "MSWin32" 0 1 1
50  
51 1 my @build = (
52 '%{make_path} %{.install.prefix}/bin',
53 "%{cp} %{.install.extract}/$asset_name %{.install.prefix}/bin/$exe",
54 );
55 1 ▶ push @build, "chmod +x %{.install.prefix}/bin/$exe" unless $^O eq 'MSWin32';
Branch: 1 branch
BranchTrueFalseTotal
unless $^O eq "MSWin32" 1 0 1
56  
57 1 build \@build;
58 }
59 elsif(my $go = which('go'))
60 {
61 0 plugin 'Build::Make' => 'umake';
62 0 Alien::Build->log("no binary for your platform must build from source");
63 0 build [
64 '%{make} ghostunnel',
65 '%{make_path} %{.install.prefix}/bin',
66 '%{cp} %{.install.extract}/ghostunnel %{.install.prefix}/bin/ghostunnel',
67 ];
68 }
69 else
70 {
71 0 Alien::Build->log("no binary for your platform and no Go compiler");
72 0 die "no binary for your platform and no Go compiler";
73 }
74 1 };
↑ Summary blib/lib/Alien/ghostunnel.pm »