Build support for installing templates.
[dbsrgits/SQL-Translator.git] / Build.PL
CommitLineData
50f63fb1 1# $Id: Build.PL,v 1.9 2006-01-20 15:04:55 grommit Exp $
5e14531f 2
3use strict;
50f63fb1 4use lib './lib';
5use SQL::Translator::Module::Build;
5e14531f 6
50f63fb1 7my $builder = SQL::Translator::Module::Build->new(
5e14531f 8 create_readme => 0,
9 dist_abstract => 'SQL DDL transformations and more',
10 dist_author => 'Ken Y. Clark <kclark@cpan.org>',
11 dist_version_from => 'lib/SQL/Translator.pm',
12 license => 'gpl',
13 module_name => 'SQL::Translator',
14 sign => 1,
15 script_files => [
16 'bin/sqlt-diagram',
17 'bin/sqlt-diff',
18 'bin/sqlt-dumper',
19 'bin/sqlt-graph',
20 'bin/sqlt',
21 ],
22 requires => {
9371be50 23 'Class::Base' => 0,
24 'Class::Data::Inheritable' => 0.02,
c88b5f28 25 'Class::MakeMethods' => 0,
9371be50 26 'IO::Dir' => 0,
27 'Log::Log4perl' => 0,
28 'Template' => 2.10,
29 'Parse::RecDescent' => 1.94,
30 'Pod::Usage' => 0,
5e14531f 31 },
32 recommends => {
33 'GD' => 0,
34 'GraphViz' => 0,
35 'IO::File' => 0,
36 'IO::Scalar' => 0,
37 'Spreadsheet::ParseExcel' => 0.2602,
38 'Text::ParseWords' => 0,
39 'Text::RecordParser' => 0.02,
40 'XML::Writer' => 0.500,
41 'XML::XPath' => 1.13,
6f146640 42 'YAML' => 0.39,
5e14531f 43 },
44 build_requires => {
45 'File::Basename' => 0,
46 'File::Spec' => 0,
7f2b8f37 47 'Test::More' => 0.6,
5e14531f 48 'Test::Exception' => 0,
49 'Test::Differences' => 0,
50f63fb1 50 },
51
52 get_options => {
53 # Where to store additional files such as templates.
54 # TODO: Should be OS dependant. See Module::Build::os_type()
55 install_dir => { type=>'=s', default=>'/usr/local/share/sqlfairy' },
56 },
5e14531f 57);
50f63fb1 58
59my $install_dir = $builder->args('install_dir');
60print "SqlFairy needs to install some additional files such as templates.\n";
61$install_dir = $builder->prompt( "Where should they go?", $install_dir );
62print "\n";
63
64# Add the install (and template) dir to the config data. They will then be
65# available via the (Module::Build) generated SQL::Translator::ConfigData.
66# During build time they are availiable from $builder->config_data( NAME )
67my $template_dir = "$install_dir/template";
68$builder->config_data( install_dir => $install_dir );
69$builder->config_data( template_dir => $template_dir );
70
71# Add build element for templates, these are processed by
72# SQL::Translator::Module::Build::process_template_files
73$builder->add_build_element('template');
74$builder->install_path->{template} = $template_dir;
75
76
5e14531f 77$builder->create_build_script;
78print "Now run './Build', './Build test', and './Build install'\n";