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