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 | } |
bac1b5d5 |
17 | foreach my $name ( qw( LONG_TESTS TEST_SQLITE ) ) { |
18 | $ENV{$name} = 1 if $self->notes( $name ); |
67e9b86f |
19 | } |
09e1cfab |
20 | |
21 | $self->SUPER::ACTION_test( @_ ); |
67e9b86f |
22 | } |
23 | SUBCLASS |
24 | |
25 | my $build = $class->new( |
ffed8b01 |
26 | module_name => 'DBM::Deep', |
27 | license => 'perl', |
28 | requires => { |
2120a181 |
29 | 'perl' => '5.006_000', |
a8fdabda |
30 | 'Fcntl' => '0.01', |
a8fdabda |
31 | 'Scalar::Util' => '1.14', |
e00d0eb3 |
32 | 'Digest::MD5' => '1.00', |
ffed8b01 |
33 | }, |
ffed8b01 |
34 | build_requires => { |
d0c365a5 |
35 | 'File::Path' => '0.01', |
36 | 'File::Temp' => '0.01', |
d245280e |
37 | 'Pod::Usage' => '1.3', |
0e3e3555 |
38 | 'Test::More' => '0.88', |
17ca2cc9 |
39 | 'Test::Deep' => '0.095', |
e9b0b5f0 |
40 | 'Test::Warn' => '0.08', |
ffed8b01 |
41 | 'Test::Exception' => '0.21', |
151e0077 |
42 | 'IO::Scalar' => '0.01', |
ffed8b01 |
43 | }, |
44 | create_makefile_pl => 'traditional', |
45 | add_to_cleanup => [ |
e00d0eb3 |
46 | 'META.yml', '*.bak', '*.gz', 'Makefile.PL', 'cover_db', |
ffed8b01 |
47 | ], |
2ec46b24 |
48 | test_files => 't/??_*.t', |
67e9b86f |
49 | auto_features => { |
bac1b5d5 |
50 | sqlite_engine => { |
51 | description => 'DBI support via SQLite', |
52 | requires => { |
53 | 'DBI' => '1.5', |
54 | 'DBD::SQLite' => '1.25', |
55 | }, |
56 | }, |
57 | mysql_engine => { |
58 | description => 'DBI support via MySQL', |
67e9b86f |
59 | requires => { |
60 | 'DBI' => '1.5', |
61 | 'DBD::mysql' => '4.001', |
62 | }, |
63 | }, |
64 | }, |
ffed8b01 |
65 | ); |
66 | |
67e9b86f |
67 | if ( $build->y_n( "Run the long-running tests", 'n' ) ) { |
68 | $build->notes( 'LONG_TESTS' => 1 ); |
69 | } |
70 | |
bac1b5d5 |
71 | if ( $build->features( 'sqlite_engine' ) ) { |
72 | if ( $build->y_n( "Run the tests against the DBI engine via SQLite?", 'n' ) ) { |
73 | $build->notes( 'TEST_SQLITE' => 1 ); |
74 | } |
75 | } |
76 | |
77 | if ( $build->features( 'mysql_engine' ) ) { |
78 | if ( $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) { |
67e9b86f |
79 | my ($dsn, $user, $pass) = ('') x 3; |
80 | $dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" ); |
81 | if ( $dsn ) { |
82 | $user = $build->prompt( "\tWhat is the username?" ); |
83 | if ( $user ) { |
84 | $pass = $build->prompt( "\tWhat is the password?" ); |
85 | } |
86 | } |
87 | |
88 | $build->notes( 'TEST_MYSQL_DSN' => $dsn ); |
89 | $build->notes( 'TEST_MYSQL_USER' => $user ); |
90 | $build->notes( 'TEST_MYSQL_PASS' => $pass ); |
91 | } |
92 | } |
93 | |
ffed8b01 |
94 | $build->create_build_script; |