| 1 | #!perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use 5.014; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | #use lib::findbin '../lib'; # dev-only | ||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use App::af; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use File::chdir; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | # PODNAME: af | ||||||||||||||||||||||||||||
| 11 | # ABSTRACT: Command line tool for alienfile | ||||||||||||||||||||||||||||
| 12 | # VERSION | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 6 | package App::af::download 0.18 { | |||||||||||||||||||||||||||
| 16 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use MooseX::Types::Path::Tiny qw( AbsPath ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 22 | 6 | with 'App::af::role::alienfile'; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 6 | has local => ( | |||||||||||||||||||||||||||
| 26 | is => 'ro', | ||||||||||||||||||||||||||||
| 27 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 28 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 29 | short => 'l', | ||||||||||||||||||||||||||||
| 30 | coerce => 1, | ||||||||||||||||||||||||||||
| 31 | opt_type => 's', | ||||||||||||||||||||||||||||
| 32 | default => '.', | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | sub main | ||||||||||||||||||||||||||||
| 36 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=9 SCAR=23.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 4 | my($self) = @_; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 4 | ▶ | unless(-d $self->local) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||
| 41 | 0 | say STDERR "no such directory: @{[ $self->local ]}"; | |||||||||||||||||||||||||||
| 42 | 0 | return 2; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 4 | local $ENV{ALIEN_INSTALL_TYPE} = 'share'; | |||||||||||||||||||||||||||
| 46 | 4 | my $build = $self->build; | |||||||||||||||||||||||||||
| 47 | 4 | $build->load_requires('configure'); | |||||||||||||||||||||||||||
| 48 | 4 | $build->load_requires('share'); | |||||||||||||||||||||||||||
| 49 | 4 | eval { $build->download }; | |||||||||||||||||||||||||||
| 50 | 4 | ▶ | warn $@ if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 4 | ▶ | unless(defined $build->install_prop->{download} && | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $build->install_prop->{"download"} and length $build->install_prop->{"download"}
MC/DC50%1/2
defined $build->install_prop->{"download"} and length $build->install_prop->{"download"}
defined $build->install_prop->{"download"}
length $build->install_prop->{"download"}
Truth table66%2/3
A and B
A= defined $build->install_prop->{"download"}B= length $build->install_prop->{"download"}
| |||||||||||||||||||||||||||||
| 53 | length $build->install_prop->{download}) | ||||||||||||||||||||||||||||
| 54 | { | ||||||||||||||||||||||||||||
| 55 | 1 | say STDERR "Recipe did not seem to download a file or directory"; | |||||||||||||||||||||||||||
| 56 | 1 | return 2; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 3 | my $download = path($build->install_prop->{download}); | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 3 | ▶ | if(-f $download) | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 62 | { | ||||||||||||||||||||||||||||
| 63 | 2 | my $to = $self->local->child($download->basename); | |||||||||||||||||||||||||||
| 64 | 2 | ▶ | $download->copy($to) || die "unable to copy $download => $to $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | 2 | say "Wrote archive to $to"; | |||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | elsif(-d $download) | ||||||||||||||||||||||||||||
| 68 | { | ||||||||||||||||||||||||||||
| 69 | 1 | require File::Copy::Recursive; | |||||||||||||||||||||||||||
| 70 | 1 | my $to = $self->local->child($download->basename); | |||||||||||||||||||||||||||
| 71 | 1 | ▶ | File::Copy::Recursive::dircopy("$download", "$to") || die "unable to copy $download => $to $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | 1 | say "Wrote directory to $to"; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | else | ||||||||||||||||||||||||||||
| 75 | { | ||||||||||||||||||||||||||||
| 76 | 0 | say STDERR "Recipe did not seem to download a file or directory"; | |||||||||||||||||||||||||||
| 77 | 0 | return 2; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 3 | 0; | |||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 6 | package App::af::probe 0.18 { | |||||||||||||||||||||||||||
| 87 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 89 | 6 | ▶ | use MooseX::Types::Path::Tiny qw( AbsPath ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | 6 | ▶ | use File::Temp qw( tempdir ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 93 | 6 | with 'App::af::role::alienfile'; | |||||||||||||||||||||||||||
| 94 | 6 | with 'App::af::role::libandblib'; | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | has root => ( | ||||||||||||||||||||||||||||
| 98 | is => 'ro', | ||||||||||||||||||||||||||||
| 99 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 100 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 101 | opt_type => 's', | ||||||||||||||||||||||||||||
| 102 | coerce => 1, | ||||||||||||||||||||||||||||
| 103 | lazy => 1, | ||||||||||||||||||||||||||||
| 104 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 105 | 0 | shift->_tmp->child('root'); | |||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||
| 107 | 6 | ); | |||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | has _tmp => ( | ||||||||||||||||||||||||||||
| 110 | is => 'ro', | ||||||||||||||||||||||||||||
| 111 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 112 | lazy => 1, | ||||||||||||||||||||||||||||
| 113 | 0 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 114 | 0 | my $dir = Path::Tiny->new(tempdir( CLEANUP => 1)); | |||||||||||||||||||||||||||
| 115 | 0 | $dir->child($_)->mkpath for qw( root stage prefix ); | |||||||||||||||||||||||||||
| 116 | 0 | $dir; | |||||||||||||||||||||||||||
| 117 | }, | ||||||||||||||||||||||||||||
| 118 | 6 | ); | |||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | sub main | ||||||||||||||||||||||||||||
| 121 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 122 | 0 | my($self) = @_; | |||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | my $build = $self->build( root => $self->root->stringify ); | |||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 0 | $build->set_stage($self->_tmp->child('stage')->stringify); | |||||||||||||||||||||||||||
| 127 | 0 | $build->set_prefix($self->_tmp->child('prefix')->stringify); | |||||||||||||||||||||||||||
| 128 | 0 | $build->load_requires('configure'); | |||||||||||||||||||||||||||
| 129 | 0 | my $type = $build->install_type; | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 0 | say "install type: $type"; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | 0; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 6 | package App::af::install 0.18 { | |||||||||||||||||||||||||||
| 138 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 139 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 140 | 6 | ▶ | use File::Temp qw( tempdir ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 141 | 6 | ▶ | use MooseX::Types::Path::Tiny qw( AbsPath ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 142 | 6 | ▶ | use YAML qw( Dump ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | 6 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 146 | 6 | with 'App::af::role::alienfile'; | |||||||||||||||||||||||||||
| 147 | 6 | with 'App::af::role::libandblib'; | |||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | has stage => ( | ||||||||||||||||||||||||||||
| 151 | is => 'ro', | ||||||||||||||||||||||||||||
| 152 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 153 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 154 | coerce => 1, | ||||||||||||||||||||||||||||
| 155 | lazy => 1, | ||||||||||||||||||||||||||||
| 156 | opt_type => 's', | ||||||||||||||||||||||||||||
| 157 | 1 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 158 | 1 | tempdir( CLEANUP => 1); | |||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||
| 160 | 6 | ); | |||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | 6 | has prefix => ( | |||||||||||||||||||||||||||
| 163 | is => 'rw', | ||||||||||||||||||||||||||||
| 164 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 165 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 166 | opt_type => 's', | ||||||||||||||||||||||||||||
| 167 | coerce => 1, | ||||||||||||||||||||||||||||
| 168 | ); | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 6 | has type => ( | |||||||||||||||||||||||||||
| 171 | is => 'ro', | ||||||||||||||||||||||||||||
| 172 | isa => 'Str', | ||||||||||||||||||||||||||||
| 173 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 174 | opt_type => 's', | ||||||||||||||||||||||||||||
| 175 | ); | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | 6 | has dry_run => ( | |||||||||||||||||||||||||||
| 178 | is => 'ro', | ||||||||||||||||||||||||||||
| 179 | isa => 'Int', | ||||||||||||||||||||||||||||
| 180 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 181 | ); | ||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | has root => ( | ||||||||||||||||||||||||||||
| 184 | is => 'ro', | ||||||||||||||||||||||||||||
| 185 | isa => AbsPath, | ||||||||||||||||||||||||||||
| 186 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 187 | opt_type => 's', | ||||||||||||||||||||||||||||
| 188 | coerce => 1, | ||||||||||||||||||||||||||||
| 189 | lazy => 1, | ||||||||||||||||||||||||||||
| 190 | 2 | ▶ | default => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 191 | 2 | tempdir( CLEANUP => 1); | |||||||||||||||||||||||||||
| 192 | }, | ||||||||||||||||||||||||||||
| 193 | 6 | ); | |||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 6 | has before => ( | |||||||||||||||||||||||||||
| 196 | is => 'ro', | ||||||||||||||||||||||||||||
| 197 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 198 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 199 | opt_type => 's{2}', | ||||||||||||||||||||||||||||
| 200 | ); | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | 6 | has after => ( | |||||||||||||||||||||||||||
| 203 | is => 'ro', | ||||||||||||||||||||||||||||
| 204 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||
| 205 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 206 | opt_type => 's{2}', | ||||||||||||||||||||||||||||
| 207 | ); | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | sub main | ||||||||||||||||||||||||||||
| 210 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=23 SCAR=50.2
| |||||||||||||||||||||||||||||
| 211 | 2 | my($self) = @_; | |||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | 2 | local $ENV{ALIEN_INSTALL_TYPE} = $ENV{ALIEN_INSTALL_TYPE}; | |||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | 2 | ▶ | if(defined $self->type) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||
| 217 | 0 | ▶ | unless($self->type =~ /^(share|system)$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 218 | { | ||||||||||||||||||||||||||||
| 219 | 0 | say STDERR "unknown install type: @{[ $self->type ]}"; | |||||||||||||||||||||||||||
| 220 | 0 | return 2; | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | 0 | $ENV{ALIEN_INSTALL_TYPE} = $self->type; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | 2 | ▶ | if(-d $self->stage && $self->stage->children) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
-d $self->stage and $self->stage->children
MC/DC0%0/2
-d $self->stage and $self->stage->children
-d $self->stage
$self->stage->children
Truth table66%2/3
A and B
A= -d $self->stageB= $self->stage->children
| |||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||
| 227 | 0 | say "stage directory is not empty"; | |||||||||||||||||||||||||||
| 228 | 0 | exit 2; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | 2 | my($build, $prefix) = $self->build( root => $self->root->stringify ); | |||||||||||||||||||||||||||
| 232 | 2 | ▶ | $self->prefix($prefix) if defined($prefix) && ! $self->prefix; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $prefix and not $self->prefix
MC/DC0%0/2
defined $prefix and not $self->prefix
defined $prefix
not $self->prefix
Truth table33%1/3
A and not(B)
A= defined $prefixB= not $self->prefix
| |||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 2 | my @all_hooks = qw( | |||||||||||||||||||||||||||
| 235 | probe download fetch decode prefer extract patch | ||||||||||||||||||||||||||||
| 236 | build stage gather_share gather_system | ||||||||||||||||||||||||||||
| 237 | ); | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $repl = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=13.4
| |||||||||||||||||||||||||||||
| 240 | 6 | ▶ | no warnings 'once'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 241 | 0 | require Shell::Perl; | |||||||||||||||||||||||||||
| 242 | 0 | my $pirl = Shell::Perl->new(on_quit => 'return'); | |||||||||||||||||||||||||||
| 243 | 0 | $pirl->set_package("App::af::pirl"); | |||||||||||||||||||||||||||
| 244 | 0 | $App::af::pirl::build = $build; | |||||||||||||||||||||||||||
| 245 | 0 | $App::af::pirl::meta = $build->meta; | |||||||||||||||||||||||||||
| 246 | 0 | eval { $pirl->run }; | |||||||||||||||||||||||||||
| 247 | 0 | ▶ | warn $@ if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 2 | }; | |||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 2 | ▶ | while(@{ $self->before }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||
| 252 | 0 | my $hook = shift @{ $self->before }; | |||||||||||||||||||||||||||
| 253 | 0 | my $command = shift @{ $self->before }; | |||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 0 | ▶ | my @hook = $hook =~ /^(\%|\*)$/ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | ? @all_hooks | ||||||||||||||||||||||||||||
| 257 | : ($hook); | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | $build->meta->before_hook( | ||||||||||||||||||||||||||||
| 260 | 0 | ▶ | $_ => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 261 | 0 | my($build) = @_; | |||||||||||||||||||||||||||
| 262 | 0 | $build->log(" [ before @{[ $build->hook_prop->{name} ]} ] + $command"); | |||||||||||||||||||||||||||
| 263 | 0 | $build->checkpoint; | |||||||||||||||||||||||||||
| 264 | 0 | ▶ | $command eq ':repl' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 265 | ? $repl->() | ||||||||||||||||||||||||||||
| 266 | : $build->system($command); | ||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||
| 268 | 0 | ) for @hook; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 2 | ▶ | while(@{ $self->after }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 272 | { | ||||||||||||||||||||||||||||
| 273 | 0 | my $hook = shift @{ $self->after }; | |||||||||||||||||||||||||||
| 274 | 0 | my $command = shift @{ $self->after }; | |||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||
| 276 | 0 | ▶ | my @hook = $hook =~ /^(\%|\*)$/ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 277 | ? @all_hooks | ||||||||||||||||||||||||||||
| 278 | : ($hook); | ||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||
| 280 | $build->meta->around_hook( | ||||||||||||||||||||||||||||
| 281 | 0 | ▶ | $_ => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 282 | 0 | my $orig = shift; | |||||||||||||||||||||||||||
| 283 | 0 | my $ret = eval { $orig->(@_) }; | |||||||||||||||||||||||||||
| 284 | 0 | my $error = $@; | |||||||||||||||||||||||||||
| 285 | 0 | $build->log(" [ after @{[ $build->hook_prop->{name} ]} ] + $command"); | |||||||||||||||||||||||||||
| 286 | 0 | $build->checkpoint; | |||||||||||||||||||||||||||
| 287 | 0 | ▶ | $command eq ':repl' | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 288 | ? $repl->() | ||||||||||||||||||||||||||||
| 289 | : $build->system($command); | ||||||||||||||||||||||||||||
| 290 | 0 | ▶ | die $error if $error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 291 | 0 | $ret; | |||||||||||||||||||||||||||
| 292 | }, | ||||||||||||||||||||||||||||
| 293 | 0 | ) for @hook | |||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | 2 | ▶ | if($self->dry_run && ! defined $self->prefix) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->dry_run and not defined $self->prefix
MC/DC50%1/2
$self->dry_run and not defined $self->prefix
$self->dry_run
not defined $self->prefix
Truth table66%2/3
A and not(B)
A= $self->dry_runB= not defined $self->prefix
| |||||||||||||||||||||||||||||
| 298 | { | ||||||||||||||||||||||||||||
| 299 | 1 | $self->prefix(tempdir( CLEANUP => 1 )); | |||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||
| 302 | 2 | ▶ | unless(defined $self->prefix) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | { | ||||||||||||||||||||||||||||
| 304 | 0 | say STDERR "You must specify a prefix with --prefix or use --dry-run"; | |||||||||||||||||||||||||||
| 305 | 0 | return 2; | |||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 2 | ▶ | if(-d $self->prefix->child('_alien')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 309 | { | ||||||||||||||||||||||||||||
| 310 | 0 | my $test = $self->prefix->child('_alien/test'); | |||||||||||||||||||||||||||
| 311 | 0 | eval { $test->touch }; | |||||||||||||||||||||||||||
| 312 | 0 | ▶ | if($@) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 313 | { | ||||||||||||||||||||||||||||
| 314 | 0 | say STDERR "prefix is not writable. You may need to use su or sudo"; | |||||||||||||||||||||||||||
| 315 | 0 | return 2; | |||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||
| 317 | 0 | $test->remove; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | 2 | $build->set_stage($self->stage->stringify); | |||||||||||||||||||||||||||
| 321 | 2 | $build->set_prefix($self->prefix->stringify); | |||||||||||||||||||||||||||
| 322 | 2 | $build->load_requires('configure'); | |||||||||||||||||||||||||||
| 323 | 2 | $build->load_requires($build->install_type); | |||||||||||||||||||||||||||
| 324 | 2 | $build->download; | |||||||||||||||||||||||||||
| 325 | 2 | $build->build; | |||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | 2 | ▶ | unless($self->dry_run) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | { | ||||||||||||||||||||||||||||
| 329 | 1 | require File::Copy::Recursive; | |||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | 1 | ▶ | if(-d $self->prefix) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 332 | { | ||||||||||||||||||||||||||||
| 333 | # this is slightly dangerous. | ||||||||||||||||||||||||||||
| 334 | 0 | foreach my $child ($self->prefix->children) | |||||||||||||||||||||||||||
| 335 | { | ||||||||||||||||||||||||||||
| 336 | 0 | say "rm -rf $child"; | |||||||||||||||||||||||||||
| 337 | 0 | $_->remove_tree({ safe => 0 }) for $self->prefix->children; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | 0 | ▶ | File::Copy::Recursive::dircopy($self->stage, $self->prefix) || die "unable to copy @{[ $self->stage ]} => @{[ $self->prefix ]} $!"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 342 | 1 | say "copied staged install into @{[ $self->prefix ]}"; | |||||||||||||||||||||||||||
| 343 | }; | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | 2 | print Dump($build->runtime_prop); | |||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | 2 | 0; | |||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||
| 349 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 6 | package App::af::requires 0.18 { | |||||||||||||||||||||||||||
| 353 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 354 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 355 | 6 | ▶ | use YAML qw( Dump ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 359 | 6 | with 'App::af::role::alienfile'; | |||||||||||||||||||||||||||
| 360 | 6 | with 'App::af::role::phase'; | |||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | sub main | ||||||||||||||||||||||||||||
| 363 | 5 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 364 | 5 | my($self) = @_; | |||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 5 | $self->check_phase; | |||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||
| 368 | 5 | my $build = $self->build; | |||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 5 | ▶ | if($self->phase eq 'all') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 371 | { | ||||||||||||||||||||||||||||
| 372 | print Dump({ | ||||||||||||||||||||||||||||
| 373 | 1 | map { $_ => $build->requires($_) } qw( configure any share system ) | |||||||||||||||||||||||||||
| 374 | }); | ||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||
| 376 | else | ||||||||||||||||||||||||||||
| 377 | { | ||||||||||||||||||||||||||||
| 378 | 4 | print Dump($build->requires($self->phase)); | |||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | 5 | 0; | |||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | 6 | package App::af::missing 0.18 { | |||||||||||||||||||||||||||
| 388 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 389 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 390 | 6 | ▶ | use Capture::Tiny qw( capture ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||
| 392 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 393 | 6 | with 'App::af::role::alienfile'; | |||||||||||||||||||||||||||
| 394 | 6 | with 'App::af::role::phase'; | |||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 6 | has plugin => ( | |||||||||||||||||||||||||||
| 398 | is => 'ro', | ||||||||||||||||||||||||||||
| 399 | isa => 'Int', | ||||||||||||||||||||||||||||
| 400 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 401 | ); | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | 6 | has precompile => ( | |||||||||||||||||||||||||||
| 404 | is => 'ro', | ||||||||||||||||||||||||||||
| 405 | isa => 'Int', | ||||||||||||||||||||||||||||
| 406 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 407 | ); | ||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||
| 409 | sub main | ||||||||||||||||||||||||||||
| 410 | 5 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=14 SCAR=39.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 411 | 5 | my($self) = @_; | |||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||
| 413 | 5 | $self->check_phase; | |||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||
| 415 | 5 | ▶ | if($self->plugin) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 416 | { | ||||||||||||||||||||||||||||
| 417 | 0 | require Alien::Build; | |||||||||||||||||||||||||||
| 418 | 0 | require Test2::Mock; | |||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | 0 | my %need; | |||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||
| 422 | 0 | my $mock = Test2::Mock->new(class => 'Alien::Build::Meta'); | |||||||||||||||||||||||||||
| 423 | 0 | ▶ | $mock->around('apply_plugin' => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 424 | 0 | my($orig, $self, @args) = @_; | |||||||||||||||||||||||||||
| 425 | 0 | local @INC = @INC; | |||||||||||||||||||||||||||
| 426 | 0 | ▶ | push @INC, sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 427 | 0 | my(undef, $filename) = @_; | |||||||||||||||||||||||||||
| 428 | 0 | my $mod = $filename; | |||||||||||||||||||||||||||
| 429 | 0 | $mod =~ s{/}{::}g; | |||||||||||||||||||||||||||
| 430 | 0 | $mod =~ s{\.pm$}{}; | |||||||||||||||||||||||||||
| 431 | 0 | $need{$mod}++; | |||||||||||||||||||||||||||
| 432 | 0 | }; | |||||||||||||||||||||||||||
| 433 | 0 | eval { $orig->($self, @args) }; | |||||||||||||||||||||||||||
| 434 | 0 | }); | |||||||||||||||||||||||||||
| 435 | 0 | ▶ | my(undef, undef, $build) = capture { $self->build }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 436 | 0 | print "$_\n" for sort keys %need; | |||||||||||||||||||||||||||
| 437 | 0 | return 0; | |||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||
| 440 | 5 | ▶ | if($self->precompile) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 441 | { | ||||||||||||||||||||||||||||
| 442 | 0 | my %need; | |||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||
| 444 | 0 | foreach my $line ($self->file->lines) | |||||||||||||||||||||||||||
| 445 | { | ||||||||||||||||||||||||||||
| 446 | 0 | chomp $line; | |||||||||||||||||||||||||||
| 447 | 0 | ▶ | if($line =~ /^\s*use\s+([A-Za-z_0-9]+(::[A-Za-z_0-9]+)*)/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||
| 449 | 0 | my $mod = $1; | |||||||||||||||||||||||||||
| 450 | 0 | eval qq{ use $mod () }; | |||||||||||||||||||||||||||
| 451 | 0 | ▶ | if($@) { $need{$mod}++ }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||
| 454 | 0 | print "$_\n" for sort keys %need; | |||||||||||||||||||||||||||
| 455 | 0 | exit 0; | |||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 5 | ▶ | my(undef,undef, $build) = capture { $self->build }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | 5 | my @reqs; | |||||||||||||||||||||||||||
| 461 | my %need; | ||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||
| 463 | 5 | ▶ | if($self->phase eq 'all') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | { | ||||||||||||||||||||||||||||
| 465 | 1 | $build->load_requires('configure'); | |||||||||||||||||||||||||||
| 466 | 1 | ▶ | capture { $build->probe }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 467 | 1 | @reqs = map { $build->requires($_) } qw( configure any share system ); | |||||||||||||||||||||||||||
| 468 | 1 | @reqs = ( | |||||||||||||||||||||||||||
| 469 | $build->requires('configure'), | ||||||||||||||||||||||||||||
| 470 | $build->requires($build->install_type), | ||||||||||||||||||||||||||||
| 471 | ); | ||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||
| 473 | else | ||||||||||||||||||||||||||||
| 474 | { | ||||||||||||||||||||||||||||
| 475 | 4 | @reqs = ( $build->requires($self->phase) ); | |||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | 5 | foreach my $reqs (@reqs) | |||||||||||||||||||||||||||
| 479 | { | ||||||||||||||||||||||||||||
| 480 | 6 | foreach my $module (sort keys %$reqs) | |||||||||||||||||||||||||||
| 481 | { | ||||||||||||||||||||||||||||
| 482 | 7 | my $version = $reqs->{$module}; | |||||||||||||||||||||||||||
| 483 | 7 | eval { | |||||||||||||||||||||||||||
| 484 | 7 | my $pm = $module . '.pm'; | |||||||||||||||||||||||||||
| 485 | 7 | $pm =~ s/::/\//g; | |||||||||||||||||||||||||||
| 486 | 7 | require $pm; | |||||||||||||||||||||||||||
| 487 | 0 | ▶ | !$version || $module->VERSION($version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 488 | }; | ||||||||||||||||||||||||||||
| 489 | 7 | ▶ | $need{$module} = 1 if $@ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | 5 | say $_ for sort keys %need; | |||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | 5 | 0; | |||||||||||||||||||||||||||
| 496 | } | ||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||
| 498 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||
| 501 | 6 | package App::af::prop 0.18 { | |||||||||||||||||||||||||||
| 502 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 503 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||
| 506 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||
| 508 | 6 | has class => ( | |||||||||||||||||||||||||||
| 509 | is => 'ro', | ||||||||||||||||||||||||||||
| 510 | isa => 'Str', | ||||||||||||||||||||||||||||
| 511 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 512 | short => 'c', | ||||||||||||||||||||||||||||
| 513 | opt_type => 's', | ||||||||||||||||||||||||||||
| 514 | ); | ||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||
| 516 | has $_ => ( | ||||||||||||||||||||||||||||
| 517 | is => 'ro', | ||||||||||||||||||||||||||||
| 518 | isa => 'Int', | ||||||||||||||||||||||||||||
| 519 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 520 | 6 | ) for qw( static cflags libs modversion bin_dir ); | |||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||
| 522 | 8 | ▶ | sub main { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=14 SCAR=27.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 523 | 8 | my($self) = @_; | |||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | 8 | ▶ | unless($self->class) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 526 | { | ||||||||||||||||||||||||||||
| 527 | 0 | say STDERR "You must specify a class.\n"; | |||||||||||||||||||||||||||
| 528 | 0 | return 2; | |||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||
| 531 | 8 | ▶ | my $class = $self->class =~ /::/ ? $self->class : 'Alien::' . $self->class; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | { | ||||||||||||||||||||||||||||
| 534 | 8 | my $pm = $class . '.pm'; | |||||||||||||||||||||||||||
| 535 | 8 | $pm =~ s/::/\//g; | |||||||||||||||||||||||||||
| 536 | 8 | require $pm; | |||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||
| 538 | 8 | ▶ | unless($class->can('runtime_prop')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 539 | { | ||||||||||||||||||||||||||||
| 540 | 0 | say STDERR "$class was not installed with Alien::Build"; | |||||||||||||||||||||||||||
| 541 | 0 | return 2; | |||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||
| 544 | 8 | my $prop = $class->runtime_prop; | |||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||
| 546 | 8 | ▶ | unless($prop) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||
| 548 | 0 | say STDERR "$class was not installed with Alien::Build"; | |||||||||||||||||||||||||||
| 549 | 0 | return 2; | |||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||
| 552 | 8 | my $found = 0; | |||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | 8 | ▶ | if($self->cflags) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 555 | { | ||||||||||||||||||||||||||||
| 556 | 2 | ▶ | if($self->static) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 557 | { | ||||||||||||||||||||||||||||
| 558 | 1 | say $class->cflags_static; | |||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||
| 560 | else | ||||||||||||||||||||||||||||
| 561 | { | ||||||||||||||||||||||||||||
| 562 | 1 | say $class->cflags; | |||||||||||||||||||||||||||
| 563 | } | ||||||||||||||||||||||||||||
| 564 | 2 | $found = 1; | |||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||
| 567 | 8 | ▶ | if($self->libs) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 568 | { | ||||||||||||||||||||||||||||
| 569 | 2 | ▶ | if($self->static) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 570 | { | ||||||||||||||||||||||||||||
| 571 | 1 | say $class->libs_static; | |||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||
| 573 | else | ||||||||||||||||||||||||||||
| 574 | { | ||||||||||||||||||||||||||||
| 575 | 1 | say $class->libs; | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | 2 | $found = 1; | |||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||
| 579 | |||||||||||||||||||||||||||||
| 580 | 8 | ▶ | if($self->bin_dir) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 581 | { | ||||||||||||||||||||||||||||
| 582 | 1 | say $_ for $class->bin_dir; | |||||||||||||||||||||||||||
| 583 | 1 | $found = 1; | |||||||||||||||||||||||||||
| 584 | } | ||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||
| 586 | 8 | ▶ | if($self->modversion) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 587 | { | ||||||||||||||||||||||||||||
| 588 | 1 | ▶ | say $class->version // 'undef'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$class->version // "undef"
MC/DC0%0/1
$class->version // "undef"
$class->version
Truth table50%1/2
A
A= $class->version
| |||||||||||||||||||||||||||||
| 589 | 1 | $found = 1; | |||||||||||||||||||||||||||
| 590 | } | ||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||
| 592 | 8 | ▶ | unless($found) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 593 | { | ||||||||||||||||||||||||||||
| 594 | 2 | require YAML; | |||||||||||||||||||||||||||
| 595 | 2 | print YAML::Dump($prop); | |||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||
| 598 | 8 | 0; | |||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||
| 600 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||
| 603 | 6 | package App::af::list 0.18 { | |||||||||||||||||||||||||||
| 604 | 6 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 605 | 6 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 606 | 6 | ▶ | use Path::Tiny qw( path ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 607 | 6 | ▶ | use Text::Table; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||
| 610 | 6 | with 'App::af'; | |||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | 6 | has long => ( | |||||||||||||||||||||||||||
| 613 | is => 'ro', | ||||||||||||||||||||||||||||
| 614 | isa => 'Int', | ||||||||||||||||||||||||||||
| 615 | traits => ['App::af::opt'], | ||||||||||||||||||||||||||||
| 616 | short => 'l', | ||||||||||||||||||||||||||||
| 617 | ); | ||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||
| 619 | sub main | ||||||||||||||||||||||||||||
| 620 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
main: called CC=12 SCAR=25.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 621 | 2 | my($self) = @_; | |||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||
| 623 | 2 | my $table; | |||||||||||||||||||||||||||
| 624 | 2 | ▶ | $table = Text::Table->new('name', 'install type', 'alien version', 'package version') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 625 | if $self->long; | ||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||
| 627 | 2 | foreach my $inc (map { path($_)->absolute } @INC) | |||||||||||||||||||||||||||
| 628 | { | ||||||||||||||||||||||||||||
| 629 | 18 | my $dist_root = $inc->child('auto/share/dist'); | |||||||||||||||||||||||||||
| 630 | 18 | ▶ | next unless -d $dist_root; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 631 | |||||||||||||||||||||||||||||
| 632 | 4 | foreach my $dist_dir ($dist_root->children) | |||||||||||||||||||||||||||
| 633 | { | ||||||||||||||||||||||||||||
| 634 | 4 | ▶ | next unless -f $dist_dir->child('_alien/alien.json'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 635 | 4 | my $dist = $dist_dir->basename; | |||||||||||||||||||||||||||
| 636 | 4 | my $class = $dist; | |||||||||||||||||||||||||||
| 637 | 4 | $class =~ s/-/::/g; | |||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||
| 639 | 4 | ▶ | unless($table) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 640 | { | ||||||||||||||||||||||||||||
| 641 | 2 | say $class; | |||||||||||||||||||||||||||
| 642 | 2 | next; | |||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||
| 645 | 2 | eval { | |||||||||||||||||||||||||||
| 646 | 2 | my $pm = $class . '.pm'; | |||||||||||||||||||||||||||
| 647 | 2 | $pm =~ s/::/\//g; | |||||||||||||||||||||||||||
| 648 | 2 | require $pm; | |||||||||||||||||||||||||||
| 649 | }; | ||||||||||||||||||||||||||||
| 650 | 2 | ▶ | if($@) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 651 | { | ||||||||||||||||||||||||||||
| 652 | 0 | $table->add($class, '---', '---'); | |||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||
| 654 | else | ||||||||||||||||||||||||||||
| 655 | { | ||||||||||||||||||||||||||||
| 656 | 2 | ▶ | my $install_type = eval { $class->install_type } // '---'; | ||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$class->install_type
}
} // "---"
MC/DC0%0/1
eval {
do {
$class->install_type
}
} // "---"
eval {
do {
$class->install_type
}
}
Truth table50%1/2
A
A= eval {
do {
$class->install_type
}
}
| |||||||||||||||||||||||||||||
| 657 | 2 | ▶ | my $perl_version = eval { $class->VERSION } // '---'; | ||||||||||||||||||||||||||
|
Condition100%2/2
eval {
do {
$class->VERSION
}
} // "---"
MC/DC100%1/1
eval {
do {
$class->VERSION
}
} // "---"
eval {
do {
$class->VERSION
}
}
Truth table100%2/2
A
A= eval {
do {
$class->VERSION
}
}
| |||||||||||||||||||||||||||||
| 658 | 2 | ▶ | my $pkg_version = eval { $class->version } // '---'; | ||||||||||||||||||||||||||
|
Condition50%1/2
eval {
do {
$class->version
}
} // "---"
MC/DC0%0/1
eval {
do {
$class->version
}
} // "---"
eval {
do {
$class->version
}
}
Truth table50%1/2
A
A= eval {
do {
$class->version
}
}
| |||||||||||||||||||||||||||||
| 659 | 2 | $table->add($class, $install_type, $perl_version, $pkg_version); | |||||||||||||||||||||||||||
| 660 | } | ||||||||||||||||||||||||||||
| 661 | } | ||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||
| 665 | 2 | ▶ | print $table if defined $table; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 666 | 2 | 0; | |||||||||||||||||||||||||||
| 667 | } | ||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||
| 669 | 6 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||
| 672 | # for testing, allow us to do this file | ||||||||||||||||||||||||||||
| 673 | # without running. | ||||||||||||||||||||||||||||
| 674 | 6 | ▶ | unless(caller) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 675 | { | ||||||||||||||||||||||||||||
| 676 | 0 | my $class = App::af->compute_class; | |||||||||||||||||||||||||||
| 677 | 0 | ▶ | unless(eval { $class->does('App::af') }) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 678 | { | ||||||||||||||||||||||||||||
| 679 | 0 | say STDERR "unknown subcommand"; | |||||||||||||||||||||||||||
| 680 | 0 | exit 2; | |||||||||||||||||||||||||||
| 681 | } | ||||||||||||||||||||||||||||
| 682 | 0 | my $app = $class->new(@ARGV); | |||||||||||||||||||||||||||
| 683 | 0 | ▶ | exit($app->main // 0); | ||||||||||||||||||||||||||
|
Condition0%0/2
$app->main // 0
MC/DC0%0/1
$app->main // 0
$app->main
Truth table0%0/2
A
A= $app->main
| |||||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||
| 685 | |||||||||||||||||||||||||||||
| 686 | __END__ | ||||||||||||||||||||||||||||