Merge 'roundtrip' into 'trunk'
[dbsrgits/SQL-Translator.git] / Makefile.PL
index 549808b..45eaa98 100644 (file)
-package SQL::Translator;
-
+use inc::Module::Install 0.89;
 use strict;
-use ExtUtils::MakeMaker;
-$|++;
-
-my %PREREQ_PM;
-my %missing = (
-    optional => [ ],
-    required => [ ],
-);
+use warnings;
 
-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);
+my $deps = {
+  requires => {
+    'Class::Base'              => 0,
+    'Class::Data::Inheritable' => 0.02,
+    'Class::MakeMethods'       => 0,
+    'Digest::SHA1'             => 2.00,
+    'Carp::Clan',              => 0,
+    'IO::Dir'                  => 0,
+    'Parse::RecDescent'        => 1.096000,   # PBP ftw
+    'Pod::Usage'               => 0,
+    'Class::Accessor::Fast'    => 0,
+    'DBI'                      => 0,
+    'File::ShareDir'           => 1.0,
+    'File::Spec'               => 0,
+  },
+  recommends => {
+    'Template'                => 2.10,
+    'GD'                      => 0,
+    'GraphViz'                => 0,
+    'Graph::Directed'         => 0,
+    'IO::File'                => 0,
+    'IO::Scalar'              => 0,
+    'Spreadsheet::ParseExcel' => 0.41,
+    'Text::ParseWords'        => 0,
+    'Text::RecordParser'      => 0.02,
+    'XML::Writer'             => 0.500,
+    'XML::LibXML'             => 1.61,
+  },
+  test_requires => {
+    'File::Basename'          => 0,
+    'Test::More'              => 0.6,
+    'Test::Differences'       => 0,
+    'Test::Exception'         => 0,
+    'YAML'                    => 0.39,
+  },
+};
 
-print "\n";
+perl_version '5.005';
 
-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'}};
-    }
+name        'SQL-Translator';
+author      'Ken Youens-Clark <kclark@cpan.org>';
+abstract    'SQL DDL transformations and more';
+license     'http://fsf.org/licensing/licenses/gpl.html';
+repository  'https://sqlfairy.svn.sourceforge.net/svnroot/sqlfairy';
+bugtracker  'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator';
 
-    print "\n";
-}
+resources Ratings => 'http://cpanratings.perl.org/d/SQL-Translator';
 
-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)',
-    },
-);
+all_from    'lib/SQL/Translator.pm';
 
-# ----------------------------------------------------------------------
-# 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);
+for my $type (qw/requires recommends test_requires/) {
+  no strict qw/refs/;
+  my $f = \&$type;
+  for my $mod (keys %{$deps->{$type} || {} }) {
+    $f->($mod, $deps->{$type}{$mod});
+  }
+}
 
-    if ($version) {
-        $load = "$module $version";
-    }
-    else {
-        $load = $module;
-    }
+tests_recursive ();
 
-    $dots = '.' x (36 - length($load));
+install_script (qw|
+  bin/sqlt-diagram
+  bin/sqlt-diff
+  bin/sqlt-diff-old
+  bin/sqlt-dumper
+  bin/sqlt-graph
+  bin/sqlt
+|);
 
-    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";
-    }
+install_share();
 
-    $PREREQ_PM{$module} = $version;
-}
+auto_provides();
 
-sub optional { return _message("[optional]", @_) }
-sub required { return _message("", @_) }
+auto_install();
 
-sub _message {
-    my ($message, $version) = @_;
-    my $size = 24 - (length "$version");
-    my $fmt = '%' . $size . 's';
-    sprintf $fmt => $message;
-}
+WriteAll();