line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use 5.010; |
3
|
15
|
|
|
15
|
|
15679
|
use strict; |
|
15
|
|
|
|
|
51
|
|
4
|
15
|
|
|
15
|
|
71
|
use warnings; |
|
15
|
|
|
|
|
31
|
|
|
15
|
|
|
|
|
346
|
|
5
|
15
|
|
|
15
|
|
70
|
use utf8; |
|
15
|
|
|
|
|
32
|
|
|
15
|
|
|
|
|
370
|
|
6
|
15
|
|
|
15
|
|
77
|
use Moo::Role; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
125
|
|
7
|
15
|
|
|
15
|
|
328
|
use Path::Class; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
108
|
|
8
|
15
|
|
|
15
|
|
5081
|
use App::Sqitch::Types qw(ArrayRef); |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
1199
|
|
9
|
15
|
|
|
15
|
|
98
|
use Locale::TextDomain qw(App-Sqitch); # XXX Until deprecation removed below. |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
162
|
|
10
|
15
|
|
|
15
|
|
9660
|
|
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
99
|
|
11
|
|
|
|
|
|
|
our $VERSION = 'v1.3.0'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
requires 'options'; |
14
|
|
|
|
|
|
|
requires 'configure'; |
15
|
|
|
|
|
|
|
requires 'target_params'; |
16
|
|
|
|
|
|
|
requires 'command'; # XXX Until deprecation removed below. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has _cx => ( |
19
|
|
|
|
|
|
|
is => 'ro', |
20
|
|
|
|
|
|
|
isa => ArrayRef, |
21
|
|
|
|
|
|
|
default => sub { [] }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
around options => sub { |
25
|
|
|
|
|
|
|
my $orig = shift; |
26
|
|
|
|
|
|
|
return $orig->(@_), qw( |
27
|
|
|
|
|
|
|
plan-file|f=s |
28
|
|
|
|
|
|
|
top-dir=s |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
around configure => sub { |
33
|
|
|
|
|
|
|
my ( $orig, $class, $config, $opt ) = @_; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# DEPRECATTION: --top-dir deprecated in v0.9999. Remove at some point. |
36
|
|
|
|
|
|
|
App::Sqitch->warn(__x( |
37
|
|
|
|
|
|
|
" Option --top-dir is deprecated for {command} and other non-configuration commands.\n Use --chdir instead.", |
38
|
|
|
|
|
|
|
command => $class->command, |
39
|
|
|
|
|
|
|
)) if $opt->{top_dir}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# Grab the target params. |
42
|
|
|
|
|
|
|
my @cx = ( |
43
|
|
|
|
|
|
|
do { my $f = delete $opt->{top_dir}; $f ? ( top_dir => dir($f)) : () }, |
44
|
|
|
|
|
|
|
do { my $f = delete $opt->{plan_file}; $f ? ( plan_file => file($f)) : () }, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# Let the command take care of its options. |
48
|
|
|
|
|
|
|
my $params = $class->$orig($config, $opt); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Hang on to the target parameters. |
51
|
|
|
|
|
|
|
$params->{_cx} = \@cx; |
52
|
|
|
|
|
|
|
return $params; |
53
|
|
|
|
|
|
|
}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
around target_params => sub { |
56
|
|
|
|
|
|
|
my ($orig, $self) = (shift, shift); |
57
|
|
|
|
|
|
|
return $self->$orig(@_), @{ $self->_cx }; |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 Name |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
App::Sqitch::Role::ContextCommand - A command that needs to know where things are |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 Synopsis |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
package App::Sqitch::Command::add; |
70
|
|
|
|
|
|
|
extends 'App::Sqitch::Command'; |
71
|
|
|
|
|
|
|
with 'App::Sqitch::Role::ContextCommand'; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 Description |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This role encapsulates the options and target parameters required by commands |
76
|
|
|
|
|
|
|
that need to know where to find project files. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 Interface |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 Class Methods |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head3 C<options> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my @opts = App::Sqitch::Command::add->options; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Adds contextual options C<--plan-file> and C<--top-dir>. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head3 C<configure> |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Configures the options used for target parameters. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 Instance Methods |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head3 C<target_params> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns a list of parameters to be passed to App::Sqitch::Target's C<new> |
97
|
|
|
|
|
|
|
and C<all_targets> methods. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 See Also |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::add> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The C<add> command adds changes to the the plan and change scripts to the project. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::deploy> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
The C<deploy> command deploys changes to a database. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item L<App::Sqitch::Command::bundle> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The C<bundle> command bundles Sqitch changes for distribution. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 Author |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 License |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Copyright (c) 2012-2022 iovation Inc., David E. Wheeler |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
126
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
127
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
128
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
129
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
130
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
133
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
136
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
137
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
138
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
139
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
140
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
141
|
|
|
|
|
|
|
SOFTWARE. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=cut |