File Coverage

blib/lib/Pinto/Action/Unlock.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             # ABSTRACT: Unlock a stack to allow future changes
2              
3             package Pinto::Action::Unlock;
4              
5 1     1   764 use Moose;
  1         2  
  1         7  
6 1     1   6109 use MooseX::StrictConstructor;
  1         2  
  1         9  
7 1     1   3081 use MooseX::MarkAsMethods ( autoclean => 1 );
  1         2  
  1         7  
8              
9 1     1   3356 use Pinto::Types qw(StackName StackDefault StackObject);
  1         2  
  1         11  
10              
11             #------------------------------------------------------------------------------
12              
13             our $VERSION = '0.13'; # VERSION
14              
15             #------------------------------------------------------------------------------
16              
17             extends qw( Pinto::Action );
18              
19             #------------------------------------------------------------------------------
20              
21             with qw( Pinto::Role::Transactional );
22              
23             #------------------------------------------------------------------------------
24              
25             has stack => (
26             is => 'ro',
27             isa => StackName | StackDefault | StackObject,
28             default => undef,
29             );
30              
31             #------------------------------------------------------------------------------
32              
33             sub execute {
34             my ($self) = @_;
35              
36             my $stack = $self->repo->get_stack( $self->stack );
37              
38             if ( !$stack->is_locked ) {
39             $self->warning("Stack $stack is not locked");
40             return $self->result;
41             }
42              
43             $stack->unlock;
44             return $self->result->changed;
45             }
46              
47             #------------------------------------------------------------------------------
48              
49             __PACKAGE__->meta->make_immutable;
50              
51             #------------------------------------------------------------------------------
52              
53             1;
54              
55             __END__
56              
57             =pod
58              
59             =encoding UTF-8
60              
61             =for :stopwords Jeffrey Ryan Thalhammer
62              
63             =head1 NAME
64              
65             Pinto::Action::Unlock - Unlock a stack to allow future changes
66              
67             =head1 VERSION
68              
69             version 0.13
70              
71             =head1 AUTHOR
72              
73             Jeffrey Ryan Thalhammer <jeff@stratopan.com>
74              
75             =head1 COPYRIGHT AND LICENSE
76              
77             This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer.
78              
79             This is free software; you can redistribute it and/or modify it under
80             the same terms as the Perl 5 programming language system itself.
81              
82             =cut