blib/lib/Pinto/Action/Register.pm

filter: Statementstmt 71.4% 25 / 35 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 64.5% 31 / 48 CC 5 SCAR 26.5
CC
5
Cov
61%
execute
30.0
BEGIN
1.0
BEGIN
1.0
CRAP 14.2
« blib/lib/Pinto/Shell.pm ↑ Summary blib/lib/Pinto/Action/Look.pm »
1 # ABSTRACT: Register packages from existing archives on a stack
2  
3 package Pinto::Action::Register;
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);
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::Util qw(throw);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Pinto::Types qw(DistributionTargetList);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 #------------------------------------------------------------------------------
14  
15 1 our $VERSION = '0.14'; # VERSION
16  
17 #------------------------------------------------------------------------------
18  
19 1 extends qw( Pinto::Action );
20  
21 #------------------------------------------------------------------------------
22  
23 1 has targets => (
24 isa => DistributionTargetList,
25 traits => [qw(Array)],
26 handles => { targets => 'elements' },
27 required => 1,
28 coerce => 1,
29 );
30  
31 1 has pin => (
32 is => 'ro',
33 isa => Bool,
34 default => 0,
35 );
36  
37 #------------------------------------------------------------------------------
38  
39 1 with qw( Pinto::Role::Committable );
40  
41 #------------------------------------------------------------------------------
42  
43 0 ▶sub execute {
Subroutine execute: not called CC=5 SCAR=34.0
44 0 my ($self) = @_;
45  
46 0 my $stack = $self->stack;
47  
48 0 for my $target ( $self->targets ) {
49  
50 0 ▶ throw "Distribution $target is not in the repository"
Branch: 1 branch
BranchTrueFalseTotal
unless my $dist = $self->repo->get_distribution("target", $target) 0 0 0
51 unless my $dist = $self->repo->get_distribution( target => $target );
52  
53 0 $self->notice("Registering distribution $dist on stack $stack");
54  
55 0 my $did_register = $dist->register( stack => $stack, pin => $self->pin );
56 0 ▶ push @{$self->affected}, $dist if $did_register;
Branch: 1 branch
BranchTrueFalseTotal
if $did_register 0 0 0
57  
58 0 ▶ $self->warning("Distribution $dist is already registered on stack $stack")
Branch: 1 branch
BranchTrueFalseTotal
unless $did_register 0 0 0
59 unless $did_register;
60 }
61  
62 0 return $self;
63 }
64  
65 #------------------------------------------------------------------------------
66  
67 1 __PACKAGE__->meta->make_immutable;
68  
69 #------------------------------------------------------------------------------
70  
71 1 1;
72  
73 __END__
« blib/lib/Pinto/Shell.pm ↑ Summary blib/lib/Pinto/Action/Look.pm »