| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  |  | 
| 2 |  |  |  |  |  |  | use 5.010; | 
| 3 | 2 |  |  | 2 |  | 1631 | use strict; | 
|  | 2 |  |  |  |  | 8 |  | 
| 4 | 2 |  |  | 2 |  | 12 | use warnings; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 36 |  | 
| 5 | 2 |  |  | 2 |  | 8 | use utf8; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 69 |  | 
| 6 | 2 |  |  | 2 |  | 11 | use Moo; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 7 | 2 |  |  | 2 |  | 36 | use App::Sqitch::Types qw(URI Maybe Str Bool HashRef); | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 10 |  | 
| 8 | 2 |  |  | 2 |  | 686 | use Locale::TextDomain qw(App-Sqitch); | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 22 |  | 
| 9 | 2 |  |  | 2 |  | 2239 | use App::Sqitch::X qw(hurl); | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 14 |  | 
| 10 | 2 |  |  | 2 |  | 376 | use List::Util qw(first); | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 18 |  | 
| 11 | 2 |  |  | 2 |  | 616 | use namespace::autoclean; | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 103 |  | 
| 12 | 2 |  |  | 2 |  | 15 | extends 'App::Sqitch::Command'; | 
|  | 2 |  |  |  |  | 4 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 13 |  |  |  |  |  |  | with 'App::Sqitch::Role::ConnectingCommand'; | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | our $VERSION = 'v1.3.1'; # VERSION | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | has target => ( | 
| 18 |  |  |  |  |  |  | is  => 'ro', | 
| 19 |  |  |  |  |  |  | isa => Str, | 
| 20 |  |  |  |  |  |  | ); | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | return qw( | 
| 23 |  |  |  |  |  |  | target|t=s | 
| 24 |  |  |  |  |  |  | ); | 
| 25 |  |  |  |  |  |  | } | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  | my $self = shift; | 
| 28 |  |  |  |  |  |  | my ($targets) = $self->parse_args( | 
| 29 |  |  |  |  |  |  | target => $self->target, | 
| 30 | 5 |  |  | 5 | 1 | 4848 | args   => \@_, | 
| 31 | 5 |  |  |  |  | 33 | ); | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | # Warn on multiple targets. | 
| 34 |  |  |  |  |  |  | my $target = shift @{ $targets }; | 
| 35 |  |  |  |  |  |  | $self->warn(__x( | 
| 36 |  |  |  |  |  |  | 'Too many targets specified; using {target}', | 
| 37 | 5 |  |  |  |  | 10 | target => $target->name, | 
|  | 5 |  |  |  |  | 7 |  | 
| 38 |  |  |  |  |  |  | )) if @{ $targets }; | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | my $engine = $target->engine; | 
| 41 | 5 | 50 |  |  |  | 8 |  | 
|  | 5 |  |  |  |  | 12 |  | 
| 42 |  |  |  |  |  |  | if ($engine->needs_upgrade) { | 
| 43 | 5 |  |  |  |  | 89 | $self->info(__x( | 
| 44 |  |  |  |  |  |  | 'Upgrading registry {registry} to version {version}', | 
| 45 | 5 | 100 |  |  |  | 754 | registry => $engine->registry_destination, | 
| 46 | 1 |  |  |  |  | 23 | version  => $engine->registry_release, | 
| 47 |  |  |  |  |  |  | )); | 
| 48 |  |  |  |  |  |  | $engine->upgrade_registry; | 
| 49 |  |  |  |  |  |  | } else { | 
| 50 |  |  |  |  |  |  | $self->info(__x( | 
| 51 | 1 |  |  |  |  | 140 | 'Registry {registry} is up-to-date at version {version}', | 
| 52 |  |  |  |  |  |  | registry => $engine->registry_destination, | 
| 53 | 4 |  |  |  |  | 36 | version  => $engine->registry_release, | 
| 54 |  |  |  |  |  |  | )); | 
| 55 |  |  |  |  |  |  | } | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | return $self; | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 5 |  |  |  |  | 1019 | 1; | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =head1 Name | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | App::Sqitch::Command::upgrade - Upgrade the Sqitch registry | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head1 Synopsis | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | my $cmd = App::Sqitch::Command::upgrade->new(%params); | 
| 70 |  |  |  |  |  |  | $cmd->execute; | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | =head1 Description | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | If you want to know how to use the C<upgrade> command, you probably want to be | 
| 75 |  |  |  |  |  |  | reading C<sqitch-upgrade>. But if you really want to know how the C<upgrade> | 
| 76 |  |  |  |  |  |  | command works, read on. | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | =head1 Interface | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =head2 Class Methods | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head3 C<options> | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | my @opts = App::Sqitch::Command::upgrade->options; | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | Returns a list of L<Getopt::Long> option specifications for the command-line | 
| 87 |  |  |  |  |  |  | options for the C<upgrade> command. | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | =head2 Attributes | 
| 90 |  |  |  |  |  |  |  | 
| 91 |  |  |  |  |  |  | =head3 C<target> | 
| 92 |  |  |  |  |  |  |  | 
| 93 |  |  |  |  |  |  | The upgrade target. | 
| 94 |  |  |  |  |  |  |  | 
| 95 |  |  |  |  |  |  | =head2 Instance Methods | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | =head3 C<execute> | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | $upgrade->execute; | 
| 100 |  |  |  |  |  |  |  | 
| 101 |  |  |  |  |  |  | Executes the upgrade command. | 
| 102 |  |  |  |  |  |  |  | 
| 103 |  |  |  |  |  |  | =head1 See Also | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =over | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | =item L<sqitch-upgrade> | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | Documentation for the C<upgrade> command to the Sqitch command-line client. | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =item L<sqitch> | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | The Sqitch command-line client. | 
| 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 |