File Coverage

blib/lib/Pinto/Action/Kill.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 20 100.0


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