blib/lib/Pinto/Action/Unpin.pm

filter: Statementstmt 80.6% 25 / 31 Branchbran 16.6% 1 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 74.4% 32 / 43 CC 5 SCAR 19.5
CC
5
Cov
70%
execute
13.1
BEGIN
1.0
BEGIN
1.0
CRAP 7.1
« blib/lib/Pinto/Action/Pin.pm ↑ Summary blib/lib/Pinto/Locator/Mirror.pm »
1 # ABSTRACT: Loosen a package that has been pinned
2  
3 package Pinto::Action::Unpin;
4  
5 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use MooseX::MarkAsMethods ( autoclean => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Pinto::Util qw(throw);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Pinto::Types qw(TargetList);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #------------------------------------------------------------------------------
13  
14 2 our $VERSION = '0.14'; # VERSION
15  
16 #------------------------------------------------------------------------------
17  
18 2 extends qw( Pinto::Action );
19  
20 #------------------------------------------------------------------------------
21  
22 2 has targets => (
23 isa => TargetList,
24 traits => [qw(Array)],
25 handles => { targets => 'elements' },
26 required => 1,
27 coerce => 1,
28 );
29  
30 #------------------------------------------------------------------------------
31  
32 2 with qw( Pinto::Role::Committable );
33  
34 #------------------------------------------------------------------------------
35  
36 1 ▶sub execute {
Subroutine execute: called CC=5 SCAR=25.7
37 1 my ($self) = @_;
38  
39 1 my $stack = $self->stack;
40  
41 1 for my $target ( $self->targets ) {
42  
43 1 ▶ throw "$target is not registered on stack $stack"
Branch: 1 branch
BranchTrueFalseTotal
unless my $dist = $stack->get_distribution("target", $target) 1 0 1
44 unless my $dist = $stack->get_distribution( target => $target );
45  
46 0 $self->notice("Unpinning distribution $dist from stack $stack");
47  
48 0 my $did_unpin = $dist->unpin( stack => $stack );
49 0 ▶ push @{$self->affected}, $dist if $did_unpin;
Branch: 1 branch
BranchTrueFalseTotal
if $did_unpin 0 0 0
50  
51 0 ▶ $self->warning("Distribution $dist is not pinned to stack $stack")
Branch: 1 branch
BranchTrueFalseTotal
unless $did_unpin 0 0 0
52 unless $did_unpin;
53 }
54  
55 0 return $self;
56 }
57  
58 #------------------------------------------------------------------------------
59  
60 2 __PACKAGE__->meta->make_immutable;
61  
62 #------------------------------------------------------------------------------
63  
64 2 1;
65  
66 __END__
« blib/lib/Pinto/Action/Pin.pm ↑ Summary blib/lib/Pinto/Locator/Mirror.pm »