| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Sqitch::Plan::Tag; |
|
2
|
|
|
|
|
|
|
|
|
3
|
50
|
|
|
50
|
|
877
|
use 5.010; |
|
|
50
|
|
|
|
|
186
|
|
|
4
|
50
|
|
|
50
|
|
311
|
use utf8; |
|
|
50
|
|
|
|
|
122
|
|
|
|
50
|
|
|
|
|
331
|
|
|
5
|
50
|
|
|
50
|
|
1297
|
use namespace::autoclean; |
|
|
50
|
|
|
|
|
117
|
|
|
|
50
|
|
|
|
|
405
|
|
|
6
|
50
|
|
|
50
|
|
4000
|
use Moo; |
|
|
50
|
|
|
|
|
131
|
|
|
|
50
|
|
|
|
|
386
|
|
|
7
|
50
|
|
|
50
|
|
19534
|
use App::Sqitch::Types qw(Str Change UserEmail DateTime); |
|
|
50
|
|
|
|
|
172
|
|
|
|
50
|
|
|
|
|
523
|
|
|
8
|
50
|
|
|
50
|
|
57209
|
use Encode; |
|
|
50
|
|
|
|
|
118
|
|
|
|
50
|
|
|
|
|
35068
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'App::Sqitch::Plan::Line'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = 'v1.4.0'; # VERSION |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub format_name { |
|
15
|
1195
|
|
|
1195
|
1
|
59532
|
'@' . shift->name; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has info => ( |
|
19
|
|
|
|
|
|
|
is => 'ro', |
|
20
|
|
|
|
|
|
|
isa => Str, |
|
21
|
|
|
|
|
|
|
lazy => 1, |
|
22
|
|
|
|
|
|
|
default => sub { |
|
23
|
|
|
|
|
|
|
my $self = shift; |
|
24
|
|
|
|
|
|
|
my $plan = $self->plan; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return join "\n", ( |
|
27
|
|
|
|
|
|
|
'project ' . $self->project, |
|
28
|
|
|
|
|
|
|
( $self->uri ? ( 'uri ' . $self->uri->canonical ) : () ), |
|
29
|
|
|
|
|
|
|
'tag ' . $self->format_name, |
|
30
|
|
|
|
|
|
|
'change ' . $self->change->id, |
|
31
|
|
|
|
|
|
|
'planner ' . $self->format_planner, |
|
32
|
|
|
|
|
|
|
'date ' . $self->timestamp->as_string, |
|
33
|
|
|
|
|
|
|
( $self->note ? ('', $self->note) : ()), |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has id => ( |
|
39
|
|
|
|
|
|
|
is => 'ro', |
|
40
|
|
|
|
|
|
|
isa => Str, |
|
41
|
|
|
|
|
|
|
lazy => 1, |
|
42
|
|
|
|
|
|
|
default => sub { |
|
43
|
|
|
|
|
|
|
my $content = encode_utf8 shift->info; |
|
44
|
|
|
|
|
|
|
require Digest::SHA; |
|
45
|
|
|
|
|
|
|
return Digest::SHA->new(1)->add( |
|
46
|
|
|
|
|
|
|
'tag ' . length($content) . "\0" . $content |
|
47
|
|
|
|
|
|
|
)->hexdigest; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has change => ( |
|
52
|
|
|
|
|
|
|
is => 'ro', |
|
53
|
|
|
|
|
|
|
isa => Change, |
|
54
|
|
|
|
|
|
|
weak_ref => 1, |
|
55
|
|
|
|
|
|
|
required => 1, |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
has timestamp => ( |
|
59
|
|
|
|
|
|
|
is => 'ro', |
|
60
|
|
|
|
|
|
|
isa => DateTime, |
|
61
|
|
|
|
|
|
|
default => sub { require App::Sqitch::DateTime && App::Sqitch::DateTime->now }, |
|
62
|
|
|
|
|
|
|
); |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
has planner_name => ( |
|
65
|
|
|
|
|
|
|
is => 'ro', |
|
66
|
|
|
|
|
|
|
isa => Str, |
|
67
|
|
|
|
|
|
|
default => sub { shift->sqitch->user_name }, |
|
68
|
|
|
|
|
|
|
); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has planner_email => ( |
|
71
|
|
|
|
|
|
|
is => 'ro', |
|
72
|
|
|
|
|
|
|
isa => UserEmail, |
|
73
|
|
|
|
|
|
|
default => sub { shift->sqitch->user_email }, |
|
74
|
|
|
|
|
|
|
); |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub format_planner { |
|
77
|
513
|
|
|
513
|
1
|
7856
|
my $self = shift; |
|
78
|
513
|
|
|
|
|
4071
|
return join ' ', $self->planner_name, '<' . $self->planner_email . '>'; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub format_content { |
|
82
|
82
|
|
|
82
|
1
|
170
|
my $self = shift; |
|
83
|
82
|
|
|
|
|
264
|
return join ' ', |
|
84
|
|
|
|
|
|
|
$self->SUPER::format_content, |
|
85
|
|
|
|
|
|
|
$self->timestamp->as_string, |
|
86
|
|
|
|
|
|
|
$self->format_planner; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
__END__ |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 Name |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
App::Sqitch::Plan::Tag - Sqitch deployment plan tag |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 Synopsis |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $plan = App::Sqitch::Plan->new( sqitch => $sqitch ); |
|
100
|
|
|
|
|
|
|
for my $line ($plan->lines) { |
|
101
|
|
|
|
|
|
|
say $line->as_string; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 Description |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
A App::Sqitch::Plan::Tag represents a tag as parsed from a plan file. In |
|
107
|
|
|
|
|
|
|
addition to the interface inherited from L<App::Sqitch::Plan::Line>, it offers |
|
108
|
|
|
|
|
|
|
interfaces fetching and formatting timestamp and planner information. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 Interface |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
See L<App::Sqitch::Plan::Line> for the basics. |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 Accessors |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head3 C<change> |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Returns the L<App::Sqitch::Plan::Change> object with which the tag is |
|
119
|
|
|
|
|
|
|
associated. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head3 C<timestamp> |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Returns the an L<App::Sqitch::DateTime> object representing the time at which |
|
124
|
|
|
|
|
|
|
the tag was added to the plan. |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head3 C<planner_name> |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Returns the name of the user who added the tag to the plan. |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head3 C<planner_email> |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
Returns the email address of the user who added the tag to the plan. |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head3 C<info> |
|
135
|
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Information about the tag, returned as a string. Includes the tag ID, the ID |
|
137
|
|
|
|
|
|
|
of the associated change, the name and email address of the user who added the |
|
138
|
|
|
|
|
|
|
tag to the plan, and the timestamp for when the tag was added to the plan. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head3 C<id> |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
A SHA1 hash of the data returned by C<info()>, which can be used as a |
|
143
|
|
|
|
|
|
|
globally-unique identifier for the tag. |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 Instance Methods |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head3 C<format_planner> |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
my $planner = $tag->format_planner; |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Returns a string formatted with the name and email address of the user who |
|
152
|
|
|
|
|
|
|
added the tag to the plan. |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 Author |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
David E. Wheeler <david@justatheory.com> |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head1 License |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Copyright (c) 2012-2023 iovation Inc., David E. Wheeler |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
164
|
|
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal |
|
165
|
|
|
|
|
|
|
in the Software without restriction, including without limitation the rights |
|
166
|
|
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
167
|
|
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is |
|
168
|
|
|
|
|
|
|
furnished to do so, subject to the following conditions: |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all |
|
171
|
|
|
|
|
|
|
copies or substantial portions of the Software. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
174
|
|
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
175
|
|
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
176
|
|
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
177
|
|
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
178
|
|
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
179
|
|
|
|
|
|
|
SOFTWARE. |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=cut |