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