Parent Directory
|
Revision Log
Revision 1638 -
(view)
(download)
Original Path: trunk/webwork-modperl/bin/mkhtmldocs
| 1 : | sh002i | 1638 | #!/usr/bin/env perl |
| 2 : | |||
| 3 : | ################################################################################ | ||
| 4 : | # WeBWorK mod_perl (c) 1995-2002 WeBWorK Team, Univeristy of Rochester | ||
| 5 : | # $Id: mkhtmldocs,v 1.1 2003-11-19 18:46:53 sh002i Exp $ | ||
| 6 : | ################################################################################ | ||
| 7 : | |||
| 8 : | =head1 NAME | ||
| 9 : | |||
| 10 : | mkhtmldocs - use pod2html to generate HTML documentation | ||
| 11 : | |||
| 12 : | =cut | ||
| 13 : | |||
| 14 : | use strict; | ||
| 15 : | use warnings; | ||
| 16 : | use FindBin; | ||
| 17 : | |||
| 18 : | # set this to the URL of the htdocs/doc directory. | ||
| 19 : | use constant DOC_BASE => "/webwork2_files/doc"; | ||
| 20 : | # FIXME: this should probably be read from global.conf. | ||
| 21 : | |||
| 22 : | sub main(@) { | ||
| 23 : | my $force = @_ && $_[0] eq "-f"; | ||
| 24 : | |||
| 25 : | my $lib = "$FindBin::Bin/../lib"; | ||
| 26 : | my $htdocs = "$FindBin::Bin/../htdocs"; | ||
| 27 : | my $doc = "$htdocs/doc"; | ||
| 28 : | my $htmlroot = DOC_BASE; | ||
| 29 : | |||
| 30 : | my @modules = `find $lib -name "*.pm"`; | ||
| 31 : | foreach my $module (@modules) { | ||
| 32 : | chomp $module; | ||
| 33 : | |||
| 34 : | my $docfile = $module; | ||
| 35 : | $docfile =~ s/^$lib/$doc/; | ||
| 36 : | $docfile =~ s/\.pm$/.html/; | ||
| 37 : | |||
| 38 : | next if not $force and -e $docfile and (stat $docfile)[9] >= (stat $module)[9]; | ||
| 39 : | |||
| 40 : | my ($docdir) = $docfile =~ m|^(.*)/|; | ||
| 41 : | unless (-e $docdir) { | ||
| 42 : | print "creating missing directory $docdir\n"; | ||
| 43 : | system "mkdir -p $docdir" | ||
| 44 : | and die "mkdir failed: $!\n"; | ||
| 45 : | } | ||
| 46 : | |||
| 47 : | print "generating documentation for module $module\n"; | ||
| 48 : | system "pod2html --htmlroot=$htmlroot --podroot=$lib --infile=$module --outfile=$docfile" | ||
| 49 : | and die "pod2html failed: $!\n"; | ||
| 50 : | } | ||
| 51 : | } | ||
| 52 : | |||
| 53 : | main(@ARGV); |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |