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