Blame Scripts/Functions/Render/render_getDirTemplate.sh

4c79b5
#!/bin/bash
4c79b5
#
f6f5f3
# render_getDirTemplate.sh -- This function defines the way renderable
f6f5f3
# directories are processed inside the repository.  Inside the
f6f5f3
# repository, renderable directories are processed either through
cff13a
# direct or theme-specific rendition.
f6f5f3
#
cff13a
# Direct rendition takes one XML file from design model
cff13a
# (`trunk/Identity/Models') directory structure and produces one file
cff13a
# in `trunk/Identity/Images' directory strucutre. In this
cff13a
# configuration, the organization used to stored the design model is
cff13a
# taken as reference to build the path required to store the image
cff13a
# related to it under `trunk/Identity/Images' directory structure. 
f6f5f3
#
cff13a
# Theme-specific rendition takes one design model from
cff13a
# `trunk/Identity/Models/Themes' directory structure to produce one or
cff13a
# more images in `trunk/Identity/Images/Themes/$THEME/$VERSION/$MODEL'
cff13a
# directory structure. In this configuration we have many different
cff13a
# artistic motifs that use one unique design model directory structure
cff13a
# as reference to produce images. 
f6f5f3
#
fa95b1
# Since theme design models are unified to be reused by more
fa95b1
# than one artistic motif, it is not possible to render artistic
cff13a
# motifs in a lineal manner (i.e., as we do with direct rendition)
cff13a
# because we need to establish the relation between the artistic motif
cff13a
# renderable directory structure and the design model first and that
cff13a
# relation happens when renderable directory structures inside
cff13a
# artistic motifs are processed individually.
f6f5f3
#
f6f5f3
# In the first rendition category, we use a design model directory
f6f5f3
# structure as reference to produce images one by one. In the second
f6f5f3
# rendition category, we can't use the same procedure because one
f6f5f3
# design model directory structure is used to produce several
f6f5f3
# renderable directory structures, not just one.
4c79b5
#
2fe9b7
# 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
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
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
ab1d67
function render_getDirTemplate {
4c79b5
f6f5f3
    # Initialize design models location used as reference to process
f6f5f3
    # renderable directory structures.
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
cff13a
    # Define absolute path to input files using absolute path from
cff13a
    # output files.
58e3c8
    if [[ -d ${TEMPLATE}/Tpl ]];then
58e3c8
        TEMPLATE=${TEMPLATE}/Tpl
58e3c8
    else
cff13a
        TEMPLATE=$(echo "$TEMPLATE" | sed -r \
08df3c
            -e "s!/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!/Themes/${FLAG_THEME_MODEL}!" \
cff13a
            -e "s!/Images!/Models!")
58e3c8
    fi
58e3c8
b59db5
    # Verify absolute path to input file. This verification is
b59db5
    # specially needed in those situations when the artistic motif
b59db5
    # directory structure has an organization different to that in
b59db5
    # design models directory structure. Since the path to design
b59db5
    # models is built from artistic motif directory structure, if
b59db5
    # artistic motifs directory structure is different from design
b59db5
    # model directory structure, as result we'll have a path to a
b59db5
    # design model that may not exist and that would make
b59db5
    # centos-art.sh script to fail. So, verify the absolute path to
b59db5
    # the input file and stop script execution if it doesn't exist.
b59db5
    cli_checkFiles $TEMPLATE
b59db5
4c79b5
}