Blame Scripts/Bash/centos-art/Functions/Identity/identity_getDirTemplate.sh

4c79b5
#!/bin/bash
4c79b5
#
130f90
# identity_getDirTemplate.sh -- This function re-defines absolute
cabeaa
# path to artwork's related design templates directory.
4c79b5
#
9f5f2e
# Copyright (C) 2009-2011 Alain Reguera Delgado
4c79b5
# 
7cd8e9
# This program is free software; you can redistribute it and/or
7cd8e9
# modify it under the terms of the GNU General Public License as
7cd8e9
# published by the Free Software Foundation; either version 2 of the
7cd8e9
# License, or (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
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
130f90
function identity_getDirTemplate {
4c79b5
cabeaa
    # Initialize design models location using action value as
cabeaa
    # reference.
5711b4
    TEMPLATE=$ACTIONVAL
12f1d8
cabeaa
    # Sanitate design models location.  Be sure design models do
cabeaa
    # always point to trunk directory structure. This is useful to let
15b1d2
    # `centos-art.sh' script do rendition under branches directory
cabeaa
    # structure, reusing design models under trunk directory
cabeaa
    # structure.
5711b4
    TEMPLATE=$(echo "$TEMPLATE" | sed "s!/branches/!/trunk/!")
12f1d8
5711b4
    # Sanitate design models location using or not Tpl/ directory.
5711b4
    if [[ -d $TEMPLATE/Tpl ]];then
cabeaa
        # Using Tpl/ directory is an obsolete practice that should be
cabeaa
        # avoided. The concept of Tpl/ directory per artwork directory
cabeaa
        # has been replaced by a common design model directory
cabeaa
        # structure where we centralize design models for all
cabeaa
        # different artistic motifs.  However, there are some cases
cabeaa
        # that we may need to use Tpl/ directory still, so we verify
cabeaa
        # its existence and use it if present.
5711b4
        TEMPLATE=$TEMPLATE/Tpl
cabeaa
    else
cabeaa
        # Redefine design model location based on theme model
cabeaa
        # (THEMEMODEL) variable value. The theme model variable is
15b1d2
        # defined in the associated pre-rendition configuration script
cabeaa
        # and can be used to set which design model to use among a
cabeaa
        # list of different design models that we can choose from.
5711b4
        TEMPLATE=$(echo "$TEMPLATE" \
5711b4
            | sed "s!Motifs/$(cli_getPathComponent "$TEMPLATE" '--theme')!Models/$THEMEMODEL!")
12f1d8
    fi
4c79b5
4c79b5
}