Getting everything ready for release of 1.0019_001
[dbsrgits/DBM-Deep.git] / Build.PL
1 use Module::Build;
2
3 use strict;
4 use warnings FATAL => 'all';
5
6 my $class = Module::Build->subclass(
7     class => "Module::Build::Custom",
8     code => <<'SUBCLASS' );
9
10 sub ACTION_test {
11     my $self = shift;
12     if ( $self->notes('TEST_MYSQL_DSN') ) {
13         $ENV{$_} = $self->notes($_) for qw(
14             TEST_MYSQL_DSN TEST_MYSQL_USER TEST_MYSQL_PASS
15         );
16     }
17     if ( $self->notes( 'LONG_TESTS' ) ) {
18         $ENV{LONG_TESTS} = 1;
19     }
20     $self->SUPER::ACTION_test;
21 }
22 SUBCLASS
23
24 my $build = $class->new(
25     module_name => 'DBM::Deep',
26     license => 'perl',
27     requires => {
28         'perl'              => '5.006_000',
29         'Fcntl'             => '0.01',
30         'Scalar::Util'      => '1.14',
31         'Digest::MD5'       => '1.00',
32     },
33     build_requires => {
34         'File::Path'      => '0.01',
35         'File::Temp'      => '0.01',
36         'Pod::Usage'      => '1.3',
37         'Test::More'      => '0.88',
38         'Test::Deep'      => '0.095',
39         'Test::Warn'      => '0.08',
40         'Test::Exception' => '0.21',
41         'IO::Scalar'      => '0.01',
42     },
43     create_makefile_pl => 'traditional',
44     add_to_cleanup => [
45         'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db',
46     ],
47     test_files => 't/??_*.t',
48     auto_features => {
49         dbi_engine => {
50             description => 'DBI support (mysql only so far)',
51             requires => {
52                 'DBI'        => '1.5',
53                 'DBD::mysql' => '4.001',
54             },
55         },
56     },
57 );
58
59 if ( $build->y_n( "Run the long-running tests", 'n' ) ) {
60     $build->notes( 'LONG_TESTS' => 1 );
61 }
62
63 if ( $build->features( 'dbi_engine' ) ) {
64     if ( $build->y_n( "Run the tests against the DBI engine (for MySQL only)?", 'n' ) ) {
65         my ($dsn, $user, $pass) = ('') x 3;
66         $dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" );
67         if ( $dsn ) {
68             $user = $build->prompt( "\tWhat is the username?" );
69             if ( $user ) {
70                 $pass = $build->prompt( "\tWhat is the password?" );
71             }
72         }
73
74         $build->notes( 'TEST_MYSQL_DSN'  => $dsn );
75         $build->notes( 'TEST_MYSQL_USER' => $user );
76         $build->notes( 'TEST_MYSQL_PASS' => $pass );
77     }
78 }
79
80 $build->create_build_script;