Blame Scripts/Functions/Help/Modules/Texinfo/texinfo_copyEntry.sh

2bd980
#!/bin/bash
2bd980
#
1afa3c
# texinfo_copyEntry.sh -- This function copies documentation entries and
7dc6cc
# updates documentation structure to reflect changes.
2bd980
#
2d3646
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
dcd347
# the Free Software Foundation; either version 2 of the License, or (at
dcd347
# your option) any later version.
fa95b1
#
74a058
# This program is distributed in the hope that it will be useful, but
74a058
# 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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
2bd980
# ----------------------------------------------------------------------
2bd980
# $Id$
2bd980
# ----------------------------------------------------------------------
2bd980
1afa3c
function texinfo_copyEntry {
56f126
b182ba
    # Print separator line.
18be6e
    cli_printMessage '-' --as-separator-line
b182ba
fe5a38
    local ENTRY_SRC="$ENTRY"
a484de
    local ENTRIES=''
a484de
    local ENTRY=''
a484de
608fb4
    # Verify parent directory of entry destination. If its parent
608fb4
    # directory doesn't exist, create it and add it to the repository.
608fb4
    if [[ ! -d $(dirname ${ENTRY_DST}) ]];then
608fb4
        mkdir -p $(dirname ${ENTRY_DST})
608fb4
        svn add $(dirname ${ENTRY_DST}) --quiet
608fb4
    fi
608fb4
7dc6cc
    # Copy main documentation entry.
a0596a
    if [[ -a ${ENTRY_SRC} ]] && [[ ! -a ${ENTRY_DST} ]];then
18be6e
        cli_printMessage "${ENTRY_DST}" --as-creating-line
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.
1c42f2
    if [[ -d ${ENTRY_DIR}/${ENTRY_FILE} ]] && [[ ! -d ${ENTRY_DST} ]];then
18be6e
        cli_printMessage "${ENTRY_DST}" --as-creating-line
a484de
        svn cp "${ENTRY_DIR}/${ENTRY_FILE}" "${ENTRY_DST}" --quiet
7dc6cc
    fi
7dc6cc
                
7dc6cc
    # Define list of files to process.
82bd32
    ENTRIES=$(cli_getFilesList $(dirname ${ENTRY_DST}) --pattern=".*$(basename ${ENTRY_DST}).*\.texi")
56f126
a484de
    # Print separator line.
18be6e
    cli_printMessage '-' --as-separator-line
a484de
a484de
    # Print action message.
18be6e
    cli_printMessage "Updating menus, nodes and cross-references." --as-response-line
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.
1afa3c
        texinfo_updateMenu
1afa3c
        texinfo_updateNodes
2bd980
7dc6cc
        # Update cross reference definitions from manual to reflect
7dc6cc
        # the changes.
1afa3c
        texinfo_restoreCrossReferences
2bd980
7dc6cc
    done
2bd980
2bd980
}