| 1 | # ABSTRACT: Migrate an existing repository to a new version | ||||||||||
| 2 | |||||||||||
| 3 | package Pinto::Migrator; | ||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooseX::StrictConstructor; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use MooseX::MarkAsMethods ( autoclean => 1 ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | use Pinto::Types qw(Dir); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 1 | ▶ | use Pinto::Repository; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | #------------------------------------------------------------------------------ | ||||||||||
| 13 | |||||||||||
| 14 | 1 | our $VERSION = '0.14'; # VERSION | |||||||||
| 15 | |||||||||||
| 16 | #------------------------------------------------------------------------------ | ||||||||||
| 17 | |||||||||||
| 18 | has root => ( | ||||||||||
| 19 | is => 'ro', | ||||||||||
| 20 | isa => Dir, | ||||||||||
| 21 | default => $ENV{PINTO_REPOSITORY_ROOT}, | ||||||||||
| 22 | 1 | coerce => 1, | |||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | #------------------------------------------------------------------------------ | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub migrate { | ||||||||
|
Subroutine
migrate: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||
| 28 | 0 | my ($self) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 0 | my $repo = Pinto::Repository->new( root => $self->root ); | |||||||||
| 31 | |||||||||||
| 32 | 0 | my $repo_version = $repo->get_version; | |||||||||
| 33 | 0 | my $code_version = $Pinto::Repository::REPOSITORY_VERSION; | |||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | die "This repository is too old to migrate.\n" . "Contact thaljef\@cpan.org for a migration plan.\n" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | if not $repo_version; | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | die "This repository is already up to date.\n" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | if $repo_version == $code_version; | ||||||||||
| 40 | |||||||||||
| 41 | 0 | ▶ | die "This repository too new. Upgrade Pinto instead.\n" | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | if $repo_version > $code_version; | ||||||||||
| 43 | |||||||||||
| 44 | 0 | die "Migration is not implemented yet\n"; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | #------------------------------------------------------------------------------ | ||||||||||
| 48 | |||||||||||
| 49 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||
| 50 | |||||||||||
| 51 | #------------------------------------------------------------------------------ | ||||||||||
| 52 | |||||||||||
| 53 | 1 | 1; | |||||||||
| 54 | |||||||||||
| 55 | __END__ | ||||||||||