line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
3
|
11
|
|
|
11
|
|
9122
|
use strict; |
|
11
|
|
|
|
|
37
|
|
4
|
11
|
|
|
11
|
|
63
|
use warnings; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
262
|
|
5
|
11
|
|
|
11
|
|
104
|
use utf8; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
292
|
|
6
|
11
|
|
|
11
|
|
70
|
use Moo::Role; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
57
|
|
7
|
11
|
|
|
11
|
|
277
|
use App::Sqitch::Types qw(ArrayRef); |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
82
|
|
8
|
11
|
|
|
11
|
|
3401
|
|
|
11
|
|
|
|
|
354
|
|
|
11
|
|
|
|
|
93
|
|
9
|
|
|
|
|
|
|
our $VERSION = 'v1.3.0'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
requires 'options'; |
12
|
|
|
|
|
|
|
requires 'configure'; |
13
|
|
|
|
|
|
|
requires 'target_params'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has _params => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
isa => ArrayRef, |
18
|
|
|
|
|
|
|
default => sub { [] }, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
around options => sub { |
22
|
|
|
|
|
|
|
my $orig = shift; |
23
|
|
|
|
|
|
|
return $orig->(@_), qw( |
24
|
|
|
|
|
|
|
registry=s |
25
|
|
|
|
|
|
|
client|db-client=s |
26
|
|
|
|
|
|
|
db-name|d=s |
27
|
|
|
|
|
|
|
db-user|db-username|u=s |
28
|
|
|
|
|
|
|
db-host|h=s |
29
|
|
|
|
|
|
|
db-port|p=i |
30
|
|
|
|
|
|
|
); |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
around configure => sub { |
34
|
|
|
|
|
|
|
my ( $orig, $class, $config, $opt ) = @_; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Grab the options we're responsible for. |
37
|
|
|
|
|
|
|
my @params = ( |
38
|
|
|
|
|
|
|
(exists $opt->{db_user} ? ('user', => delete $opt->{db_user}) : ()), |
39
|
|
|
|
|
|
|
(exists $opt->{db_host} ? ('host', => delete $opt->{db_host}) : ()), |
40
|
|
|
|
|
|
|
(exists $opt->{db_port} ? ('port', => delete $opt->{db_port}) : ()), |
41
|
|
|
|
|
|
|
(exists $opt->{db_name} ? ('dbname' => delete $opt->{db_name}) : ()), |
42
|
|
|
|
|
|
|
(exists $opt->{registry} ? ('registry' => delete $opt->{registry}) : ()), |
43
|
|
|
|
|
|
|
(exists $opt->{client} ? ('client' => delete $opt->{client}) : ()), |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Let the command take care of its options. |
47
|
|
|
|
|
|
|
my $params = $class->$orig($config, $opt); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Hang on to the target parameters. |
50
|
|
|
|
|
|
|
$params->{_params} = \@params; |
51
|
|
|
|
|
|
|
return $params; |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
around target_params => sub { |
55
|
|
|
|
|
|
|
my ($orig, $self) = (shift, shift); |
56
|
|
|
|
|
|
|
return $self->$orig(@_), @{ $self->_params }; |
57
|
|
|
|
|
|
|
}; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 Name |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
App::Sqitch::Role::ConnectingCommand - A command that connects to a target |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 Synopsis |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
package App::Sqitch::Command::deploy; |
69
|
|
|
|
|
|
|
extends 'App::Sqitch::Command'; |
70
|
|
|
|
|
|
|
with 'App::Sqitch::Role::ConnectingCommand'; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 Description |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This role encapsulates the options and target parameters required by commands |
75
|
|
|
|
|
|
|
that connect to a database target. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 Interface |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 Class Methods |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head3 C<options> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my @opts = App::Sqitch::Command::deploy->options; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Adds database connection options. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head3 C<configure> |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Configures the options used for target parameters. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 Instance Methods |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head3 C<target_params> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Returns a list of parameters to be passed to App::Sqitch::Target's C<new> |
96
|
|
|
|
|
|
|
and C<all_targets> methods. |
97
|
|
|
|
|
|
|
=head1 See Also |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=over |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::deploy> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
The C<deploy> command deploys changes to a database. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::revert> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
The C<revert> command reverts changes from a database. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::log> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
The C<log> command shows the event log for a database. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=back |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 Author |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 License |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Copyright (c) 2012-2022 iovation Inc., David E. Wheeler |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
124
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
125
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
126
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
127
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
128
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
131
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
134
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
135
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
136
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
137
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
138
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
139
|
|
|
|
|
|
|
SOFTWARE. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |