Added parsing of field.extra
[dbsrgits/SQL-Translator.git] / Makefile.PL
index 549808b..3341280 100644 (file)
@@ -2,126 +2,59 @@ package SQL::Translator;
 
 use strict;
 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    => 1);
-check_version('Text::ParseWords'        => 0    => 0);
-check_version('Text::RecordParser'      => 0.02 => 0);
-check_version('XML::Writer'             => 0    => 1);
-check_version('XML::XPath'              => 0    => 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";
+my @SIGN;
+if ($ExtUtils::MakeMaker::VERSION >= 6.18) {
+    @SIGN = (SIGN => 1);
 }
 
 WriteMakefile(
     'NAME'         => __PACKAGE__,
+    @SIGN,
     'VERSION_FROM' => 'lib/SQL/Translator.pm',
     'EXE_FILES'    => [
-        'bin/sqlt-diagram.pl',
-        'bin/sqlt-dumper.pl',
-        'bin/sqlt-graph.pl',
-        'bin/sql_translator.pl',
+        'bin/sqlt-diagram',
+        'bin/sqlt-diff',
+        'bin/sqlt-dumper',
+        'bin/sqlt-graph',
+        'bin/sqlt',
     ],
-    'PREREQ_PM' => \%PREREQ_PM,
-    'clean' => {
+    'PREREQ_PM'    => {
+        'Class::Base'             => 0,
+        'File::Basename'          => 0,
+        'File::Spec'              => 0,
+        'GD'                      => 0,
+        'GraphViz'                => 0,
+        'IO::Dir'                 => 0,
+        'IO::File'                => 0,
+        'IO::Scalar'              => 0,
+        'Parse::RecDescent'       => 1.94,
+        'Pod::Usage'              => 0,
+        'Spreadsheet::ParseExcel' => 0.2602,
+        'Template'                => 2.10,
+        'Test::More'              => 0,
+        'Test::Exception'         => 0,
+        'Test::Differences'       => 0,
+        'Text::ParseWords'        => 0,
+        'Text::RecordParser'      => 0.02,
+        'XML::Writer'             => 0.500,
+        'XML::XPath'              => 1.13,
+        'YAML'                    => 0,
+    },
+    'clean'        => {
         FILES => '$(DISTVNAME).tar$(SUFFIX)',
     },
 );
 
-# ----------------------------------------------------------------------
-# 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) {
-        $load = "$module $version";
-    }
-    else {
-        $load = $module;
-    }
-
-    $dots = '.' x (36 - length($load));
+package MY;
+use File::Basename qw(basename);
 
-    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 $version = ${"$module\::VERSION"};
-        print "$load $dots $version";
-        print $optional ? optional($version) : required($version);
-        print "\n";
-    }
-
-    $PREREQ_PM{$module} = $version;
-}
+sub libscan {
+    my ($self, $file) = @_;
+    my $bfile = basename($file);
 
-sub optional { return _message("[optional]", @_) }
-sub required { return _message("", @_) }
+    return if $bfile =~ /^\.(?:cvs)?ignore$/;
+    return if $bfile =~ /\.swp$/;
 
-sub _message {
-    my ($message, $version) = @_;
-    my $size = 24 - (length "$version");
-    my $fmt = '%' . $size . 's';
-    sprintf $fmt => $message;
+    return $self->SUPER::libscan($file);
 }