Make pod generation more palatable to the existing toolchain
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 53_autogen_pod.pl
1 # leftovers in old checkouts
2 unlink 'lib/DBIx/Class/Optional/Dependencies.pod'
3   if -f 'lib/DBIx/Class/Optional/Dependencies.pod';
4
5 my $pod_dir = '.generated_pod';
6 my $ver = Meta->version;
7
8 # cleanup the generated pod dir (again - kill leftovers from old checkouts)
9 require File::Path;
10 require File::Glob;
11 File::Path::rmtree( File::Glob::bsd_glob("$pod_dir/*"), { verbose => 0 } );
12
13
14 # generate the OptDeps pod both in the clone-dir and during the makefile distdir
15 {
16   print "Regenerating Optional/Dependencies.pod\n";
17   require DBIx::Class::Optional::Dependencies;
18   DBIx::Class::Optional::Dependencies->_gen_pod ($ver, $pod_dir);
19
20   postamble <<"EOP";
21
22 clonedir_generate_files : dbic_clonedir_gen_optdeps_pod
23
24 dbic_clonedir_gen_optdeps_pod :
25 \t\$(ABSPERLRUN) -Ilib -MDBIx::Class::Optional::Dependencies -e "DBIx::Class::Optional::Dependencies->_gen_pod(qw($ver $pod_dir))"
26
27 EOP
28 }
29
30
31 # generate the inherit pods both in the clone-dir and during the makefile distdir
32 {
33   print "Regenerating project documentation to include inherited methods\n";
34
35   # if the author doesn't have them, don't fail the initial "perl Makefile.pl" step
36   do "maint/gen_pod_inherit" or print "\n!!! FAILED: $@\n";
37
38   postamble <<"EOP";
39
40 clonedir_generate_files : dbic_clonedir_gen_inherit_pods
41
42 dbic_clonedir_gen_inherit_pods :
43 \t\$(ABSPERLRUN) -Ilib maint/gen_pod_inherit
44
45 EOP
46 }
47
48
49 # copy the contents of .generated_pod over to lib/
50 # (yes, overwriting is fine, though nothing should reside there)
51 {
52   postamble <<"EOP";
53
54 clonedir_post_generate_files : dbic_clonedir_copy_generated_pod
55
56 dbic_clonedir_copy_generated_pod :
57 \t\$(RM_F) .generated_pod/.packlist
58 \t\$(ABSPERLRUN) -MExtUtils::Install -e 'install([ from_to => {qw(.generated_pod/DBIx lib/DBIx write .generated_pod/.packlist)}, verbose => 0, uninstall_shadows => 0, skip => [] ]);'
59
60 EOP
61 }
62
63
64 # everything that came from .generated_pod, needs to be removed from our lib/
65 {
66   postamble <<"EOP";
67
68 clonedir_cleanup_generated_files : dbic_clonedir_cleanup_generated_pod_copies
69
70 dbic_clonedir_cleanup_generated_pod_copies :
71 \t\$(ABSPERLRUN) -MExtUtils::Install -e 'uninstall(qw(.generated_pod/.packlist))'
72
73 EOP
74 }
75
76 # keep the Makefile.PL eval happy
77 1;