[freeside-commits] branch FREESIDE_3_BRANCH updated. 248193c5c6b995bdbd4657fbbd005d88d0b03c6d

Mitch Jackson mitch at freeside.biz
Thu Feb 7 17:49:23 PST 2019


The branch, FREESIDE_3_BRANCH has been updated
       via  248193c5c6b995bdbd4657fbbd005d88d0b03c6d (commit)
       via  92f3856f3948a2b5b0c0646cc957e8042818e71a (commit)
       via  c17f168218bcddfac35f172a9ac12a7df56560ce (commit)
      from  318824bc9f4615ef9320e436604da63e33f900d4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 248193c5c6b995bdbd4657fbbd005d88d0b03c6d
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Thu Feb 7 20:45:43 2019 -0500

    RT# 81961 Pod to HTML from Makefile

diff --git a/Makefile b/Makefile
index 8c5e0b559..1447fc0fe 100644
--- a/Makefile
+++ b/Makefile
@@ -332,7 +332,7 @@ install-chown:
 install-pod2html:
 	echo "${POD2HTML_DIR}"
 	mkdir -p "${POD2HTML_DIR}"
-	perl bin/pod2html.pl "${POD2HTML_DIR}"
+	perl -MFS::Misc::Pod2Html -e "FS::Misc::Pod2Html::fs_pod2html('${POD2HTML_DIR}');"
 	chown freeside:freeside -R "${POD2HTML_DIR}"
 
 install: install-perl-modules install-docs install-init install-apache install-rt install-torrus install-texmf install-chown install-pod2html

commit 92f3856f3948a2b5b0c0646cc957e8042818e71a
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Wed Feb 6 17:51:30 2019 -0500

    RT# 81961 Generate HTML from POD during debian package install

diff --git a/debian/freeside-lib.postinst b/debian/freeside-lib.postinst
index 870ad315f..0692f8910 100644
--- a/debian/freeside-lib.postinst
+++ b/debian/freeside-lib.postinst
@@ -1,4 +1,21 @@
 #!/bin/sh
 
+# Rebuild ls-R filename databases used by TeX
 texhash /usr/local/share/texmf
 
+# Generate HTML documentation from perl POD
+if [ -z "$APACHE_VERSION" ]; then
+  export APACHE_VERSION=`/usr/sbin/apache2 -v | grep -q '\/2\.4\.' && echo '2.4' || echo '2'`
+fi
+
+if [ -z "$APACHE_DOCUMENT_ROOT" ]; then
+  export APACHE_DOCUMENT_ROOT=`[ ${APACHE_VERSION} = '2.4' ] && echo '/var/www/html' || echo '/var/www'`
+fi
+
+export POD2HTML_DOCUMENT_ROOT="${APACHE_DOCUMENT_ROOT}/freeside/docs/library"
+
+mkdir -p "$POD2HTML_DOCUMENT_ROOT"
+perl -MFS::Misc::Pod2Html -e "FS::Misc::Pod2Html::fs_pod2html('$POD2HTML_DOCUMENT_ROOT');"
+chown -R freeside "$POD2HTML_DOCUMENT_ROOT"
+
+exit 0

commit c17f168218bcddfac35f172a9ac12a7df56560ce
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sun Feb 3 22:33:37 2019 -0500

    RT# 81961 Move POD to HTML code into FS::Misc::Pod2Html module

diff --git a/FS/FS/Misc/Pod2Html.pm b/FS/FS/Misc/Pod2Html.pm
new file mode 100644
index 000000000..08358aa77
--- /dev/null
+++ b/FS/FS/Misc/Pod2Html.pm
@@ -0,0 +1,132 @@
+package FS::Misc::Pod2Html;
+use strict;
+use warnings;
+use Carp qw( croak );
+use Pod::Simple::HTML;
+use Pod::Simple::HTMLBatch;
+use Pod::Simple::Search;
+
+use base 'Exporter';
+our @EXPORT_OK = qw(
+  fs_pod2html
+  $include_system_perl_modules
+  $quiet_mode
+);
+
+our $include_system_perl_modules = 1;
+our $quiet_mode = 0;
+
+=head1 NAME
+
+FS::Misc::Pod2Html
+
+=head1 DESCRIPTION
+
+Generate HTML from POD Documentation
+
+=head1 SYNOPSIS
+
+Usage:
+
+  use FS::Misc::Pod2Html 'fs_pod2html';
+  fs_pod2html( '/output/directory' );
+
+=head2 fs_pod2html /output/directory/
+
+Generates Freeside-themed HTML docuemtnation from installed perl modules
+
+=cut
+
+our $html_before_title = q{
+  <% include( '/elements/header.html', 'Developer Documentation' ) %>
+  <& /elements/menubar.html,
+    'Freeside Perl Modules' => $fsurl.'docs/library/FS.html',
+    'Complete Index' => $fsurl.'docs/library/index.html',
+  &>
+
+  <div style="width: 90%; margin: 1em auto; font-size: .9em; border: solid 1px #666; background-color: #eee; padding: 1em;">
+  <h1 style="margin: .5em; border-bottom: solid 1px #999;">
+};
+
+our $html_after_title = q{</h1>};
+
+our $html_footer = q{</div><% include ('/elements/footer.html' ) %>};
+
+sub fs_pod2html {
+  my $html_dir = shift
+    or croak 'Please specify an output directory';
+
+  croak "Directory $html_dir: No write access"
+    unless -w $html_dir;
+
+  my @search_dirs = (
+    '/usr/local/share/perl/5.24.1',
+    '/usr/local/bin',
+    $include_system_perl_modules ? (
+      '/usr/share/perl5',
+      '/usr/share/perl/5.24',
+      '/usr/share/perl/5.24.1',
+    ) : (),
+  );
+
+  my $parser = Pod::Simple::HTMLBatch->new;
+
+  $parser->verbose(0)
+    if $quiet_mode;
+
+  $parser->search_class('Inline::Pod::Simple::Search');
+  $parser->html_render_class('Inline::Pod::Simple::HTML');
+  $parser->contents_page_start(
+    "$html_before_title Freeside Documentation Index $html_after_title"
+  );
+  $parser->contents_page_end( $html_footer );
+
+  $parser->batch_convert( \@search_dirs, $html_dir );
+}
+
+1;
+
+=head1 NAME
+
+Inline::Pod::Simple::Search
+
+=head2 DESCRIPTION
+
+Subclass of Pod::Simple::Search
+
+Enable searching for POD in all files instead of just .pl and .pm
+
+=cut
+
+package Inline::Pod::Simple::Search;
+use base 'Pod::Simple::Search';
+
+sub new {
+  my $class = shift;
+  my $self = Pod::Simple::Search->new( @_ );
+  $self->laborious(1);
+  $self;
+}
+1;
+
+=head1 NAME
+
+Inline::Pod::Simple::HTML
+
+=head2 DESCRIPTION
+
+Subclass of Pod::Simple::HTML
+
+Customize parsed HTML output
+
+=cut
+
+# Subclass Pod::Simple::HTML to control HTML output
+package Inline::Pod::Simple::HTML;
+use base 'Pod::Simple::HTML';
+
+sub html_header_before_title { $html_before_title }
+sub html_header_after_title { $html_after_title }
+sub html_footer { $html_footer }
+
+1;
diff --git a/FS/bin/freeside-pod2html b/FS/bin/freeside-pod2html
new file mode 100755
index 000000000..991b9fee8
--- /dev/null
+++ b/FS/bin/freeside-pod2html
@@ -0,0 +1,47 @@
+#!/usr/bin/env perl
+
+=head1 NAME
+
+pod2html.pl
+
+=head1 DESCRIPTION
+
+Generate HTML from POD documentation
+
+=head1 SEE ALSO
+
+L<FS::Misc::Pod2Html>
+
+=cut
+
+use strict;
+use warnings;
+use v5.10;
+
+use FS::Misc::Pod2Html 'fs_pod2html';
+use FS::UID qw( checkuid );
+
+die 'Not running uid freeside!'
+  unless checkuid();
+
+my $html_dir = shift @ARGV
+  or HELP_MESSAGE('Please specify an OUTPUT_DIRECTORY');
+
+HELP_MESSAGE("Directory $html_dir: No write access!")
+  unless -w $html_dir;
+
+fs_pod2html( $html_dir );
+
+sub HELP_MESSAGE {
+  my $error = shift;
+  print " ERROR: $error \n"
+    if $error;
+  print "
+    Generate HTML from Freeside POD documentation
+
+    Usage: pod2html.pl OUTPUT_DIRECTORY
+
+  ";
+  exit;
+}
+
diff --git a/bin/pod2html.pl b/bin/pod2html.pl
deleted file mode 100755
index 935ff1198..000000000
--- a/bin/pod2html.pl
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/usr/bin/env perl
-
-=head1 NAME
-
-pod2html.pl
-
-=head1 DESCRIPTION
-
-Generate HTML from POD documentation
-
-Search directories /usr/local/share/perl and /usr/local/bin
-
-Output HTML to /var/www/html/freeside-doc
-
-=cut
-
-use strict;
-use warnings;
-use v5.10;
-
-use Pod::Simple::Search;
-use Pod::Simple::HTML;
-use Pod::Simple::HTMLBatch;
-
-# Disable this to only build docs for Freeside modules
-# This will cause links to non-freeside packages to be broken,
-# but save 30-60secs during build process
-my $include_system_perl_modules = 1;
-
-
-my $html_dir = shift @ARGV
-  or HELP_MESSAGE('Please specify an OUTPUT_DIRECTORY');
-
-HELP_MESSAGE("Directory $html_dir: No write access!")
-  unless -w $html_dir;
-
-
-my $parser = Pod::Simple::HTMLBatch->new;
-
-# Uncomment to suppress status output to STDIN
-# $parser->verbose(0);
-
-$parser->search_class('Inline::Pod::Simple::Search');
-$parser->html_render_class('Inline::Pod::Simple::HTML');
-
-# Customized HTML output
-our $html_before_title = q{
-  <% include( '/elements/header.html', 'Developer Documentation' ) %>
-  <& /elements/menubar.html,
-    'Freeside Perl Modules' => $fsurl.'docs/library/FS.html',
-    'Complete Index' => $fsurl.'docs/library/index.html',
-  &>
-
-  <div style="width: 90%; margin: 1em auto; font-size: .9em; border: solid 1px #666; background-color: #eee; padding: 1em;">
-  <h1 style="margin: .5em; border-bottom: solid 1px #999;">
-};
-our $html_after_title = q{</h1>};
-our $html_footer = q{</div><% include ('/elements/footer.html' ) %>};
-
-$parser->contents_page_start(
-  "$html_before_title Freeside Documentation Index $html_after_title"
-);
-$parser->contents_page_end( $html_footer );
-
-my @search_dirs = (
-  '/usr/local/share/perl/5.24.1',
-  '/usr/local/bin',
-  $include_system_perl_modules ? (
-    '/usr/share/perl5',
-    '/usr/share/perl/5.24',
-    '/usr/share/perl/5.24.1',
-  ) : (),
-);
-
-$parser->batch_convert( \@search_dirs, $html_dir );
-
-sub HELP_MESSAGE {
-  my $error = shift;
-  print " ERROR: $error \n"
-    if $error;
-  print "
-    Tool to generate HTML from Freeside POD documentation
-
-    Usage: pod2html.pl OUTPUT_DIRECTORY
-
-  ";
-  exit;
-}
-
-
-
-# Subclass Pod::Simple::Search to render POD from files without
-# normal perl extensions like PL and PM
-package Inline::Pod::Simple::Search;
-use base 'Pod::Simple::Search';
-
-sub new {
-  my $class = shift;
-  my $self = Pod::Simple::Search->new( @_ );
-  $self->laborious(1);
-  $self;
-}
-1;
-
-
-# Subclass Pod::Simple::HTML to control HTML output
-package Inline::Pod::Simple::HTML;
-use base 'Pod::Simple::HTML';
-
-sub html_header_before_title { $html_before_title }
-sub html_header_after_title { $html_after_title }
-sub html_footer { $html_footer }
-
-1;

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Misc/Pod2Html.pm       | 132 +++++++++++++++++++++++++++++++++++++++++++
 FS/bin/freeside-pod2html     |  47 +++++++++++++++
 Makefile                     |   2 +-
 bin/pod2html.pl              | 114 -------------------------------------
 debian/freeside-lib.postinst |  17 ++++++
 5 files changed, 197 insertions(+), 115 deletions(-)
 create mode 100644 FS/FS/Misc/Pod2Html.pm
 create mode 100755 FS/bin/freeside-pod2html
 delete mode 100755 bin/pod2html.pl




More information about the freeside-commits mailing list