buildmod generates documentation now.

This commit is contained in:
Elijah Perrault committed 2011-02-16 20:33:07 -07:00
1 parent 8077acd9ae
commit 7108f3fdfa
2 files changed
+42 -1

No files matched your search

+40 -1
View File
@@ -8,6 +8,8 @@ use strict;
use warnings;
use English qw(-no_match_vars);
use FindBin qw($Bin);
use Pod::Html;
use Pod::Man;
our $Bin = $Bin;
our $VERSION = 1.00;
@@ -103,12 +105,49 @@ foreach (@pars) {
print 'Checking Perl version..... '.$PERL_VERSION.' - ';
if ($] < $val) { $die = 1; }
say (($die) ? 'Not OK' : 'OK');
print $RS;
if ($die) { say 'Failed to build '.$module.'.'; exit; }
}
}
}
# Generate documentation.
my $got_end = 0;
open my $FMPH, '<', $modulep;
my @MPBUF = <$FMPH>;
close $FMPH;
say 'Generating documentation.....';
my $podbuf;
foreach my $line (@MPBUF) {
if (!defined $line) { $line = ' '; }
$line =~ s/(\r|\n)//g;
if ($line eq '__END__') {
$got_end = 1;
}
if ($got_end and $line ne '__END__') {
$podbuf .= $line."\n";
}
}
# Create the autodoc/ dir if it doesn't exist.
if (!-d "$Bin/../autodoc") {
mkdir "$Bin/../autodoc";
}
# Save to POD file in autodoc/
open my $FMPNH, '>', "$Bin/../autodoc/$module.pod";
print {$FMPNH} $podbuf;
close $FMPNH;
# Create HTML.
pod2html("--infile=$Bin/../autodoc/$module.pod", "--outfile=$Bin/../autodoc/$module.html");
# Create *roff.
my $manifier = Pod::Man->new();
$manifier->parse_from_file("$Bin/../autodoc/$module.pod", "$Bin/../autodoc/$module.1");
print $RS;
say 'Done.';
# vim: set ai sw=4 ts=4:
+2
View File
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
3.0 Indev
===============================================================================
* bin/buildmod now retrieves the POD from modules and creates man(1) page
plus HTML file.
* cjoin() now supports a channel key as the last argument.
* Added a ChanTopics module for advanced management of channel topics.
* bantype is now a required configuration value.