Release commit for 1.62
[dbsrgits/SQL-Translator.git] / Makefile.PL
index f90d648..70080cb 100644 (file)
-package SQL::Translator;
-
 use strict;
+use warnings;
 use ExtUtils::MakeMaker;
-$|++;
-
-my %PREREQ_PM;
-my %missing = (
-    optional => [ ],
-    required => [ ],
-);
-
-print "Checking for required and recommended modules.\n";
-#              Module Name              Version Optional?
-check_version('Class::Base'             => 0    => 0);
-check_version('File::Basename'          => 0    => 0);
-check_version('File::Spec'              => 0    => 0);
-check_version('GD'                      => 0    => 1);
-check_version('GraphViz'                => 0    => 1);
-check_version('IO::Dir'                 => 0    => 0);
-check_version('IO::File'                => 0    => 0);
-check_version('IO::Scalar'              => 0    => 0);
-check_version('Parse::RecDescent'       => 1.94 => 0);
-check_version('Pod::Usage'              => 0    => 0);
-check_version('Spreadsheet::ParseExcel' => 0    => 1);
-check_version('Template'                => 2.10 => 1);
-check_version('Test::More'              => 0    => 0);
-check_version('Test::Exception'         => 0    => 0);
-check_version('Test::Differences'       => 0    => 0);
-check_version('Text::ParseWords'        => 0    => 0);
-check_version('Text::RecordParser'      => 0.02 => 0);
-check_version('XML::Writer'             => 0    => 1);
-check_version('XML::XPath'              => 1.13 => 1);
-
-print "\n";
-
-if (@{$missing{'optional'}} + @{$missing{'required'}}) {
-    print "Some components might not work correctly:\n";
-    my $count;
-    if ($missing{'required'}) {
-        $count = scalar(@{$missing{'required'}});
-        printf "  You are missing %d required module%s: %s\n",
-            $count,
-            $count == 1 ? '' : 's',
-            join ', ', @{$missing{'required'}};
-    }
-    if ($missing{'optional'}) {
-        $count = scalar(@{$missing{'optional'}});
-        printf "  You are missing %d optional module%s: %s\n",
-            $count,
-            $count == 1 ? '' : 's',
-            join ', ', @{$missing{'optional'}};
-    }
-
-    print "\n";
-}
+use File::ShareDir::Install;
+do './maint/Makefile.PL.include' or die $@
+  unless -f 'META.yml';
+my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
 
-WriteMakefile(
-    'NAME'         => __PACKAGE__,
-    'VERSION_FROM' => 'lib/SQL/Translator.pm',
-    'EXE_FILES'    => [
-        'bin/sqlt-diagram.pl',
-        'bin/sqlt-dumper.pl',
-        'bin/sqlt-graph.pl',
-        'bin/sql_translator.pl',
-    ],
-    'PREREQ_PM' => \%PREREQ_PM,
-    'clean' => {
-        FILES => '$(DISTVNAME).tar$(SUFFIX)',
+my %eumm_args = (
+  NAME => 'SQL::Translator',
+  ABSTRACT => 'SQL DDL transformations and more',
+  VERSION_FROM => 'lib/SQL/Translator.pm',
+  LICENSE => 'perl',
+  MIN_PERL_VERSION => '5.008001',
+  CONFIGURE_REQUIRES => {
+    'ExtUtils::MakeMaker' => '6.54', # to deal with x.y.z versions properly
+    'File::ShareDir::Install' => '0',
+  },
+  TEST_REQUIRES => {
+    'JSON::MaybeXS'            => '1.003003',
+    'YAML'                     => '0.66',
+    'XML::Writer'              => '0.500',
+    'Test::More'               => '0.88',
+    'Test::Differences'        => '0',
+    'Test::Exception'          => '0.31',
+    'Text::ParseWords'         => '0',
+  },
+  PREREQ_PM => {
+    'Digest::SHA'              => '0',
+    'Carp::Clan'               => '0',
+    'Parse::RecDescent'        => '1.967009',
+    'DBI'                      => '1.54',
+    'File::ShareDir'           => '1.0',
+    'Moo'                      => '1.000003',
+    'Package::Variant'         => '1.001001',
+    'Sub::Quote'               => '0',
+    'Try::Tiny'                => '0.04',
+    'Scalar::Util'             => '0',
+  },
+  realclean => {
+      FILES => 't/data/roundtrip_autogen.yaml'
+  },
+  EXE_FILES => [ qw|
+    script/sqlt-diagram
+    script/sqlt-diff
+    script/sqlt-diff-old
+    script/sqlt-dumper
+    script/sqlt-graph
+    script/sqlt
+  | ],
+  META_MERGE => {
+    "meta-spec" => { version => 2 },
+    dynamic_config => 0,
+    resources => {
+      bugtracker => {
+        web    =>  'https://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator',
+        mailto => 'bug-SQL-Translator@rt.cpan.org',
+      },
+      repository => {
+        type => 'git',
+        url  => 'git@github.com/dbsrgits/sql-translator.git',
+        web  => 'https://github.com/dbsrgits/sql-translator/',
+      },
+      license => [ 'http://dev.perl.org/licenses/' ],
+      x_IRC => 'irc://irc.perl.org/#sql-translator',
+      x_Ratings => 'http://cpanratings.perl.org/d/SQL-Translator',
     },
+    x_authority => 'cpan:JROBINSON',
+    no_index => {
+      directory => [qw(maint share xt)],
+    },
+    prereqs => {
+      runtime => {
+        recommends => {
+          'Template'                 => '2.20',
+          'GD'                       => '0',
+          'GraphViz'                 => '0',
+          'Graph::Directed'          => '0',
+          'Spreadsheet::ParseExcel'  => '0.41',
+          'Text::RecordParser'       => '0.02',
+          'XML::LibXML'              => '1.69',
+        },
+      },
+      develop => {
+        requires => {
+          'Template'                 => '2.20',
+          'GD'                       => '0',
+          'GraphViz'                 => '0',
+          'Graph::Directed'          => '0',
+          'Spreadsheet::ParseExcel'  => '0.41',
+          'Text::RecordParser'       => '0.02',
+          'XML::LibXML'              => '1.69',
+          'Test::EOL'                => '1.1',
+          'Test::NoTabs'             => '1.1',
+          'Software::LicenseUtils'   => '0', # for Distar
+        },
+      },
+    },
+  },
 );
 
-# ----------------------------------------------------------------------
-# check_version($module, $version, $optional)
-#
-# Takes a module name, optional version number, and a flag indicating
-# whether the module is optional (default is no).
-# ----------------------------------------------------------------------
-sub check_version {
-    my ($module, $version, $optional) = @_;
-    my ($dots, $load);
-
-    if ($version) {
-        $version = sprintf "%.02f", $version;
-        $load = "$module $version";
-    }
-    else {
-        $load = $module;
-    }
-
-    $dots = '.' x (36 - length($load));
+install_share 'share';
 
-    eval "use $load;";
-    if ($@) {
-        if ($optional) {
-            push @{$missing{'optional'}}, $module;
-        }
-        else {
-            push @{$missing{'required'}}, $module;
-        }
-        print "$load $dots not found!";
-        if ($optional) {
-            print optional('not found!'), "\n";
-            return;
-        }
-        print required('not found!');
-        print "\n";
-    }
-    else {
-        no strict qw(refs);
-        my $ver = sprintf "%.02f" => ${"$module\::VERSION"};
-        print "$load $dots $ver";
-        print $optional ? optional($ver) : required($ver);
-        print "\n";
-        $version = $ver;
-    }
-
-    $PREREQ_PM{$module} = $version;
+sub _move_to {
+  my ($hash, $fromkey, $tokey) = @_;
+  $hash->{$tokey} = {
+    %{ $hash->{$tokey} || {} },
+    %{ delete($hash->{$fromkey}) || {} },
+  };
 }
+delete $eumm_args{META_MERGE} if $eumm_version < 6.45_01;
+delete $eumm_args{CONFIGURE_REQUIRES}
+  if $eumm_version < 6.51_03; # too late to use so just delete
+_move_to(\%eumm_args, 'TEST_REQUIRES', 'BUILD_REQUIRES')
+  if $eumm_version < 6.63_03;
+_move_to(\%eumm_args, 'BUILD_REQUIRES', 'PREREQ_PM')
+  if $eumm_version < 6.55_01;
+$eumm_args{NO_MYMETA} = 1
+  if $eumm_version >= 6.57_02 and $eumm_version < 6.57_07;
+WriteMakefile(%eumm_args);
 
-sub optional { return _message("[optional]", @_) }
-sub required { return _message("", @_) }
-
-sub _message {
-    my ($message, $version) = @_;
-    my $size = 24 - (length "$version");
-    my $fmt = '%' . $size . 's';
-    sprintf $fmt => $message;
-}
+package MY;
+use File::ShareDir::Install qw(postamble);