Had to turn off caching, but I've merged everything from SPROUT's fixes
[dbsrgits/DBM-Deep.git] / Build.PL
CommitLineData
2ba14e04 1use Module::Build 0.28; # for prepare_metadata
ffed8b01 2
3use strict;
67e9b86f 4use warnings FATAL => 'all';
ffed8b01 5
8385c429 6my $build = Module::Build->subclass(
67e9b86f 7 class => "Module::Build::Custom",
8385c429 8 code => '
9 sub prepare_metadata {
10 my $node = shift->SUPER::prepare_metadata(@_);
11 my $ver = $node->{version};
12 $_->{version} = $ver for values %{$node->{provides}};
13 $node;
14 }
67e9b86f 15
8385c429 16 sub ACTION_test {
17 my $self = shift;
e73f12ce 18 if ( $self->notes(\'TEST_MYSQL_DSN\') ) {
8385c429 19 $ENV{$_} = $self->notes($_) for qw(
20 TEST_MYSQL_DSN TEST_MYSQL_USER TEST_MYSQL_PASS
21 );
22 }
23 foreach my $name ( qw( LONG_TESTS TEST_SQLITE ) ) {
24 $ENV{$name} = 1 if $self->notes( $name );
25 }
09e1cfab 26
8385c429 27 $self->SUPER::ACTION_test( @_ );
28 }
29 ',
30)->new(
ffed8b01 31 module_name => 'DBM::Deep',
32 license => 'perl',
33 requires => {
2120a181 34 'perl' => '5.006_000',
a8fdabda 35 'Fcntl' => '0.01',
a8fdabda 36 'Scalar::Util' => '1.14',
e00d0eb3 37 'Digest::MD5' => '1.00',
ffed8b01 38 },
ffed8b01 39 build_requires => {
d0c365a5 40 'File::Path' => '0.01',
41 'File::Temp' => '0.01',
d245280e 42 'Pod::Usage' => '1.3',
0e3e3555 43 'Test::More' => '0.88',
17ca2cc9 44 'Test::Deep' => '0.095',
e9b0b5f0 45 'Test::Warn' => '0.08',
ffed8b01 46 'Test::Exception' => '0.21',
151e0077 47 'IO::Scalar' => '0.01',
ffed8b01 48 },
49 create_makefile_pl => 'traditional',
50 add_to_cleanup => [
e00d0eb3 51 'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db',
ffed8b01 52 ],
2ec46b24 53 test_files => 't/??_*.t',
67e9b86f 54 auto_features => {
bac1b5d5 55 sqlite_engine => {
56 description => 'DBI support via SQLite',
57 requires => {
58 'DBI' => '1.5',
59 'DBD::SQLite' => '1.25',
60 },
61 },
62 mysql_engine => {
63 description => 'DBI support via MySQL',
67e9b86f 64 requires => {
65 'DBI' => '1.5',
66 'DBD::mysql' => '4.001',
67 },
68 },
69 },
ffed8b01 70);
71
67e9b86f 72if ( $build->y_n( "Run the long-running tests", 'n' ) ) {
73 $build->notes( 'LONG_TESTS' => 1 );
74}
75
bac1b5d5 76if ( $build->features( 'sqlite_engine' ) ) {
77 if ( $build->y_n( "Run the tests against the DBI engine via SQLite?", 'n' ) ) {
78 $build->notes( 'TEST_SQLITE' => 1 );
79 }
80}
81
82if ( $build->features( 'mysql_engine' ) ) {
83 if ( $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) {
67e9b86f 84 my ($dsn, $user, $pass) = ('') x 3;
85 $dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" );
86 if ( $dsn ) {
87 $user = $build->prompt( "\tWhat is the username?" );
88 if ( $user ) {
89 $pass = $build->prompt( "\tWhat is the password?" );
90 }
91 }
92
93 $build->notes( 'TEST_MYSQL_DSN' => $dsn );
94 $build->notes( 'TEST_MYSQL_USER' => $user );
95 $build->notes( 'TEST_MYSQL_PASS' => $pass );
96 }
97}
98
ffed8b01 99$build->create_build_script;