1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
use inc::Module::Install 0.91;
use strict;
use warnings;
# to deal wuth x.y.z versions properly
configure_requires 'ExtUtils::MakeMaker' => 6.54;
my $deps = {
requires => {
'Class::Base' => 0,
'Class::Data::Inheritable' => 0.02,
'Class::MakeMethods' => 0,
'Digest::SHA1' => 2.00,
'Carp::Clan' => 0,
'IO::Dir' => 0,
'IO::Scalar' => 2.110,
'Parse::RecDescent' => 1.962002,
'Pod::Usage' => 0,
'Class::Accessor::Fast' => 0,
'DBI' => 0,
'File::ShareDir' => 1.0,
'File::Spec' => 0,
'XML::Writer' => 0.500,
},
recommends => {
'Template' => 2.20,
'GD' => 0,
'GraphViz' => 0,
'Graph::Directed' => 0,
'Spreadsheet::ParseExcel' => 0.41,
'Text::ParseWords' => 0,
'Text::RecordParser' => 0.02,
'XML::LibXML' => 1.69,
},
test_requires => {
'YAML' => 0.66,
'File::Basename' => 0,
'Test::More' => 0.6,
'Test::Differences' => 0,
'Test::Exception' => 0,
},
};
perl_version '5.005';
name 'SQL-Translator';
author 'Ken Youens-Clark <kclark@cpan.org>';
abstract 'SQL DDL transformations and more';
license 'gpl';
repository 'https://sqlfairy.svn.sourceforge.net/svnroot/sqlfairy';
bugtracker 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator';
resources Ratings => 'http://cpanratings.perl.org/d/SQL-Translator';
all_from 'lib/SQL/Translator.pm';
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});
}
}
tests_recursive ();
install_script (qw|
script/sqlt-diagram
script/sqlt-diff
script/sqlt-diff-old
script/sqlt-dumper
script/sqlt-graph
script/sqlt
|);
install_share();
auto_provides();
auto_install();
if ($Module::Install::AUTHOR) {
_recompile_grammars();
_recreate_rt_source();
}
WriteAll();
sub _recompile_grammars {
# placeholder, will be used to recompile P::RD parsers before shipping
# will also allow to lose dependency on P::RD
}
sub _recreate_rt_source {
my $base_xml = "t/data/roundtrip.xml";
my $autogen_yaml = "t/data/roundtrip_autogen.yaml";
print "Updating $autogen_yaml\n";
unlink $autogen_yaml;
eval {
use lib 'lib';
require SQL::Translator;
require SQL::Translator::Parser::XML;
open (my $fh, '>', $autogen_yaml) or die "$autogen_yaml: $!\n";
my $tr = SQL::Translator->new;
my $yaml = $tr->translate (
parser => 'XML',
file => $base_xml,
producer => 'YAML',
) or die sprintf ("Unable to translate %s to YAML: %s\n",
$base_xml,
$tr->error || 'error unknown'
);
print $fh $yaml;
close $fh;
};
if ($@) {
print <<EOE;
=========================================================================
=============== FATAL ERROR =================
=========================================================================
Unable to update the roundtrip schema (attempt triggered by AUTHOR mode).
Aborting Makefile generation.
$@
EOE
exit 1;
}
}
|