blib/lib/Pinto/Action/Unregister.pm

filter: Statementstmt 73.5% 25 / 34 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 72.0% 31 / 43 CC 3 SCAR 15.4
CC
3
Cov
69%
execute
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
« blib/lib/Pinto/Action/Merge.pm ↑ Summary blib/lib/Pinto/Action/Delete.pm »
1 # ABSTRACT: Unregister packages from a stack
2  
3 package Pinto::Action::Unregister;
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(TargetList);
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 => TargetList,
25 traits => [qw(Array)],
26 handles => { targets => 'elements' },
27 required => 1,
28 coerce => 1,
29 );
30  
31 1 has force => (
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=3 SCAR=24.8
44 0 my ($self) = @_;
45  
46 0 my $stack = $self->stack;
47  
48 0 for my $target ( $self->targets ) {
49  
50 0 ▶ throw "Target $target is not registered on stack $stack"
Branch: 1 branch
BranchTrueFalseTotal
unless my $dist = $stack->get_distribution("target", $target) 0 0 0
51 unless my $dist = $stack->get_distribution( target => $target );
52  
53 0 $self->notice("Unregistering distribution $dist from stack $stack");
54  
55 0 $dist->unregister( stack => $stack, force => $self->force );
56 0 push @{$self->affected}, $dist;
57 }
58  
59 0 return $self;
60 }
61  
62 #------------------------------------------------------------------------------
63  
64 1 __PACKAGE__->meta->make_immutable;
65  
66 #------------------------------------------------------------------------------
67  
68 1 1;
69  
70 __END__
« blib/lib/Pinto/Action/Merge.pm ↑ Summary blib/lib/Pinto/Action/Delete.pm »