Commit | Line | Data |
475a7db7 |
1 | use inc::Module::Install 0.91; |
6e64adbe |
2 | use strict; |
3 | use warnings; |
4 | |
475a7db7 |
5 | # to deal wuth x.y.z versions properly |
6 | configure_requires 'ExtUtils::MakeMaker' => 6.54; |
7 | |
6e64adbe |
8 | my $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, |
dc34f950 |
23 | 'XML::Writer' => 0.500, |
6e64adbe |
24 | }, |
25 | recommends => { |
3e1ed76b |
26 | 'Template' => 2.20, |
02cc14bb |
27 | 'GD' => 0, |
28 | 'GraphViz' => 0, |
29 | 'Graph::Directed' => 0, |
30 | 'Spreadsheet::ParseExcel' => 0.41, |
31 | 'Text::ParseWords' => 0, |
32 | 'Text::RecordParser' => 0.02, |
11ad2df9 |
33 | 'XML::LibXML' => 1.69, |
6e64adbe |
34 | }, |
35 | test_requires => { |
dd299a76 |
36 | 'YAML' => 0.66, |
02cc14bb |
37 | 'File::Basename' => 0, |
38 | 'Test::More' => 0.6, |
39 | 'Test::Differences' => 0, |
40 | 'Test::Exception' => 0, |
6e64adbe |
41 | }, |
42 | }; |
43 | |
44 | perl_version '5.005'; |
45 | |
46 | name 'SQL-Translator'; |
47 | author 'Ken Youens-Clark <kclark@cpan.org>'; |
48 | abstract 'SQL DDL transformations and more'; |
70289ed1 |
49 | license 'gpl'; |
6e64adbe |
50 | repository 'https://sqlfairy.svn.sourceforge.net/svnroot/sqlfairy'; |
51 | bugtracker 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator'; |
52 | |
53 | resources Ratings => 'http://cpanratings.perl.org/d/SQL-Translator'; |
54 | |
55 | all_from 'lib/SQL/Translator.pm'; |
56 | |
475a7db7 |
57 | |
6e64adbe |
58 | for 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 | |
66 | tests_recursive (); |
67 | |
68 | install_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 | |
77 | install_share(); |
78 | |
79 | auto_provides(); |
80 | |
81 | auto_install(); |
82 | |
dc34f950 |
83 | if ($Module::Install::AUTHOR) { |
84 | _recompile_grammars(); |
85 | _recreate_rt_source(); |
86 | } |
87 | |
6e64adbe |
88 | WriteAll(); |
dc34f950 |
89 | |
90 | |
91 | sub _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 | |
96 | sub _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 ($@) { |
128 | print <<EOE; |
129 | |
130 | ========================================================================= |
131 | =============== FATAL ERROR ================= |
132 | ========================================================================= |
133 | |
134 | Unable to update the roundtrip schema (attempt triggered by AUTHOR mode). |
135 | Aborting Makefile generation. |
136 | |
137 | $@ |
138 | |
139 | EOE |
140 | exit 1; |
141 | } |
142 | } |