Merged with master and am ready to merge back
[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',
e199fec0 46 'Test::More' => '0.88', # done_testing
ffed8b01 47 'Test::Exception' => '0.21',
151e0077 48 'IO::Scalar' => '0.01',
ffed8b01 49 },
50 create_makefile_pl => 'traditional',
51 add_to_cleanup => [
e00d0eb3 52 'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db',
ffed8b01 53 ],
2ec46b24 54 test_files => 't/??_*.t',
67e9b86f 55 auto_features => {
bac1b5d5 56 sqlite_engine => {
57 description => 'DBI support via SQLite',
58 requires => {
59 'DBI' => '1.5',
60 'DBD::SQLite' => '1.25',
61 },
62 },
63 mysql_engine => {
64 description => 'DBI support via MySQL',
67e9b86f 65 requires => {
66 'DBI' => '1.5',
67 'DBD::mysql' => '4.001',
68 },
69 },
70 },
ffed8b01 71);
72
67e9b86f 73if ( $build->y_n( "Run the long-running tests", 'n' ) ) {
74 $build->notes( 'LONG_TESTS' => 1 );
75}
76
bac1b5d5 77if ( $build->features( 'sqlite_engine' ) ) {
78 if ( $build->y_n( "Run the tests against the DBI engine via SQLite?", 'n' ) ) {
79 $build->notes( 'TEST_SQLITE' => 1 );
80 }
81}
82
83if ( $build->features( 'mysql_engine' ) ) {
84 if ( $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) {
67e9b86f 85 my ($dsn, $user, $pass) = ('') x 3;
86 $dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" );
87 if ( $dsn ) {
88 $user = $build->prompt( "\tWhat is the username?" );
89 if ( $user ) {
90 $pass = $build->prompt( "\tWhat is the password?" );
91 }
92 }
93
94 $build->notes( 'TEST_MYSQL_DSN' => $dsn );
95 $build->notes( 'TEST_MYSQL_USER' => $user );
96 $build->notes( 'TEST_MYSQL_PASS' => $pass );
97 }
98}
99
ffed8b01 100$build->create_build_script;