| 1 | # ABSTRACT: Install packages from the repository | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package Pinto::Action::Install; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use MooseX::StrictConstructor; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use MooseX::Types::Moose qw(Bool ArrayRef Str); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Pinto::Target; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | extends qw( Pinto::Action ); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 1 | has targets => ( | |||||||||||||||||||||||||||
| 23 | isa => ArrayRef [Str], | ||||||||||||||||||||||||||||
| 24 | traits => ['Array'], | ||||||||||||||||||||||||||||
| 25 | handles => { targets => 'elements' }, | ||||||||||||||||||||||||||||
| 26 | required => 1, | ||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | has do_pull => ( | |||||||||||||||||||||||||||
| 30 | is => 'ro', | ||||||||||||||||||||||||||||
| 31 | isa => Bool, | ||||||||||||||||||||||||||||
| 32 | default => 0, | ||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | has mirror_uri => ( | |||||||||||||||||||||||||||
| 36 | is => 'ro', | ||||||||||||||||||||||||||||
| 37 | isa => Str, | ||||||||||||||||||||||||||||
| 38 | builder => '_build_mirror_uri', | ||||||||||||||||||||||||||||
| 39 | lazy => 1, | ||||||||||||||||||||||||||||
| 40 | ); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | with qw( Pinto::Role::Committable Pinto::Role::Puller Pinto::Role::Installer); | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub _build_mirror_uri { | ||||||||||||||||||||||||||
|
Subroutine
_build_mirror_uri: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 49 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | my $stack = $self->stack; | |||||||||||||||||||||||||||
| 52 | 0 | ▶ | my $stack_dir = defined $stack ? "/stacks/$stack" : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 53 | 0 | my $mirror_uri = 'file://' . $self->repo->root->absolute . $stack_dir; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | return $mirror_uri; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||
| 61 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | my @dists; | |||||||||||||||||||||||||||
| 64 | 0 | ▶ | if ( $self->do_pull ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | for my $target ( $self->targets ) { | |||||||||||||||||||||||||||
| 67 | 0 | ▶ | next if -d $target or -f $target; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $target or -f $target
MC/DC0%0/2
-d $target or -f $target
-d $target
-f $target
Truth table0%0/3
A or B
A= -d $targetB= -f $target
| |||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 0 | require Pinto::Target; | |||||||||||||||||||||||||||
| 70 | 0 | $target = Pinto::Target->new($target); | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | my $dist = $self->pull( target => $target ); | |||||||||||||||||||||||||||
| 73 | 0 | ▶ | push @dists, $dist ? $dist : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 0 | return @dists; | |||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 85 | 1 | 1; | |||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | __END__ | ||||||||||||||||||||||||||||