Commit | Line | Data |
aff5e9c1 |
1 | my $test_ddl_fn = 't/lib/sqlite.sql'; |
c0329273 |
2 | my @test_ddl_cmd = qw( -I lib -Mt::lib::ANFANG -- maint/gen_sqlite_schema_files --schema-class DBICTest::Schema ); |
6635c6d2 |
3 | |
aff5e9c1 |
4 | my $example_ddl_fn = 'examples/Schema/db/example.sql'; |
5 | my $example_db_fn = 'examples/Schema/db/example.db'; |
6635c6d2 |
6 | my @example_ddl_cmd = qw( -I lib -I examples/Schema -- maint/gen_sqlite_schema_files --schema-class MyApp::Schema ); |
7 | my @example_pop_cmd = qw( -I lib -I examples/Schema -- examples/Schema/insertdb.pl ); |
a2c29633 |
8 | |
9 | # If the author doesn't have the prereqs, still generate a Makefile |
10 | # The EUMM build-stage generation will run unconditionally and |
11 | # errors will not be ignored unlike here |
12 | require DBIx::Class::Optional::Dependencies; |
13 | if ( DBIx::Class::Optional::Dependencies->req_ok_for ('deploy') ) { |
14 | print "Regenerating $test_ddl_fn\n"; |
15 | system( $^X, @test_ddl_cmd, '--ddl-out' => $test_ddl_fn ); |
16 | |
6635c6d2 |
17 | print "Regenerating $example_ddl_fn and $example_db_fn\n"; |
18 | system( $^X, @example_ddl_cmd, '--ddl-out' => $example_ddl_fn, '--deploy-to' => $example_db_fn ); |
19 | |
20 | print "Populating $example_db_fn\n"; |
21 | system( $^X, @example_pop_cmd ); |
22 | |
a2c29633 |
23 | # if we don't do it some git tools (e.g. gitk) get confused that the |
24 | # ddl file is modified, when it clearly isn't |
aff5e9c1 |
25 | require File::Spec; |
a2c29633 |
26 | system('git status --porcelain >' . File::Spec->devnull); |
27 | } |
28 | |
29 | postamble <<"EOP"; |
30 | |
31 | clonedir_generate_files : dbic_clonedir_regen_test_ddl |
32 | |
33 | dbic_clonedir_regen_test_ddl : |
34 | \t\$(ABSPERLRUN) @test_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($test_ddl_fn) ]} |
6635c6d2 |
35 | \t\$(ABSPERLRUN) @example_ddl_cmd --ddl-out @{[ $mm_proto->quote_literal($example_ddl_fn) ]} --deploy-to @{[ $mm_proto->quote_literal($example_db_fn) ]} |
36 | \t\$(ABSPERLRUN) @example_pop_cmd |
a2c29633 |
37 | EOP |
38 | |
39 | # keep the Makefile.PL eval happy |
40 | 1; |