File Coverage

blib/lib/Anego/Task/Diff.pm
Criterion Covered Total %
statement 15 20 75.0
branch 0 2 0.0
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 29 68.9


line stmt bran cond sub pod time code
1             package Anego::Task::Diff;
2 1     1   5 use strict;
  1         2  
  1         21  
3 1     1   4 use warnings;
  1         1  
  1         17  
4 1     1   3 use utf8;
  1         2  
  1         3  
5 1     1   298 use SQL::Translator::Diff;
  1         36010  
  1         29  
6              
7 1     1   7 use Anego::Config;
  1         2  
  1         134  
8              
9             sub diff {
10 0     0 0   my ($class, $source, $target) = @_;
11 0           my $config = Anego::Config->load;
12              
13 0           my $diff = SQL::Translator::Diff->new({
14             output_db => $config->rdbms,
15             source_schema => $source->schema,
16             target_schema => $target->schema,
17             })->compute_differences->produce_diff_sql;
18              
19             # ignore initial comments.
20 0           1 while $diff =~ s/\A--.*?\r?\n//ms;
21              
22 0 0         return $diff =~ /\A\s*-- No differences found;\s*\z/ms ? undef : $diff;
23             }
24              
25             1;