ctkUdoc

        This script updates the documentation.
                - check whether the script/module has been changed
                - extract POD section from all scripts resp. modules into temp folder
                - convert POD to html into temp folder
                - move pages to target folder
                - upgrade index
                - upgrade main page (date & version)
                - get rid of temporary files and folder
        Arguments
                - source (default ./)
                - doc folder (default ./doc)
                - target folder (default ./doc/pguide)
        Preconditions
                - doc, source and target folders must exist

Syntax

                perl ctkUdoc.pl [folders]
                folders
                        - source folders which contains script and modules, default ./
                        - doc folder  which contains main page, default ./doc
                        - target folder  which receives generated pages, default ./doc/pguide
                Examples:
                a)upgrade doc after modif in modules
                        perl ctkUdoc.pl ./lib
                b) upgrade doc after changes in main scripts and modules
                        perl ctkUdoc.pl
                        perl ctkUdoc.pl ./lib

Programming notes

Used packages
        - Fcntl
        - Getopt::Std
        - Time::localtime
        - ctkFile
        - Cwd
Globals
        - $FS                 file separator
        - $index              fullname of the index page
        - $programmers_guide  fullname of the main page ('programmers guide')
        - $debug              debugging mode
        - %opt                options from the command lines
        - $backgrundImage        background image url for home & index
        - $backgroundImageModule background image url for modules
=item Temporary files
        Are always allocated into folder ./temp_$0 .

Maintenance

        This is a special version for dumpAnalysis
        which provides following additional tasks:
                - style options for the body segment,
                - navigation bar.

Methods =cut

use strict;

use lib './'; use lib './lib';

use Cwd; use Fcntl; use File::Spec;

use Time::localtime; use Getopt::Std;

use ctkFile;

our $VERSION = 1.03;

our $CALLERCW = cwd();

our $debug = 0; our %opt =(); my $FS = ctkFile->FS; my $backgrundImage = "img/background_IMG_0190_1.jpg"; my $backgroundImageModule = "../img/ctk_pguide_background_0.jpg"; getopts('dhu:',\%opt); # command line options : -d debug mode; -h help ; - u <user>

$debug = 1 if($opt{'d'});

&main::help if (exists($opt{'h'}));

&main::log("$0 - v $VERSION is starting ");

&main::trace("$0 working on $CALLERCW"); &main::trace("debug mode is $debug");

my $temp = "temp_$0"; $temp =~ s/\.p.$//;$temp =~ s/[:\\\s]/_/g; $temp =".$FS$temp"; my $source = "."; $source = $ARGV[0] if @ARGV >= 1; my $doc = ".${FS}doc"; $doc = $ARGV[1] if @ARGV >= 2; my $target = "$doc${FS}pguide"; $target = $ARGV[2] if @ARGV >= 3;

my $index = File::Spec->abs2rel($target,$doc).$FS.'index.html'; my $programmers_guide = "$doc${FS}programmers_guide.html";

die "'$source' do not exist." unless -d $source; die "'$doc' do not exist." unless -d $doc; die "'$target' do not exist." unless -d $target;

$source =~ s/[\/\\]$//; $target =~ s/[\/\\]$//;

mkdir $temp unless -d "$temp"; opendir (DIR,$temp); map { &main::log("1.1 $_ unlinked ") if unlink "$temp$FS$_" } grep /\.\w+$/ , readdir DIR; closedir DIR;

&main($source,$target);

&main::Log("$0 is exiting"); exit(0);

## ----------------------------- =head3 main

        Main logic.

initIndex

        Return the template HTML file
        for the index.

Unit tests

Run after update of ctkUdoc.pl

---------- Execute perl script ----------

        2006 11 17 - 00:07:58 ctkUdoc.pl - v 1.01 is starting
        2006 11 17 - 00:07:58 1. Collect script and module names
        2006 11 17 - 00:07:58 2. extract POD and build html files for scripts
        2006 11 17 - 00:07:58 2.1 extracting from ctkUdoc.pl
        2006 11 17 - 00:07:58 2.2 rc = 0C:\Perl\bin\pod2html.bat: no title for .\ctkUdoc.pl.
        2006 11 17 - 00:07:58 2.3 rc = 0
        2006 11 17 - 00:07:58 3. extract POD and build html files for modules
        2006 11 17 - 00:07:58 4. Move documents to target
        2006 11 17 - 00:07:58 4.1 copying ctkUdoc.html
        2006 11 17 - 00:07:58 4.1 ctkUdoc.html copied
        2006 11 17 - 00:07:58 5. Adapt index
        2006 11 17 - 00:07:58 6. Adapt version
        2006 11 17 - 00:07:58 4.1 Date reset to 11.17.2006
        2006 11 17 - 00:07:58 7. Remove temp folder
        2006 11 17 - 00:07:58 7.1 ctkUdoc.html unlinked
        2006 11 17 - 00:07:58 7.1 ctkUdoc.txt unlinked
        2006 11 17 - 00:07:58 8. Ok done
        2006 11 17 - 00:07:58 ctkUdoc.pl is exiting
Output completed (1 sec consumed) - Normal Termination

Rerun the script

---------- Execute perl script ----------

        2006 11 17 - 00:10:08 ctkUdoc.pl - v 1.01 is starting
        2006 11 17 - 00:10:08 1. Collect script and module names
        2006 11 17 - 00:10:08 ctkUdoc.pl is exiting
Output completed (0 sec consumed) - Normal Termination

ctkUdoc version 1.03 - adapt version

---------- Execute perl script ----------

        2007 11 22 - 12:02:53 ctkUdoc.pl - v 1.03 is starting
        2007 11 22 - 12:02:53 1. Collect script and module names
        2007 11 22 - 12:02:53 2. extract POD and build html files for scripts
        2007 11 22 - 12:02:53 2.1 extracting from ctk_w.pl
        2007 11 22 - 12:02:54 2.2 rc = 0C:\Perl\bin\pod2html.bat: no title for .\ctk_w.pl.
        2007 11 22 - 12:02:55 2.3 rc = 0
        2007 11 22 - 12:02:55 3. extract POD and build html files for modules
        2007 11 22 - 12:02:55 4. Move documents to target
        2007 11 22 - 12:02:55 4.1 copying ctk_w.html
        2007 11 22 - 12:02:55 4.1 ctk_w.html copied
        2007 11 22 - 12:02:55 5. Adapt index
        2007 11 22 - 12:02:55 6. Adapt version
        2007 11 22 - 12:02:55 4.2 Version set to 3.099
        2007 11 22 - 12:02:55 4.1 Date reset to 11.22.2007
        2007 11 22 - 12:02:55 7. Remove temp folder
        2007 11 22 - 12:02:55 7.1 ctk_w.html unlinked
        2007 11 22 - 12:02:55 7.1 ctk_w.txt unlinked
        2007 11 22 - 12:02:55 8. Ok done
        2007 11 22 - 12:02:55 ctkUdoc.pl is exiting
Output completed (1 sec consumed) - Normal Termination
=cut

Back to index