Commit | Line | Data |
95252a8c |
1 | use File::Path(); |
2 | use File::Glob(); |
3 | |
a14c7707 |
4 | # leftovers in old checkouts |
5 | unlink 'lib/DBIx/Class/Optional/Dependencies.pod' |
6 | if -f 'lib/DBIx/Class/Optional/Dependencies.pod'; |
95252a8c |
7 | File::Path::rmtree( File::Glob::bsd_glob('.generated_pod'), { verbose => 0 } ) |
8 | if -d '.generated_pod'; |
a14c7707 |
9 | |
95252a8c |
10 | my $pod_dir = 'maint/.Generated_Pod'; |
a14c7707 |
11 | my $ver = Meta->version; |
12 | |
13 | # cleanup the generated pod dir (again - kill leftovers from old checkouts) |
95252a8c |
14 | if (-d $pod_dir) { |
15 | File::Path::rmtree( File::Glob::bsd_glob("$pod_dir/*"), { verbose => 0 } ); |
16 | } |
17 | else { |
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; |
3e2a5d5d |
25 | DBIx::Class::Optional::Dependencies->_gen_pod ($ver, "$pod_dir/lib"); |
a14c7707 |
26 | |
27 | postamble <<"EOP"; |
28 | |
a0c96f24 |
29 | clonedir_generate_files : dbic_clonedir_gen_optdeps_pod |
a14c7707 |
30 | |
31 | dbic_clonedir_gen_optdeps_pod : |
3ba58fe4 |
32 | \t@{[ |
3e2a5d5d |
33 | $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->_gen_pod(q($ver), q($pod_dir/lib))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/]) |
3ba58fe4 |
34 | ]} |
a14c7707 |
35 | |
36 | EOP |
37 | } |
38 | |
a0c96f24 |
39 | |
e2633789 |
40 | # generate the script/dbicadmin pod |
41 | { |
42 | print "Regenerating script/dbicadmin.pod\n"; |
43 | |
44 | # generating it in the root of $pod_dir |
45 | # it will *not* be copied over due to not being listed at the top |
46 | # of MANIFEST.SKIP - this is a *good* thing |
47 | # we only want to ship a script/dbicadmin, with the POD appended |
48 | # (see inject_dbicadmin_pod.pl), but still want to spellcheck and |
49 | # whatnot the intermediate step |
50 | my $pod_fn = "$pod_dir/dbicadmin.pod"; |
51 | |
52 | # if the author doesn't have the prereqs, don't fail the initial "perl Makefile.pl" step |
53 | # therefore no error checking |
54 | system($^X, qw( -Ilib -- script/dbicadmin --documentation-as-pod ), $pod_fn); |
55 | |
56 | postamble <<"EOP"; |
57 | |
58 | clonedir_generate_files : dbic_clonedir_gen_dbicadmin_pod |
59 | |
60 | dbic_clonedir_gen_dbicadmin_pod : |
61 | \t\$(ABSPERLRUN) -Ilib -- script/dbicadmin --documentation-as-pod @{[ $mm_proto->quote_literal($pod_fn) ]} |
62 | |
63 | EOP |
64 | } |
65 | |
66 | |
a14c7707 |
67 | # generate the inherit pods both in the clone-dir and during the makefile distdir |
68 | { |
69 | print "Regenerating project documentation to include inherited methods\n"; |
70 | |
e2633789 |
71 | # if the author doesn't have the prereqs, don't fail the initial "perl Makefile.pl" step |
a14c7707 |
72 | do "maint/gen_pod_inherit" or print "\n!!! FAILED: $@\n"; |
73 | |
74 | postamble <<"EOP"; |
75 | |
a0c96f24 |
76 | clonedir_generate_files : dbic_clonedir_gen_inherit_pods |
a14c7707 |
77 | |
78 | dbic_clonedir_gen_inherit_pods : |
a0c96f24 |
79 | \t\$(ABSPERLRUN) -Ilib maint/gen_pod_inherit |
80 | |
81 | EOP |
82 | } |
83 | |
84 | |
204f57da |
85 | # on some OSes generated files may have an incorrect \n - fix it |
86 | # so that the xt tests pass on a fresh checkout (also shipping a |
87 | # dist with CRLFs is beyond obnoxious) |
88 | # |
89 | # Ironically EUMM's dos2unix is broken on win32 itself - it does |
90 | # not take into account the CRLF layer present on win32 |
91 | # do the ENV trick again |
92 | if ($^O eq 'MSWin32' or $^O eq 'cygwin') { |
93 | |
94 | { |
95 | local $ENV{PERLIO} = 'unix'; |
96 | system( $^X, qw( -MExtUtils::Command -e dos2unix -- ), $pod_dir ); |
97 | } |
98 | |
99 | postamble <<"EOP"; |
100 | |
101 | test_xt : dbic_fixup_generated_pod |
102 | |
103 | dbic_fixup_generated_pod : |
104 | \t@{[ $mm_proto->oneliner( qq(\$\$ENV{PERLIO}='unix' and system( \$\$^X, qw( -MExtUtils::Command -e dos2unix -- ), q($pod_dir) ) ) ) ]} |
105 | |
106 | EOP |
107 | } |
108 | |
109 | |
3e2a5d5d |
110 | # copy the contents of $pod_dir over to the workdir |
a0c96f24 |
111 | # (yes, overwriting is fine, though nothing should reside there) |
112 | { |
113 | postamble <<"EOP"; |
114 | |
115 | clonedir_post_generate_files : dbic_clonedir_copy_generated_pod |
116 | |
117 | dbic_clonedir_copy_generated_pod : |
95252a8c |
118 | \t\$(RM_F) $pod_dir.packlist |
3ba58fe4 |
119 | \t@{[ |
3e2a5d5d |
120 | $mm_proto->oneliner("install([ from_to => {q($pod_dir) => File::Spec->curdir(), write => q($pod_dir.packlist)}, verbose => 0, uninstall_shadows => 0, skip => [] ])", ['-MExtUtils::Install']) |
3ba58fe4 |
121 | ]} |
a0c96f24 |
122 | EOP |
123 | } |
124 | |
125 | |
3e2a5d5d |
126 | # everything that came from $pod_dir, needs to be removed from the workdir |
a0c96f24 |
127 | { |
128 | postamble <<"EOP"; |
129 | |
130 | clonedir_cleanup_generated_files : dbic_clonedir_cleanup_generated_pod_copies |
131 | |
132 | dbic_clonedir_cleanup_generated_pod_copies : |
3ba58fe4 |
133 | \t@{[ |
134 | $mm_proto->oneliner("uninstall(q($pod_dir.packlist))", ['-MExtUtils::Install']) |
135 | ]} |
a14c7707 |
136 | |
137 | EOP |
138 | } |
139 | |
140 | # keep the Makefile.PL eval happy |
141 | 1; |