Update of /cvsroot/perl-win32-gui/Win32-GUI/build_tools
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21242/build_tools

Modified Files:
        doHTMLDocs.pl 
Log Message:
Doc updates and add Win32::GUI::ReleaseNotes

Index: doHTMLDocs.pl
===================================================================
RCS file: /cvsroot/perl-win32-gui/Win32-GUI/build_tools/doHTMLDocs.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** doHTMLDocs.pl       30 Jun 2005 22:36:22 -0000      1.2
--- doHTMLDocs.pl       16 Jul 2006 11:09:32 -0000      1.3
***************
*** 1,3 ****
! #!perl
  
  # This file is part of the build tools for Win32::GUI
--- 1,3 ----
! #!perl -w
  
  # This file is part of the build tools for Win32::GUI
***************
*** 8,15 ****
  # (2) Copies any GIF files from the document source to the relavent location
  #     in the blib/html tree
  
  # it is typically invoked as
  #  make htmldocs
! # or automatically as part of the distribution build
  # process
  #
--- 8,17 ----
  # (2) Copies any GIF files from the document source to the relavent location
  #     in the blib/html tree
+ # (3) converts all POD documentation in the blib/script directory, and puts
+ #     it in the blib/html/bin directory
  
  # it is typically invoked as
  #  make htmldocs
! # or automatically as part of the ppm distribution build
  # process
  #
***************
*** 22,43 ****
  use BuildTools;
  use Pod::Html;
! use Cwd;
! my $cwd = cwd;
  
  my $DEBUG = 0;
  
  my $srcdir = "blib/lib";
! my $destdir = "blib/html/site/lib";
! my $docroot  = "blib/html";
! my $imgsrcdir = "docs/";
  
  print BuildTools::macro_subst(
      "Converting POD documentation to HTML for Win32::GUI v__W32G_VERSION__ on 
__W32G_DATE__\n"
!     );
  
  # recursively traverse everything inside the source directory, find .pod files
  # convert to html and put in a corresponding location in the blib/html 
directory
! BuildTools::mkpath($destdir);
! doHtml($srcdir, $destdir);
  
  # remove pod2html cache files; 5.6 uses ".x~~" and 5.8 uses ".tmp" extensions
--- 24,50 ----
  use BuildTools;
  use Pod::Html;
! use Pod::Find  qw(pod_find);
! use File::Path qw(mkpath);
! use File::Spec qw();
! use File::Find qw(find);
! use File::Copy qw(copy);
  
  my $DEBUG = 0;
  
  my $srcdir = "blib/lib";
! my $srcbindir = "blib/script";
! my $destrootdir  = "blib/html";
! my $destsubdir = "site/lib";
! my $destbinsubdir = "bin";
! my $imgsrcdir = "docs";
  
  print BuildTools::macro_subst(
      "Converting POD documentation to HTML for Win32::GUI v__W32G_VERSION__ on 
__W32G_DATE__\n"
! );
  
  # recursively traverse everything inside the source directory, find .pod files
  # convert to html and put in a corresponding location in the blib/html 
directory
! doHtml($srcdir, $destrootdir, $destsubdir);
! doHtml($srcbindir, $destrootdir, $destbinsubdir);
  
  # remove pod2html cache files; 5.6 uses ".x~~" and 5.8 uses ".tmp" extensions
***************
*** 45,49 ****
  
  # copy all GIF files from docs directy to html tree
! doGIF($imgsrcdir, "$destdir/Win32");
  
  exit(0);
--- 52,56 ----
  
  # copy all GIF files from docs directy to html tree
! doGIF($imgsrcdir, File::Spec->catfile($destrootdir, $destsubdir, "Win32"));
  
  exit(0);
***************
*** 51,136 ****
  sub doHtml
  {
!   my ($src, $dst) = @_;
  
!   opendir(my $DH, $src) || die "Can't open directory $src: $!";
!   while(my $file = readdir($DH)) {
!     # process .pod files
!     if($file =~ /\.pod$/ || $file =~ /GridLayout.pm$/ || $file =~ 
/BitmapInline.pm$/) {
!       (my $htmlfile = $file) =~ s/\.(pod|pm)$/.html/;
!       print STDERR "Converting $file to $dst/$htmlfile\n" if $DEBUG;
  
!       # calculate the relative paths (cope with non-standard perl installs)
!       my $path2root = "$dst/";
!       $path2root =~ s|^$docroot/||;
!       $path2root =~ s|\w*/|../|g;
!       $path2root =~ s|/$||;
  
!       # ensure the destination directory exists
!       print STDERR "Creating directory $dst/$file\n" if $DEBUG;
!       BuildTools::mkpath($dst);
  
!       # and convert the source POD to destination HTML
!       my @options = (
!         "--infile=$src/$file",
!         "--outfile=$dst/$htmlfile",
!         "--header",
!         "--css=$path2root/Active.css",
!         "--htmlroot=$path2root/site/lib",
!         "--podroot=$cwd/blib",
!       );
!       print STDERR "pod2html @options\n" if $DEBUG;
!       pod2html(@options);
!     }
  
!     # recurse to directories
!     elsif (-d "$src/$file") {
!       # ignore '.' and '..'
!       if ($file !~ /^\.{1,2}$/) {
!         doHtml("$src/$file", "$dst/$file");
!       }
!     }
  
!     # ignore anything else
!     else {
      }
-   }
-   closedir($DH);
  
!   return 1;
  }
  
- sub doGIF
  {
!   my ($src, $dst) = @_;
  
!   opendir(my $DH, $src) || die "Can't open directory $src: $!";
!   while(my $file = readdir($DH)) {
  
!     # copy .gif files
!     if($file =~ /\.gif$/) {
  
!       # ensure the destination directory exists
!       print STDERR "Creating directory $dst/$file\n" if $DEBUG;
!       BuildTools::mkpath($dst);
  
!       # copy the file
!       print STDERR "Copying $file to $dst/$file\n" if $DEBUG;
!       BuildTools::cp("$src/$file","$dst");
      }
  
!     # recurse to directories
!     elsif (-d "$src/$file") {
!       # ignore '.' and '..'
!       if ($file !~ /^\.{1,2}$/) {
!         doGIF("$src/$file", "$dst/$file");
!       }
!     }
  
!     # ignore anything else
!     else {
      }
-   }
-   closedir($DH);
- 
-   return 1;
  }
--- 58,148 ----
  sub doHtml
  {
!     my ($srcdir, $htmlrootdir, $htmlsubdir) = @_;
  
!     # Tidy the passed params:
!     $srcdir      = File::Spec->canonpath($srcdir);
!     $htmlrootdir = File::Spec->canonpath($htmlrootdir);
!     $htmlsubdir  = File::Spec->canonpath($htmlsubdir);
  
!     # Find POD files:
!     my %pods = pod_find( {-perl => 1}, $srcdir);
  
!     for my $srcfile (keys %pods) {
  
!         # Ignore any demo files:
!         next if $srcfile =~ /demos[\/\\]/;
  
!         # Relative and tidy srcfile
!         $srcfile = File::Spec->abs2rel($srcfile);
!         $srcfile = File::Spec->canonpath($srcfile);
  
!         # Strip common prefix:
!         my $tmp = $srcfile;
!         $tmp =~ s/^\Q$srcdir\E//;
!         $tmp = File::Spec->catfile($htmlrootdir, $htmlsubdir, $tmp);
!         $tmp = File::Spec->canonpath($tmp);
! 
!         # generate html file name
!         (my $htmlfile = $tmp) =~ s/\.[^.]*$/.html/;
!         print STDERR "Converting $srcfile to $htmlfile\n" if $DEBUG;
! 
!         # ensure the destination directory exists
!         my (undef, $dstdir, undef) = File::Spec->splitpath($htmlfile);
!         print STDERR "Creating directory $dstdir\n" if $DEBUG;
!         mkpath($dstdir);
! 
!         # calculate the relative path to the html root dir
!         my $path2root = File::Spec->abs2rel($htmlrootdir, $dstdir);
! 
!         # Unixify path seperators
!         (my $u_srcfile    = $srcfile)    =~ s|\\|/|g;
!         (my $u_htmlfile   = $htmlfile)   =~ s|\\|/|g;
!         (my $u_dstdir     = $dstdir)     =~ s|\\|/|g;
! 
!         (my $u_htmlroot = File::Spec->catdir($path2root, $htmlsubdir))   =~ 
s|\\|/|g;
!         (my $u_css      = File::Spec->catfile($path2root, "Active.css")) =~ 
s|\\|/|g;
! 
!         # and convert the source POD to destination HTML
!         my @options = (
!             "--infile=$u_srcfile",
!             "--outfile=$u_htmlfile",
!             "--htmldir=$u_dstdir",
!             "--htmlroot=$u_htmlroot",
!             "--css=$u_css",
!             "--header",
!         );
!         print STDERR "pod2html @options\n" if $DEBUG;
!         pod2html(@options);
      }
  
!     return 1;
  }
  
  {
!     my ($srcrootdir, $dstrootdir);
  
!     sub doGIF
!     {
!         my ($src, $dst) = @_;
  
!         # Tidy the passed params:
!         $srcrootdir = File::Spec->canonpath($src);
!         $dstrootdir = File::Spec->canonpath($dst);
  
!         find({wanted =>\&found, no_chdir => 1}, $srcrootdir);
  
!         return 1;
      }
  
!     sub found {
!         my $file  = File::Spec->canonpath($_);
  
!         # copy .gif files
!         if($file =~ /\.gif$/) {
!             (my $dstfile = $file) =~ s/^\Q$srcrootdir\E//;
!             $dstfile = File::Spec->catfile($dstrootdir, $dstfile);
!             print STDERR "Copying $file to $dstfile\n" if $DEBUG;
!             copy($file, $dstfile);
!         }
      }
  }


Reply via email to