| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package Footprintless::Plugin::Database::DefaultCommandHelper; | ||
| 5 | $Footprintless::Plugin::Database::DefaultCommandHelper::VERSION = '1.06'; | ||
| 6 | # ABSTRACT: The default implementation of command helper for db | ||
| 7 | # PODNAME: Footprintless::Plugin::Database::DefaultCommandHelper | ||
| 8 | |||
| 9 | use Carp; | ||
| 10 | |||
| 11 | sub new { | ||
| 12 | return bless( {}, shift )->_init(@_); | ||
| 13 | } | ||
| 14 | |||
| 15 | sub allowed_destination { | ||
| 16 | my ( $self, $coordinate ) = @_; | ||
| 17 | return 1; | ||
| 18 | } | ||
| 19 | |||
| 20 | sub _init { | ||
| 21 | my ( $self, $footprintless ) = @_; | ||
| 22 | $self->{footprintless} = $footprintless; | ||
| 23 | return $self; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub locate_file { | ||
| 27 | my ( $self, $file ) = @_; | ||
| 28 | croak("file not found [$file]") unless ( -f $file ); | ||
| 29 | return $file; | ||
| 30 | } | ||
| 31 | |||
| 32 | sub post_restore { | ||
| 33 | my ( $self, $from_coordinate, $to_coordinate ) = @_; | ||
| 34 | my $file; | ||
| 35 | eval { $file = $self->locate_file("$from_coordinate-$to_coordinate.sql"); }; | ||
| 36 | return $file; | ||
| 37 | } | ||
| 38 | |||
| 39 | 1; | ||
| 40 | |||
| 41 | __END__ |