Blame Scripts/Bash/Functions/Help/help_updateOutputFiles.sh

4c79b5
#!/bin/bash
4c79b5
#
4c79b5
# help_updateOutputFiles.sh -- This function updates manuals' related
4c79b5
# output files.
4c79b5
#
4c79b5
# Copyright (C) 2009-2010 Alain Reguera Delgado
4c79b5
# 
4c79b5
# This program is free software; you can redistribute it and/or modify
4c79b5
# it under the terms of the GNU General Public License as published by
4c79b5
# the Free Software Foundation; either version 2 of the License, or
4c79b5
# (at your option) any later version.
4c79b5
# 
4c79b5
# This program is distributed in the hope that it will be useful, but
4c79b5
# WITHOUT ANY WARRANTY; without even the implied warranty of
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
4c79b5
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
4c79b5
# USA.
4c79b5
# 
4c79b5
# ----------------------------------------------------------------------
4c79b5
# $Id: help_updateOutputFiles.sh 98 2010-09-19 16:01:53Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
function help_updateOutputFiles {
4c79b5
4c79b5
    # Output action message.
4c79b5
    cli_printMessage "`gettext "Updating manual's output files"`"
4c79b5
4c79b5
    # -- .info ----------
4c79b5
4c79b5
    # Check .info output directory 
4c79b5
    [[ ! -d ${MANUALS_DIR[3]} ]] &&  mkdir -p ${MANUALS_DIR[3]}
4c79b5
4c79b5
    # Update .info file
c3a9af
    /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[4]} --no-ifhtml
4c79b5
4c79b5
    # Check .info file. If the info file was not created then there
4c79b5
    # are errors to fix.
4c79b5
    if [[ ! -f ${MANUALS_FILE[4]} ]];then
1f1b3c
        cli_printMessage "$(caller)" "AsToKnowMoreLine"
4c79b5
    fi
4c79b5
4c79b5
    # Compress .info file.
4c79b5
    bzip2 -f ${MANUALS_FILE[4]}
4c79b5
4c79b5
    # -- .html ----------
4c79b5
4c79b5
    # Check html output directory
4c79b5
    [[ ! -d ${MANUALS_DIR[4]} ]] && mkdir -p ${MANUALS_DIR[4]}
4c79b5
4c79b5
    # Add html output directory into directory stack to make it the
4c79b5
    # working directory. If we don't do this, texi2html doesn't
4c79b5
    # produce paths correctly inside html output.
4c79b5
    pushd ${MANUALS_DIR[4]} > /dev/null
4c79b5
4c79b5
    # Update html files.  At this point, we use texi2html to export
4c79b5
    # texinfo files to html using Modern's CSS definitions. We also
4c79b5
    # append image directories to the @include search path, using
4c79b5
    # texi2html's '--I' option. Adding image directories to @include
4c79b5
    # search path is needed in order for texi2html to build html paths
4c79b5
    # correctly, once the html output is produced.  For exmample, if
4c79b5
    # you want to include the following image:
4c79b5
    #
4c79b5
    #   /home/centos/artwork/trunk/Identity/Models/Img/en/Scripts/renderImage.png
4c79b5
    #
4c79b5
    # you add its directory path to @include search path using the
4c79b5
    # following command: 
4c79b5
    #
4c79b5
    #   texi2html --I=/home/centos/artwork/trunk/Identity/Models/Img/en/Scripts
4c79b5
    #
4c79b5
    # Once the image directory path has been added to @include search
4c79b5
    # path, use the @image command inside texinfo files to include
4c79b5
    # images available.  In order to include images correctly, do not
4c79b5
    # include the image path in the first argument of @image command,
4c79b5
    # use just the image name (without extension) instead (e.g.,
4c79b5
    # @image{renderImage,,,,png}).
4c79b5
    texi2html ${MANUALS_FILE[1]} --output=${MANUALS_DIR[4]} --split section \
4c79b5
        --nosec-nav \
63a662
        --css-include=/home/centos/artwork/trunk/Identity/Models/Css/Texi2html/stylesheet.css \
4c79b5
        --I=/home/centos/artwork/trunk/Identity/Fonts/Img \
63a662
        --I=/home/centos/artwork/trunk/Identity/Models/Img/Scripts/png/ \
63a662
        --I=/home/centos/artwork/trunk/Identity/Models/Img/Corporate/png/ \
63a662
        --I=/home/centos/artwork/trunk/Identity/Models/Img/Promo/Web/png/ \
63a662
        --I=/home/centos/artwork/trunk/Identity/Models/Img/Promo/Web/Concepts/png/ \
63a662
        --I=/home/centos/artwork/trunk/Identity/Models/Img/Distro/png/
4c79b5
4c79b5
    # Apply html transformations.
4c79b5
    sed -r -i \
63a662
        -f /home/centos/artwork/trunk/Identity/Models/Css/Texi2html/transformations.sed \
4c79b5
        ${MANUALS_DIR[4]}/*.html
4c79b5
4c79b5
    # Remove html output directory from directory stack.
4c79b5
    popd > /dev/null
4c79b5
4c79b5
    # -- .txt -----------
4c79b5
4c79b5
    # Check plaintext output directory.
4c79b5
    [[ ! -d ${MANUALS_DIR[5]} ]] &&  mkdir -p ${MANUALS_DIR[5]}
4c79b5
4c79b5
    # Update plaintext output directory.
c3a9af
    /usr/bin/makeinfo ${MANUALS_FILE[1]} --output=${MANUALS_FILE[5]} --plaintext --no-ifhtml
4c79b5
4c79b5
    # Update central repository. Be sure to see changes before commit
4c79b5
    # them up to central repository.
4c79b5
    help_addNewFilesToWorkingCopy ${MANUALS_DIR[0]}
4c79b5
    if [[ $(svn diff ${MANUALS_DIR[0]}) != '' ]];then
4c79b5
        cli_printMessage "`gettext "The working copy has been updated."`"
4c79b5
        cli_printMessage "`gettext "Do you want to see changes now?"`" "AsYesOrNoRequestLine"
4c79b5
        eval svn diff ${MANUALS_DIR[0]} | less
4c79b5
        cli_printMessage "`gettext "Do you want to commit changes now?"`" "AsYesOrNoRequestLine"
4c79b5
        eval svn commit ${MANUALS_DIR[0]}
4c79b5
    fi
4c79b5
4c79b5
}