Commit | Line | Data |
ffed8b01 |
1 | use Module::Build; |
2 | |
3 | use strict; |
67e9b86f |
4 | use warnings FATAL => 'all'; |
ffed8b01 |
5 | |
67e9b86f |
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( |
ffed8b01 |
25 | module_name => 'DBM::Deep', |
26 | license => 'perl', |
27 | requires => { |
2120a181 |
28 | 'perl' => '5.006_000', |
a8fdabda |
29 | 'Fcntl' => '0.01', |
a8fdabda |
30 | 'Scalar::Util' => '1.14', |
e00d0eb3 |
31 | 'Digest::MD5' => '1.00', |
ffed8b01 |
32 | }, |
ffed8b01 |
33 | build_requires => { |
d0c365a5 |
34 | 'File::Path' => '0.01', |
35 | 'File::Temp' => '0.01', |
d245280e |
36 | 'Pod::Usage' => '1.3', |
0e3e3555 |
37 | 'Test::More' => '0.88', |
17ca2cc9 |
38 | 'Test::Deep' => '0.095', |
e9b0b5f0 |
39 | 'Test::Warn' => '0.08', |
ffed8b01 |
40 | 'Test::Exception' => '0.21', |
151e0077 |
41 | 'IO::Scalar' => '0.01', |
ffed8b01 |
42 | }, |
43 | create_makefile_pl => 'traditional', |
44 | add_to_cleanup => [ |
e00d0eb3 |
45 | 'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db', |
ffed8b01 |
46 | ], |
2ec46b24 |
47 | test_files => 't/??_*.t', |
67e9b86f |
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 | }, |
ffed8b01 |
57 | ); |
58 | |
67e9b86f |
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 | |
ffed8b01 |
80 | $build->create_build_script; |