| 1 | # ABSTRACT: migrate repository to a new version | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | package App::Pinto::Command::migrate; | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Class::Load; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Pinto::Util qw(is_remote_repo); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | #----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use base 'App::Pinto::Command'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | sub validate_args { | ||||||||||||||||||||||||||
|
Subroutine
validate_args: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 0 | my ( $self, $opts, $args ) = @_; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | $self->usage_error('Arguments are not allowed') | ||||||||||||||||||||||||||||
| 25 | 0 | ▶ | if @{$args}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | return 1; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 0 | my ( $self, $opts, $args ) = @_; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 0 | my $global_opts = $self->app->global_options; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | die "Must specify a repository root directory\n" | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | unless $global_opts->{root} ||= $ENV{PINTO_REPOSITORY_ROOT}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$global_opts->{"root"} ||= $ENV{"PINTO_REPOSITORY_ROOT"}
MC/DC0%0/2
$global_opts->{"root"} ||= $ENV{"PINTO_REPOSITORY_ROOT"}
$global_opts->{"root"}
$ENV{"PINTO_REPOSITORY_ROOT"}
Truth table0%0/3
A ||= B
A= $global_opts->{"root"}B= $ENV{"PINTO_REPOSITORY_ROOT"}
| |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | die "Cannot migrate remote repositories\n" | ||||||||||||||||||||||||||||
| 41 | 0 | ▶ | if is_remote_repo( $global_opts->{root} ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | my $class = $self->load_migrator; | |||||||||||||||||||||||||||
| 44 | 0 | my $migrator = $class->new( %{$global_opts} ); | |||||||||||||||||||||||||||
| 45 | 0 | $migrator->migrate; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | return 0; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub load_migrator { | ||||||||||||||||||||||||||
|
Subroutine
load_migrator: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 0 | my $class = 'Pinto::Migrator'; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | my ( $ok, $error ) = Class::Load::try_load_class($class); | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | return $class if $ok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my $msg = $error =~ m/Can't locate .* in \@INC/ ## no critic (ExtendedFormat) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | ? "Must install Pinto to migrate repositories\n" | ||||||||||||||||||||||||||||
| 61 | : $error; | ||||||||||||||||||||||||||||
| 62 | 0 | die $msg; | |||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||
| 66 | 1 | 1; | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | __END__ | ||||||||||||||||||||||||||||