Blame Scripts/Bash/centos-art/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
7dc6cc
    # Print action message.
7dc6cc
    cli_printMessage "${FLAG_TO}" 'AsCreatingLine'
56f126
7dc6cc
    # Copy main documentation entry.
7dc6cc
    if [[ ! -f $FLAG_TO ]];then
7dc6cc
        svn cp "${ENTRY}" "${FLAG_TO}" --quiet
7dc6cc
    fi
56f126
7dc6cc
    # Define target location of directory holding dependent
7dc6cc
    # documentation entries.
7dc6cc
    local ENTRY_DIR_DST=$(echo ${FLAG_TO} | sed -r 's!\.texi$!!')
56f126
56f126
    # Print action message.
7dc6cc
    cli_printMessage "${ENTRY_DIR_DST}" 'AsCreatingLine'
7dc6cc
7dc6cc
    # Copy dependent documentation entries.
7dc6cc
    if [[ ! -d $ENTRY_DIR_DST ]];then
7dc6cc
        svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DIR_DST}" --quiet
7dc6cc
    fi
7dc6cc
                
7dc6cc
    # Define list of files to process.
7dc6cc
    ENTRIES=$(cli_getFilesList "$(dirname ${ENTRY_DIR_DST})" "$(basename ${ENTRY_DIR_DST}).*\.texi")
56f126
7dc6cc
    # Set action preamble.
7dc6cc
    cli_printActionPreamble "${ENTRIES}"
56f126
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
}