[MOBY-guts] biomoby commit
Eddie Kawas
kawas at dev.open-bio.org
Thu Feb 21 20:15:49 UTC 2008
kawas
Thu Feb 21 15:15:49 EST 2008
Update of /home/repository/moby/moby-live/Perl
In directory dev.open-bio.org:/tmp/cvs-serv27557/Perl
Modified Files:
create_doc.pl
Log Message:
Created a template index file for the documentation. updated the create_doc script to use it.
moby-live/Perl create_doc.pl,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/create_doc.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/create_doc.pl 2008/02/21 16:02:39 1.1
+++ /home/repository/moby/moby-live/Perl/create_doc.pl 2008/02/21 20:15:49 1.2
@@ -1,53 +1,80 @@
-#! perl -w
+#!/usr/bin/perl -w
###########################################################
-# Just a quick and dirty utility to search for POD that
-# hasn't been converted to HTML by an install or was simply
-# unzipped or copied into the site or lib subdirectories.
-# Checks to see if an existing .html version of the POD
-# exists, if not converts it to HTML. After conversion the
-# AS Docs TOC is rebuilt so that all newly added docs are listed.
-
+# a script for creating HTML documentation for the MOBY
+# codebase
+###########################################################
use strict;
use Pod::Html;
use Pod::Find qw(pod_find);
use File::Path;
+use Pod::Checker;
use Cwd;
+use Template;
+
+my $lib_dir = "MOBY-Server/lib";
+
+# base directory
+my $infile_path_root = getcwd();
+
+# where html files will be stored
+my $outfile_path_root = "$infile_path_root/html";
-my $cwd = getcwd();
-my $infile_path_root = "$cwd";
-my $outfile_path_root = "$cwd/html";
-my $logfile = "$cwd/allpod.txt";
+# where to store the log file
+my $logfile = "$infile_path_root/allpod.txt";
-open LOGFILE, ">>$logfile" || die "couldn't open LOGFILE $logfile\n";
+# list of files created ...
+my @html_files = ();
+
+open LOGFILE, ">$logfile" || die "couldn't open LOGFILE $logfile\n";
&search_for_pod;
+
+# create the index file
+my $vars = { 'worklist' => \@html_files, };
+
+my $template = Template->new( {} );
+
+my $out = "";
+$template->process( "templates/index.tt", $vars, \$out )
+ or print LOGFILE "error creating index file: " . $template->error() . "\n";
+open INDEX_OUT, ">$outfile_path_root/$lib_dir/index.html"
+ || print LOGFILE
+ "couldn't open INDEX_OUT $outfile_path_root/$lib_dir/index.html\n";
+print INDEX_OUT $out;
+close INDEX_OUT;
print LOGFILE "-" x 60, "\n";
close LOGFILE;
sub search_for_pod {
- my %pods = pod_find({ -verbose => 0, -inc => 1 }, ("$infile_path_root/MOBY-Server/lib/"));
- foreach(sort keys %pods) {
- convert_pod($_);
- }
+ my %pods = pod_find( { -verbose => 0 }, ("$infile_path_root/$lib_dir/") );
+ foreach ( sort keys %pods ) {
+ my $checker = new Pod::Checker;
+ $checker->parse_from_file( $_, \*LOGFILE );
+ convert_pod($_);
+ }
}
sub convert_pod {
- my $podfile = shift;
- $podfile =~ s#\\#/#g;
- if ($podfile =~ m!$infile_path_root/(.*)/(\w+)\.p.+$!i) {
- my $path = $1;
- my $name = $2;
- if (! -e "$outfile_path_root/$path/$name\.html") {
- mkpath("$outfile_path_root/$path");
- pod2html( "--infile=$podfile",
- "--outfile=$outfile_path_root/$path/$name.html",
- "--podroot=$infile_path_root",
- "--css=http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/images/perlstyle.css",
- "--recurse",
- "--backlink=Back to Top",
- "--index",
- );
- print LOGFILE "-- Created $outfile_path_root/$path/$name.html\n";
- }
- }
-}
\ No newline at end of file
+ my $podfile = shift;
+ $podfile =~ s#\\#/#g;
+ if ( $podfile =~ m!$infile_path_root/(.*)/(\w+)\.p.+$!i ) {
+ my $path = $1;
+ my $name = $2;
+ if ( !-e "$outfile_path_root/$path/$name\.html" ) {
+ mkpath("$outfile_path_root/$path");
+ pod2html(
+ "--infile=$podfile",
+ "--outfile=$outfile_path_root/$path/$name.html",
+ "--podroot=$infile_path_root",
+"--css=http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/images/perlstyle.css",
+ "--recurse",
+ "--backlink=Back to Top",
+ "--noindex",
+ "--title=$name",
+ );
+ my $str = substr( "$path/$name", length("$lib_dir/") );
+ push @html_files, $str;
+ print LOGFILE "-- Created $outfile_path_root/$path/$name.html\n";
+ }
+ }
+}
More information about the MOBY-guts
mailing list