quote SQLite identifiers
[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,
27ae9ae7 25 'Moo' => 0.009007,
6e64adbe 26 },
27 recommends => {
3e1ed76b 28 'Template' => 2.20,
02cc14bb 29 'GD' => 0,
30 'GraphViz' => 0,
31 'Graph::Directed' => 0,
32 'Spreadsheet::ParseExcel' => 0.41,
33 'Text::ParseWords' => 0,
34 'Text::RecordParser' => 0.02,
11ad2df9 35 'XML::LibXML' => 1.69,
6e64adbe 36 },
37 test_requires => {
dd299a76 38 'YAML' => 0.66,
02cc14bb 39 'File::Basename' => 0,
40 'Test::More' => 0.6,
41 'Test::Differences' => 0,
42 'Test::Exception' => 0,
6e64adbe 43 },
44};
45
46perl_version '5.005';
47
48name 'SQL-Translator';
49author 'Ken Youens-Clark <kclark@cpan.org>';
50abstract 'SQL DDL transformations and more';
44659089 51license 'gpl';
3f5ee660 52repository 'git://git.shadowcat.co.uk/dbsrgits/SQL-Translator.git';
6e64adbe 53bugtracker 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator';
54
55resources Ratings => 'http://cpanratings.perl.org/d/SQL-Translator';
56
57all_from 'lib/SQL/Translator.pm';
58
59for my $type (qw/requires recommends test_requires/) {
60 no strict qw/refs/;
61 my $f = \&$type;
62 for my $mod (keys %{$deps->{$type} || {} }) {
63 $f->($mod, $deps->{$type}{$mod});
64 }
65}
66
67tests_recursive ();
68
69install_script (qw|
467b7282 70 script/sqlt-diagram
71 script/sqlt-diff
72 script/sqlt-diff-old
73 script/sqlt-dumper
74 script/sqlt-graph
75 script/sqlt
6e64adbe 76|);
77
78install_share();
79
80auto_provides();
81
82auto_install();
83
dc34f950 84if ($Module::Install::AUTHOR) {
85 _recompile_grammars();
86 _recreate_rt_source();
87}
88
6e64adbe 89WriteAll();
dc34f950 90
dc34f950 91sub _recompile_grammars {
92 # placeholder, will be used to recompile P::RD parsers before shipping
93 # will also allow to lose dependency on P::RD
94}
95
96sub _recreate_rt_source {
97 my $base_xml = "t/data/roundtrip.xml";
98 my $autogen_yaml = "t/data/roundtrip_autogen.yaml";
99
100 print "Updating $autogen_yaml\n";
101
102 unlink $autogen_yaml;
103
104 eval {
105
106 use lib 'lib';
107
108 require SQL::Translator;
109 require SQL::Translator::Parser::XML;
110
111 open (my $fh, '>', $autogen_yaml) or die "$autogen_yaml: $!\n";
112
113 my $tr = SQL::Translator->new;
114 my $yaml = $tr->translate (
115 parser => 'XML',
116 file => $base_xml,
117 producer => 'YAML',
118 ) or die sprintf ("Unable to translate %s to YAML: %s\n",
119 $base_xml,
120 $tr->error || 'error unknown'
121 );
122
123 print $fh $yaml;
124 close $fh;
125 };
126
127 if ($@) {
d53db6a7 128 warn <<EOE;
dc34f950 129
130=========================================================================
d53db6a7 131=============== WARNING !!! =================
dc34f950 132=========================================================================
133
134Unable to update the roundtrip schema (attempt triggered by AUTHOR mode).
d53db6a7 135We will still generate a Makefile, but be aware that if you build a dist
136this way, it *WILL* be broken.
dc34f950 137
d53db6a7 138-------------------------------------------------------------------------
dc34f950 139$@
140
d53db6a7 141Press Enter to continue.
dc34f950 142EOE
d53db6a7 143 <>;
dc34f950 144 }
145}