Blame Automation/centos-art.sh-mods/Render/render_getDirTemplate.sh

Alain Reguera Delgado 8f60cb
#!/bin/bash
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# render_getDirTemplate.sh -- This function defines the way renderable
Alain Reguera Delgado 8f60cb
# directories are processed inside the repository.  Inside the
Alain Reguera Delgado 8f60cb
# repository, renderable directories are processed either through
Alain Reguera Delgado 8f60cb
# direct or theme-specific rendition.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Direct rendition takes one XML file from design model
Alain Reguera Delgado 8f60cb
# (`Identity/Models') directory structure and produces one file
Alain Reguera Delgado 8f60cb
# in `Identity/Images' directory strucutre. In this
Alain Reguera Delgado 8f60cb
# configuration, the organization used to stored the design model is
Alain Reguera Delgado 8f60cb
# taken as reference to build the path required to store the image
Alain Reguera Delgado 8f60cb
# related to it under `Identity/Images' directory structure.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Theme-specific rendition takes one design model from
Alain Reguera Delgado 8f60cb
# `Identity/Models/Themes' directory structure to produce one or
Alain Reguera Delgado 8f60cb
# more images in `Identity/Images/Themes/$THEME/$VERSION/$MODEL'
Alain Reguera Delgado 8f60cb
# directory structure. In this configuration we have many different
Alain Reguera Delgado 8f60cb
# artistic motifs that use one unique design model directory structure
Alain Reguera Delgado 8f60cb
# as reference to produce images. 
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Since theme design models are unified to be reused by more
Alain Reguera Delgado 8f60cb
# than one artistic motif, it is not possible to render artistic
Alain Reguera Delgado 8f60cb
# motifs in a lineal manner (i.e., as we do with direct rendition)
Alain Reguera Delgado 8f60cb
# because we need to establish the relation between the artistic motif
Alain Reguera Delgado 8f60cb
# renderable directory structure and the design model first and that
Alain Reguera Delgado 8f60cb
# relation happens when renderable directory structures inside
Alain Reguera Delgado 8f60cb
# artistic motifs are processed individually.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# In the first rendition category, we use a design model directory
Alain Reguera Delgado 8f60cb
# structure as reference to produce images one by one. In the second
Alain Reguera Delgado 8f60cb
# rendition category, we can't use the same procedure because one
Alain Reguera Delgado 8f60cb
# design model directory structure is used to produce several
Alain Reguera Delgado 8f60cb
# renderable directory structures, not just one.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# Copyright (C) 2009-2013 The CentOS Project
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8f60cb
# it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8f60cb
# the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8f60cb
# your option) any later version.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8f60cb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8f60cb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8f60cb
# General Public License for more details.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8f60cb
# along with this program; if not, write to the Free Software
Alain Reguera Delgado 8f60cb
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8f60cb
#
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
# $Id$
Alain Reguera Delgado 8f60cb
# ----------------------------------------------------------------------
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
function render_getDirTemplate {
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Initialize design models location used as reference to process
Alain Reguera Delgado 8f60cb
    # renderable directory structures.
Alain Reguera Delgado 8f60cb
    TEMPLATE=$ACTIONVAL
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Define absolute path to input files using absolute path from
Alain Reguera Delgado 8f60cb
    # output files.
Alain Reguera Delgado 8f60cb
    if [[ -d ${TEMPLATE}/Models ]];then
Alain Reguera Delgado 8f60cb
        TEMPLATE=${TEMPLATE}/Models
Alain Reguera Delgado 8f60cb
    else
Alain Reguera Delgado 8f60cb
        TEMPLATE=$(echo "$TEMPLATE" | sed -r \
Alain Reguera Delgado 8f60cb
            -e "s!/Themes/$(cli_getPathComponent $ACTIONVAL --motif)!/Themes/${FLAG_THEME_MODEL}!" \
Alain Reguera Delgado 8f60cb
            -e "s!/(Manuals|Images)!/Models!")
Alain Reguera Delgado 8f60cb
    fi
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
    # Verify absolute path to input file. This verification is
Alain Reguera Delgado 8f60cb
    # specially needed in those situations when the artistic motif
Alain Reguera Delgado 8f60cb
    # directory structure has an organization different to that in
Alain Reguera Delgado 8f60cb
    # design models directory structure. Since the path to design
Alain Reguera Delgado 8f60cb
    # models is built from artistic motif directory structure, if
Alain Reguera Delgado 8f60cb
    # artistic motifs directory structure is different from design
Alain Reguera Delgado 8f60cb
    # model directory structure, as result we'll have a path to a
Alain Reguera Delgado 8f60cb
    # design model that may not exist and that would make
Alain Reguera Delgado 8f60cb
    # centos-art.sh script to fail. So, verify the absolute path to
Alain Reguera Delgado 8f60cb
    # the input file and stop script execution if it doesn't exist.
Alain Reguera Delgado 8f60cb
    cli_checkFiles -e $TEMPLATE
Alain Reguera Delgado 8f60cb
Alain Reguera Delgado 8f60cb
}