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