line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Create a new stack by copying another |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Action::Copy; |
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
3597
|
use Moose; |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
73
|
|
6
|
6
|
|
|
6
|
|
50265
|
use MooseX::StrictConstructor; |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
94
|
|
7
|
6
|
|
|
6
|
|
21252
|
use MooseX::Types::Moose qw(Bool Str); |
|
6
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
137
|
|
8
|
6
|
|
|
6
|
|
31836
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
6
|
|
|
|
|
20
|
|
|
6
|
|
|
|
|
69
|
|
9
|
|
|
|
|
|
|
|
10
|
6
|
|
|
6
|
|
24521
|
use Pinto::Types qw(StackName StackObject); |
|
6
|
|
|
|
|
22
|
|
|
6
|
|
|
|
|
88
|
|
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 to_stack => ( |
33
|
|
|
|
|
|
|
is => 'ro', |
34
|
|
|
|
|
|
|
isa => StackName, |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has default => ( |
39
|
|
|
|
|
|
|
is => 'ro', |
40
|
|
|
|
|
|
|
isa => Bool, |
41
|
|
|
|
|
|
|
default => 0, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has lock => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Bool, |
47
|
|
|
|
|
|
|
default => 0, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has description => ( |
51
|
|
|
|
|
|
|
is => 'ro', |
52
|
|
|
|
|
|
|
isa => Str, |
53
|
|
|
|
|
|
|
predicate => 'has_description', |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub execute { |
59
|
|
|
|
|
|
|
my ($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my %changes = ( name => $self->to_stack ); |
62
|
|
|
|
|
|
|
my $orig = $self->repo->get_stack( $self->stack ); |
63
|
|
|
|
|
|
|
my $copy = $self->repo->copy_stack( stack => $orig, %changes ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $description = |
66
|
|
|
|
|
|
|
$self->has_description |
67
|
|
|
|
|
|
|
? $self->description |
68
|
|
|
|
|
|
|
: "Copy of stack $orig"; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$copy->set_description($description); |
71
|
|
|
|
|
|
|
$copy->mark_as_default if $self->default; |
72
|
|
|
|
|
|
|
$copy->lock if $self->lock; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return $self->result->changed; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=encoding UTF-8 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 NAME |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Pinto::Action::Copy - Create a new stack by copying another |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 VERSION |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
version 0.14 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHOR |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
110
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=cut |