| 1 | package Carmel::Artifact; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use CPAN::Meta; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use JSON (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Path::Tiny (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 8 | 0 | my($class, $path) = @_; | |||||||||||||||||||||||||||
| 9 | 0 | bless { path => Path::Tiny->new($path) }, $class; | |||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub path { $_[0]->{path} } | ||||||||||||||||||||||||||
|
Subroutine
path: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub install { | ||||||||||||||||||||||||||
|
Subroutine
install: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 16 | 0 | ▶ | $self->{install} ||= $self->_build_install; | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"install"} ||= $self->_build_install
MC/DC0%0/2
$self->{"install"} ||= $self->_build_install
$self->{"install"}
$self->_build_install
Truth table0%0/3
A ||= B
A= $self->{"install"}B= $self->_build_install
| |||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub _build_install { | ||||||||||||||||||||||||||
|
Subroutine
_build_install: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 20 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | my $file = $self->path->child("blib/meta/install.json"); | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | if ($file->exists) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | return JSON::decode_json($file->slurp); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | die "Can't read build artifact from ", $self->path; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub provides { | ||||||||||||||||||||||||||
|
Subroutine
provides: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 31 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 32 | 0 | $self->install->{provides}; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | # "cpanm" => ".../blib/script/cpanm" | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | sub executables { | ||||||||||||||||||||||||||
|
Subroutine
executables: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 37 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 38 | 0 | ▶ | $self->_find_files(sub { shift !~ /\.exists$/ }, $self->paths); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | # "Foo/Bar.pm" => ".../blib/lib/Foo/Bar.pm" | ||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub module_files { | ||||||||||||||||||||||||||
|
Subroutine
module_files: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 44 | 0 | ▶ | $self->_find_files(sub { shift =~ /\.pm$/ }, $self->libs); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub _find_files { | ||||||||||||||||||||||||||
|
Subroutine
_find_files: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 48 | 0 | my($self, $what, @dirs) = @_; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | my %found; | |||||||||||||||||||||||||||
| 51 | 0 | for my $dir (@dirs) { | |||||||||||||||||||||||||||
| 52 | $dir->visit( | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 54 | 0 | my($path, $state) = @_; | |||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ($path->is_file && $what->($path)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path->is_file and &$what($path)
MC/DC0%0/2
$path->is_file and &$what($path)
$path->is_file
&$what($path)
Truth table0%0/3
A and B
A= $path->is_fileB= &$what($path)
| |||||||||||||||||||||||||||||
| 56 | 0 | $found{$path->relative($dir)->stringify} = $path; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | 0 | return; # continue | |||||||||||||||||||||||||||
| 59 | }, | ||||||||||||||||||||||||||||
| 60 | 0 | { recurse => 1 }, | |||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | %found; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub package { | ||||||||||||||||||||||||||
|
Subroutine
package: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 69 | 0 | $self->install->{name}; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub version { | ||||||||||||||||||||||||||
|
Subroutine
version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 73 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 74 | 0 | $self->version_for($self->package); | |||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub version_for { | ||||||||||||||||||||||||||
|
Subroutine
version_for: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 78 | 0 | my($self, $package) = @_; | |||||||||||||||||||||||||||
| 79 | 0 | ▶ | version::->parse( $self->provides->{$package}{version} || '0' ); | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->provides->{$package}{'version'} || '0'
MC/DC0%0/1
$self->provides->{$package}{'version'} || '0'
$self->provides->{$package}{'version'}
Truth table0%0/2
A
A= $self->provides->{$package}{'version'}
| |||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub distname { | ||||||||||||||||||||||||||
|
Subroutine
distname: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 83 | 0 | $_[0]->path->basename; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub dist_version { | ||||||||||||||||||||||||||
|
Subroutine
dist_version: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 87 | 0 | $_[0]->install->{version}; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 0 | ▶ | sub blib { | ||||||||||||||||||||||||||
|
Subroutine
blib: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 91 | 0 | $_[0]->path->child("blib"); | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub paths { | ||||||||||||||||||||||||||
|
Subroutine
paths: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 95 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 96 | 0 | ($self->blib->child("script"), $self->blib->child("bin")); | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub libs { | ||||||||||||||||||||||||||
|
Subroutine
libs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 100 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 101 | 0 | ($self->blib->child("arch"), $self->blib->child("lib")); | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 0 | ▶ | sub nonempty_paths { | ||||||||||||||||||||||||||
|
Subroutine
nonempty_paths: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 105 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 106 | 0 | grep $self->_nonempty($_), $self->paths; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub nonempty_libs { | ||||||||||||||||||||||||||
|
Subroutine
nonempty_libs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 110 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 111 | 0 | grep $self->_nonempty($_), $self->libs; | |||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub sharedir_libs { | ||||||||||||||||||||||||||
|
Subroutine
sharedir_libs: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 115 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 116 | 0 | grep $_->child('auto/share')->exists, $self->libs; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | sub meta { | ||||||||||||||||||||||||||
|
Subroutine
meta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 120 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 121 | 0 | CPAN::Meta->load_file($self->path->child("MYMETA.json")); | |||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | ▶ | sub requirements { | ||||||||||||||||||||||||||
|
Subroutine
requirements: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 125 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 126 | 0 | $self->requirements_for([qw( configure build runtime )], ['requires']); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | 0 | ▶ | sub requirements_for { | ||||||||||||||||||||||||||
|
Subroutine
requirements_for: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 130 | 0 | my($self, $phases, $types) = @_; | |||||||||||||||||||||||||||
| 131 | 0 | $self->meta->effective_prereqs->merged_requirements($phases, $types); | |||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 0 | ▶ | sub _nonempty { | ||||||||||||||||||||||||||
|
Subroutine
_nonempty: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 135 | 0 | my($self, $path) = @_; | |||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | 0 | my $bool; | |||||||||||||||||||||||||||
| 138 | $path->visit( | ||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||
| 140 | 0 | my($path, $state) = @_; | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | if ($path->is_file && $path !~ /\.exists$/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$path->is_file and not $path =~ /\.exists$/
MC/DC0%0/2
$path->is_file and not $path =~ /\.exists$/
$path->is_file
not $path =~ /\.exists$/
Truth table0%0/3
A and not(B)
A= $path->is_fileB= not $path =~ /\.exists$/
| |||||||||||||||||||||||||||||
| 142 | 0 | $bool = 1; | |||||||||||||||||||||||||||
| 143 | 0 | return \0; | |||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||
| 145 | }, | ||||||||||||||||||||||||||||
| 146 | 0 | { recurse => 1 }, | |||||||||||||||||||||||||||
| 147 | ); | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | return $bool; | |||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | 1 | 1; | |||||||||||||||||||||||||||