]> git.imager.perl.org - bse.git/blame - site/docs/makedocs
0.15_27 commit
[bse.git] / site / docs / makedocs
CommitLineData
41b9d8ec
TC
1#!perl -w
2# Build HTML files from .pod and .pm files
3# I'd love to do this as a makefile, but the targets have colons, which
4# make hates (GNU make, anyway)
5use strict;
6
7my @targets =
8 (
de193691 9 'access.html',
41b9d8ec
TC
10 'bse.html',
11 'bugs.html',
12 'templates.html',
13 'Generate.html',
14 'Generate::Article.html',
15 'Generate::Product.html',
16 'Generate::Catalog.html',
17 'search.html',
18 'shop.html',
19 'add.html',
20 'shopadmin.html',
b10912b4 21 'TODO.html',
edc5d096 22 'config.html',
6e3d2da5
TC
23 'secure.html',
24 'gen.html',
25 'upgrade_mysql.html',
26 'makedocs.html',
64fa5b18 27 'standard.html',
4175638b
TC
28 'affiliate.html',
29 'BSE::UI::Affiliate.html',
d7538448 30 'future_plans.html',
ab2cd916 31 'thumbnails.html',
a5e3fc4b 32 'formmail.html',
41b9d8ec
TC
33 );
34
35my @exts = qw(.pod .pm .pl);
6e3d2da5 36push(@exts, ''); # I should have put a .pl on makedocs
41b9d8ec
TC
37
38my @search =
39 (
fa304705 40 './',
41b9d8ec
TC
41 '../cgi-bin/',
42 '../cgi-bin/modules/',
43 '../cgi-bin/admin/',
6e3d2da5 44 '../util/',
41b9d8ec
TC
45 );
46
47use Getopt::Std;
48my %opts;
49getopts("hn", \%opts);
50$opts{h} and usage();
51++$|;
52for my $target (@targets) {
53 # try to find the source
54 my $base = $target;
55 $base =~ s!::!/!g;
56 my $source;
57 SEARCH: for my $ext (@exts) {
58 (my $file = $base) =~ s/\.html$/$ext/;
59 for my $dir (@search) {
60 if (-e $dir.$file) {
61 $source = $dir.$file;
62 last SEARCH;
63 }
64 }
65 }
66 $source or die "Cannot find source for $target\n";
67 if (!-e $target || -M $target > -M $source) {
68 my $cmd = "pod2html --infile=$source --outfile=$target --htmlroot=.";
fa304705 69 $cmd .= " --podpath=".join(":", @search);
41b9d8ec
TC
70 print $cmd,"\n";
71 if (!$opts{n} and system $cmd) {
72 die "** makedocs failed\n";
73 }
74 }
75}
76
77# remove the pod2html caches - I don't care much if this fails
78unlink 'pod2html-dircache', 'pod2html-itemcache';
79
80sub usage {
81 print <<EOS;
82Usage: $0 - make the documentation files
83 $0 -n - report what would be done to make the documentation files
84 $0 -h - produce this message
85EOS
86 exit;
87}
6e3d2da5
TC
88
89__END__
90
91=head1 NAME
92
93makedocs - produces HTML documentation from POD for BSE
94
95=head1 SYNOPSIS
96
97 perl makedocs [-nh]
98
99=head1 DESCRIPTION
100
101Used during the BSE distribution build process to product HTML
102versions of the POD documentation included with various parts of BSE.
103
104Searches in various standard places for source pod/pl/pm files and
105converts them into HTML.
106
107=head1 OPTIONS
108
109C<makedocs> is typically run without options.
110
111=over
112
113=item -n
114
115Report the actions that would be taken without actually performing the
116conversions.
117
118=item -h
119
120Produces a brief usage message.
121
122=back
123
124=head1 BUGS
125
126We're keeping a dependency list in this file, it should be elsewhere,
127maybe we could parse MANIFEST.
128
129=head1 AUTHOR
130
131Tony Cook <tony@develop-help.com>
132
133=head1 REVISION
134
135$Revision$
136
137=head1 SEE ALSO
138
139bse
140
141=cut
142