Blame Scripts/Bash/Cli/Functions/Manual/manual_copyEntry.sh

2bd980
#!/bin/bash
2bd980
#
87a0f9
# manual_copyEntry.sh -- This function copies documentation entries and
7dc6cc
# updates documentation structure to reflect changes.
2bd980
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
2bd980
# 
2bd980
# This program is free software; you can redistribute it and/or
2bd980
# modify it under the terms of the GNU General Public License as
2bd980
# published by the Free Software Foundation; either version 2 of the
2bd980
# License, or (at your option) any later version.
2bd980
# 
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
# ----------------------------------------------------------------------
2bd980
# $Id$
2bd980
# ----------------------------------------------------------------------
2bd980
87a0f9
function manual_copyEntry {
56f126
a484de
    local ENTRY_SRC=${ENTRY}
a484de
    local ENTRY_DST=${FLAG_TO}
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.
a484de
    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.
a484de
    cli_printMessage "Updating manual 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.
7dc6cc
        manual_updateMenu
7dc6cc
        manual_updateNodes
2bd980
7dc6cc
        # Update cross reference definitions from manual to reflect
7dc6cc
        # the changes.
7dc6cc
        manual_restoreCrossReferences
2bd980
7dc6cc
    done
2bd980
2bd980
}