Blame Scripts/Functions/Help/help_copyEntry.sh

2bd980
#!/bin/bash
2bd980
#
0211a4
# help_copyEntry.sh -- This function copies documentation entries and
7dc6cc
# updates documentation structure to reflect changes.
2bd980
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
fa95b1
#
fa95b1
# This program is free software; you can redistribute it and/or modify
fa95b1
# it under the terms of the GNU General Public License as published by
fa95b1
# the Free Software Foundation; either version 2 of the License, or
fa95b1
# (at your option) any later version.
fa95b1
#
2bd980
# This program is distributed in the hope that it will be useful, but
2bd980
# WITHOUT ANY WARRANTY; without even the implied warranty of
2bd980
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
2bd980
# General Public License for more details.
2bd980
#
2bd980
# You should have received a copy of the GNU General Public License
2bd980
# along with this program; if not, write to the Free Software
2bd980
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
2bd980
# USA.
2bd980
# ----------------------------------------------------------------------
2bd980
# $Id$
2bd980
# ----------------------------------------------------------------------
2bd980
0211a4
function help_copyEntry {
56f126
b182ba
    # Print separator line.
b182ba
    cli_printMessage '-' 'AsSeparatorLine'
b182ba
fe5a38
    local ENTRY_SRC="$ENTRY"
a484de
    local ENTRIES=''
a484de
    local ENTRY=''
a484de
7dc6cc
    # Print action message.
a484de
    cli_printMessage "${ENTRY_DST}" 'AsCreatingLine'
56f126
7dc6cc
    # Copy main documentation entry.
a484de
    if [[ ! -f ${ENTRY_DST} ]];then
a484de
        svn cp "${ENTRY_SRC}" "${ENTRY_DST}" --quiet
7dc6cc
    fi
56f126
7dc6cc
    # Define target location of directory holding dependent
7dc6cc
    # documentation entries.
a484de
    ENTRY_DST=$(echo ${ENTRY_DST} | sed -r 's!\.texi$!!')
7dc6cc
a484de
    # Copy dependent documentation entries, if any.
a484de
    if [[ ! -d ${ENTRY_DST} ]];then
a484de
        cli_printMessage "${ENTRY_DST}" 'AsCreatingLine'
a484de
        svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet
7dc6cc
    fi
7dc6cc
                
7dc6cc
    # Define list of files to process.
fe5a38
    ENTRIES=$(cli_getFilesList "$(dirname ${ENTRY_DST})" ".*$(basename ${ENTRY_DST}).*\.texi")
56f126
7dc6cc
    # Set action preamble.
467208
    cli_printActionPreamble "${ENTRIES}" '' ''
56f126
a484de
    # Print separator line.
a484de
    cli_printMessage '-' 'AsSeparatorLine'
a484de
a484de
    # Print action message.
b182ba
    cli_printMessage "Updating menus, nodes and cross-references." 'AsResponseLine'
a484de
7dc6cc
    # Redefine ENTRY variable in order to update documentation
7dc6cc
    # structure, taking recently created entries as reference.
7dc6cc
    for ENTRY in ${ENTRIES};do
2bd980
7dc6cc
        # Update menu and node definitions from manual sections to
7dc6cc
        # reflect the changes.
0211a4
        help_updateMenu
0211a4
        help_updateNodes
2bd980
7dc6cc
        # Update cross reference definitions from manual to reflect
7dc6cc
        # the changes.
0211a4
        help_restoreCrossReferences
2bd980
7dc6cc
    done
2bd980
2bd980
}