| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
|
3
|
3
|
|
|
3
|
|
1735
|
use strict; |
|
|
3
|
|
|
|
|
11
|
|
|
4
|
3
|
|
|
3
|
|
20
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
82
|
|
|
5
|
3
|
|
|
3
|
|
16
|
use utf8; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
74
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use Moo::Role; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
15
|
|
|
7
|
3
|
|
|
3
|
|
67
|
use App::Sqitch::Types qw(Str Int Bool HashRef); |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
18
|
|
|
8
|
3
|
|
|
3
|
|
1020
|
use Type::Utils qw(enum); |
|
|
3
|
|
|
|
|
7
|
|
|
|
3
|
|
|
|
|
27
|
|
|
9
|
3
|
|
|
3
|
|
2943
|
use namespace::autoclean; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
20
|
|
|
10
|
3
|
|
|
3
|
|
1356
|
|
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
|
|
requires 'sqitch'; |
|
12
|
|
|
|
|
|
|
requires 'command'; |
|
13
|
|
|
|
|
|
|
requires 'options'; |
|
14
|
|
|
|
|
|
|
requires 'configure'; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
with 'App::Sqitch::Role::ContextCommand'; |
|
17
|
|
|
|
|
|
|
with 'App::Sqitch::Role::ConnectingCommand'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = 'v1.3.0'; # VERSION |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has target => ( |
|
22
|
|
|
|
|
|
|
is => 'ro', |
|
23
|
|
|
|
|
|
|
isa => Str, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has verify => ( |
|
27
|
|
|
|
|
|
|
is => 'ro', |
|
28
|
|
|
|
|
|
|
isa => Bool, |
|
29
|
|
|
|
|
|
|
default => 0, |
|
30
|
|
|
|
|
|
|
); |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
has log_only => ( |
|
33
|
|
|
|
|
|
|
is => 'ro', |
|
34
|
|
|
|
|
|
|
isa => Bool, |
|
35
|
|
|
|
|
|
|
default => 0, |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has lock_timeout => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
isa => Int, |
|
41
|
|
|
|
|
|
|
lazy => 1, |
|
42
|
|
|
|
|
|
|
default => sub { App::Sqitch::Engine::default_lock_timeout() }, |
|
43
|
|
|
|
|
|
|
); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has no_prompt => ( |
|
46
|
|
|
|
|
|
|
is => 'ro', |
|
47
|
|
|
|
|
|
|
isa => Bool |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has prompt_accept => ( |
|
51
|
|
|
|
|
|
|
is => 'ro', |
|
52
|
|
|
|
|
|
|
isa => Bool |
|
53
|
|
|
|
|
|
|
); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has mode => ( |
|
56
|
|
|
|
|
|
|
is => 'ro', |
|
57
|
|
|
|
|
|
|
isa => enum([qw( |
|
58
|
|
|
|
|
|
|
change |
|
59
|
|
|
|
|
|
|
tag |
|
60
|
|
|
|
|
|
|
all |
|
61
|
|
|
|
|
|
|
)]), |
|
62
|
|
|
|
|
|
|
default => 'all', |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has deploy_variables => ( |
|
66
|
|
|
|
|
|
|
is => 'ro', |
|
67
|
|
|
|
|
|
|
isa => HashRef, |
|
68
|
|
|
|
|
|
|
lazy => 1, |
|
69
|
|
|
|
|
|
|
default => sub { {} }, |
|
70
|
|
|
|
|
|
|
); |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
has revert_variables => ( |
|
73
|
|
|
|
|
|
|
is => 'ro', |
|
74
|
|
|
|
|
|
|
isa => HashRef, |
|
75
|
|
|
|
|
|
|
lazy => 1, |
|
76
|
|
|
|
|
|
|
default => sub { {} }, |
|
77
|
|
|
|
|
|
|
); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my ($self, $target) = @_; |
|
80
|
|
|
|
|
|
|
my $cfg = $self->sqitch->config; |
|
81
|
33
|
|
|
33
|
|
2870
|
return ( |
|
82
|
33
|
|
|
|
|
602
|
%{ $cfg->get_section(section => 'core.variables') }, |
|
83
|
|
|
|
|
|
|
%{ $cfg->get_section(section => 'deploy.variables') }, |
|
84
|
33
|
|
|
|
|
109
|
%{ $target->variables }, # includes engine |
|
85
|
33
|
|
|
|
|
87
|
%{ $self->deploy_variables }, # --set, --set-deploy |
|
86
|
33
|
|
|
|
|
551
|
); |
|
87
|
33
|
|
|
|
|
211
|
} |
|
|
33
|
|
|
|
|
941
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
my ($self, $target) = @_; |
|
90
|
|
|
|
|
|
|
my $cfg = $self->sqitch->config; |
|
91
|
|
|
|
|
|
|
return ( |
|
92
|
35
|
|
|
35
|
|
9676
|
%{ $cfg->get_section(section => 'core.variables') }, |
|
93
|
35
|
|
|
|
|
685
|
%{ $cfg->get_section(section => 'deploy.variables') }, |
|
94
|
|
|
|
|
|
|
%{ $cfg->get_section(section => 'revert.variables') }, |
|
95
|
35
|
|
|
|
|
133
|
%{ $target->variables }, # includes engine |
|
96
|
35
|
|
|
|
|
101
|
%{ $self->revert_variables }, # --set, --set-revert |
|
97
|
35
|
|
|
|
|
94
|
); |
|
98
|
35
|
|
|
|
|
607
|
} |
|
99
|
35
|
|
|
|
|
222
|
|
|
|
35
|
|
|
|
|
960
|
|
|
100
|
|
|
|
|
|
|
around options => sub { |
|
101
|
|
|
|
|
|
|
my ($orig, $class) = @_; |
|
102
|
|
|
|
|
|
|
return ($class->$orig), qw( |
|
103
|
|
|
|
|
|
|
target|t=s |
|
104
|
|
|
|
|
|
|
mode=s |
|
105
|
|
|
|
|
|
|
verify! |
|
106
|
|
|
|
|
|
|
set|s=s% |
|
107
|
|
|
|
|
|
|
set-deploy|e=s% |
|
108
|
|
|
|
|
|
|
set-revert|r=s% |
|
109
|
|
|
|
|
|
|
log-only |
|
110
|
|
|
|
|
|
|
lock-timeout=i |
|
111
|
|
|
|
|
|
|
y |
|
112
|
|
|
|
|
|
|
); |
|
113
|
|
|
|
|
|
|
}; |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
around configure => sub { |
|
116
|
|
|
|
|
|
|
my ( $orig, $class, $config, $opt ) = @_; |
|
117
|
|
|
|
|
|
|
my $cmd = $class->command; |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my $params = $class->$orig($config, $opt); |
|
120
|
|
|
|
|
|
|
for my $key (qw(log_only target lock_timeout)) { |
|
121
|
|
|
|
|
|
|
$params->{$key} = $opt->{$key} if exists $opt->{$key}; |
|
122
|
|
|
|
|
|
|
} |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# Verify? |
|
125
|
|
|
|
|
|
|
$params->{verify} = $opt->{verify} |
|
126
|
|
|
|
|
|
|
// $config->get( key => "$cmd.verify", as => 'boolean' ) |
|
127
|
|
|
|
|
|
|
// $config->get( key => 'deploy.verify', as => 'boolean' ) |
|
128
|
|
|
|
|
|
|
// 0; |
|
129
|
|
|
|
|
|
|
$params->{mode} = $opt->{mode} |
|
130
|
|
|
|
|
|
|
|| $config->get( key => "$cmd.mode" ) |
|
131
|
|
|
|
|
|
|
|| $config->get( key => 'deploy.mode' ) |
|
132
|
|
|
|
|
|
|
|| 'all'; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
if ( my $vars = $opt->{set} ) { |
|
135
|
|
|
|
|
|
|
# --set used for both revert and deploy. |
|
136
|
|
|
|
|
|
|
$params->{revert_variables} = $params->{deploy_variables} = $vars; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
if ( my $vars = $opt->{set_deploy} ) { |
|
140
|
|
|
|
|
|
|
# --set-deploy used only for deploy. |
|
141
|
|
|
|
|
|
|
$params->{deploy_variables} = { |
|
142
|
|
|
|
|
|
|
%{ $params->{deploy_variables} || {} }, |
|
143
|
|
|
|
|
|
|
%{ $vars }, |
|
144
|
|
|
|
|
|
|
}; |
|
145
|
|
|
|
|
|
|
} |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
if ( my $vars = $opt->{set_revert} ) { |
|
148
|
|
|
|
|
|
|
# --set-revert used only for revert. |
|
149
|
|
|
|
|
|
|
$params->{revert_variables} = { |
|
150
|
|
|
|
|
|
|
%{ $params->{revert_variables} || {} }, |
|
151
|
|
|
|
|
|
|
%{ $vars }, |
|
152
|
|
|
|
|
|
|
}; |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
$params->{no_prompt} = delete $opt->{y} // $config->get( |
|
156
|
|
|
|
|
|
|
key => "$cmd.no_prompt", |
|
157
|
|
|
|
|
|
|
as => 'bool', |
|
158
|
|
|
|
|
|
|
) // $config->get( |
|
159
|
|
|
|
|
|
|
key => 'revert.no_prompt', |
|
160
|
|
|
|
|
|
|
as => 'bool', |
|
161
|
|
|
|
|
|
|
) // 0; |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
$params->{prompt_accept} = $config->get( |
|
164
|
|
|
|
|
|
|
key => "$cmd.prompt_accept", |
|
165
|
|
|
|
|
|
|
as => 'bool', |
|
166
|
|
|
|
|
|
|
) // $config->get( |
|
167
|
|
|
|
|
|
|
key => 'revert.prompt_accept', |
|
168
|
|
|
|
|
|
|
as => 'bool', |
|
169
|
|
|
|
|
|
|
) // 1; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
return $params; |
|
172
|
|
|
|
|
|
|
}; |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=head1 Name |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
App::Sqitch::Role::RevertDeployCommand - A command that reverts and deploys |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 Synopsis |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
package App::Sqitch::Command::rebase; |
|
184
|
|
|
|
|
|
|
extends 'App::Sqitch::Command'; |
|
185
|
|
|
|
|
|
|
with 'App::Sqitch::Role::RevertDeployCommand'; |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 Description |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
This role encapsulates the common attributes and methods required by commands |
|
190
|
|
|
|
|
|
|
that both revert and deploy. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=head1 Interface |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=head2 Class Methods |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head3 C<options> |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
my @opts = App::Sqitch::Command::checkout->options; |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Adds options common to the commands that revert and deploy. |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head3 C<configure> |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Configures the options common to commands that revert and deploy. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head2 Attributes |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head3 C<log_only> |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
Boolean indicating whether to log the deploy without running the scripts. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=head3 C<lock_timeout> |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
The number of seconds to wait for an exclusive advisory lock on the target, |
|
215
|
|
|
|
|
|
|
for engines that support the feature. |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head3 C<no_prompt> |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Boolean indicating whether or not to prompt the user to really go through with |
|
220
|
|
|
|
|
|
|
the revert. |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head3 C<prompt_accept> |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Boolean value to indicate whether or not the default value for the prompt, |
|
225
|
|
|
|
|
|
|
should the user hit C<return>, is to accept the prompt or deny it. |
|
226
|
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head3 C<target> |
|
228
|
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
The deployment target URI. |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head3 C<verify> |
|
232
|
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
Boolean indicating whether or not to run verify scripts after deploying |
|
234
|
|
|
|
|
|
|
changes. |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=head3 C<mode> |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
Deploy mode, one of "change", "tag", or "all". |
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head1 See Also |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=over |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::rebase> |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
The C<rebase> command reverts and deploys changes. |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::checkout> |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
The C<checkout> command takes a VCS commit name, determines the last change in |
|
251
|
|
|
|
|
|
|
common with the current commit, reverts to that change, then checks out the |
|
252
|
|
|
|
|
|
|
named commit and re-deploys. |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=back |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
=head1 Author |
|
257
|
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
|
259
|
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=head1 License |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
Copyright (c) 2012-2022 iovation Inc., David E. Wheeler |
|
263
|
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
265
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
|
266
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
|
267
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
268
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
|
269
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
|
272
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
275
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
276
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
277
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
278
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
279
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
280
|
|
|
|
|
|
|
SOFTWARE. |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
=cut |