Blame Scripts/Bash/Functions/Render/render_doIdentity.sh

4c79b5
#!/bin/bash
4c79b5
#
d27df4
# render_doIdentity.sh -- This function initiates rendition
d27df4
# configuration functions and executes them to perform the rendition
d27df4
# action specified in the `ACTIONS' array variable. Function
d27df4
# initialization and execution is based on the absolute path
d27df4
# convenction defined by ARTCONF variable.
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
# ----------------------------------------------------------------------
6523cc
# $Id: render_doIdentity.sh 824 2011-01-06 20:54:52Z al $
4c79b5
# ----------------------------------------------------------------------
4c79b5
4c79b5
function render_doIdentity {
4c79b5
d27df4
    # Check parent directory. Identity rendition takes place under
d27df4
    # trunk/Identity directory structure only. Be sure action value
d27df4
    # referes an identity directory structure before perform identity
d27df4
    # rendition.
d27df4
    if [[ ! $ACTIONVAL =~ "^$(cli_getRepoTLDir $ACTIONVAL)/Identity/.+$" ]];then
d27df4
        cli_printMessage "`eval_gettext "Can't do identity rendition at \\\`\\\$ACTIONVAL'."`" 'AsErrorLine'
d27df4
        cli_printMessage "$(caller)" "AsToKnowMoreLine"
d27df4
    fi
d27df4
4c79b5
    # Define variables as local to avoid conflicts outside.
d27df4
    local ARTCOMP=''
d27df4
d27df4
    # Define default theme model to use.  
d27df4
    local THEMEMODEL='Default'
d27df4
d27df4
    # Define default artworks matching list. The artworks matching
d27df4
    # list lets you customize how translation files are applied to
d27df4
    # design templates. When matching list is empty (the default
d27df4
    # value), translation files are applied to design templates
d27df4
    # sharing the same name (without the extension). This produces one
d27df4
    # translated design for each translation file available.
d27df4
    # Matching list definitions where translation files need to be
d27df4
    # applied to specific design templates are defined inside
d27df4
    # artwork-specific pre-rendition configuration scripts.
d27df4
    local MATCHINGLIST=''
d27df4
d27df4
    # Check current scripts path value. If scripts path points to a
d27df4
    # directory which currently doesn't exist there is nothing to do
d27df4
    # here, so leave a message quit script execution.
d27df4
    if [[ ! -d $ARTCONF ]];then
d27df4
        cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine'
d27df4
        cli_printMessage "$(caller)" 'AsToKnowMoreLine'
d27df4
    fi
d27df4
d27df4
    for FILE in $(find $ARTCONF -name 'render.conf.sh');do
d27df4
d27df4
        # Output action message.
d27df4
        cli_printMessage $FILE 'AsConfigurationLine'
d27df4
        cli_printMessage '-' 'AsSeparatorLine'
d27df4
d27df4
        # Define artwork-specific action arrays. We need to do this
d27df4
        # here because ACTIONS variable is unset after
d27df4
        # render_doIdentityImages execution. Otherwise, undesired
d27df4
        # concatenations may occur.
d27df4
        local -a ACTIONS
d27df4
        local -a BASEACTIONS
d27df4
        local -a POSTACTIONS
d27df4
        local -a LASTACTIONS
d27df4
  
d27df4
        # Initialize artwork-specific pre-rendition configuration
d27df4
        # (function) scripts.
d27df4
        . $FILE
d27df4
d27df4
        # Execute artwork-specific pre-rendition configuration
d27df4
        # (function) scripts to re-define artwork-specific ACTIONS and
d27df4
        # MATCHINGLIST variables. 
d27df4
        render_loadConfig
d27df4
d27df4
        # Check variables passed from artwork-specific pre-rendition
d27df4
        # configuration scripts and make required transformations.
72029a
        render_getIdentityConfig
d27df4
d27df4
        # Redefine action value (ACTIONVAL) based on pre-rendition
d27df4
        # configuration script path value. Otherwise, massive
d27df4
        # rendition may fail. Functions like renderImage need to know
d27df4
        # the exact artwork path (that is, where images will be
d27df4
        # stored).
d27df4
        ACTIONVAL=$(dirname $(echo $FILE | sed -r \
d27df4
            -e 's!Scripts/Bash/Functions/Render/Config/Identity/!Identity/!' \
e0066e
            -e "s!Themes/!Themes/Motifs/$(cli_getPathComponent '--theme')/!"))
d27df4
d27df4
        # Redefine artwork identification.
d27df4
        ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-)
d27df4
d27df4
        # Remove motif name from artwork identification in order to
d27df4
        # reuse motif artwork identification. There is not need to
d27df4
        # create one artwork identification for each motif directory
d27df4
        # structure if we can reuse just one.
e0066e
        if [[ $ARTCOMP =~ "Themes/Motifs/$(cli_getPathComponent '--theme')/" ]];then
e0066e
            ARTCOMP=$(echo $ARTCOMP | sed -r "s!Themes/Motifs/$(cli_getPathComponent '--theme')/!Themes/!")
d27df4
        fi
d27df4
d27df4
        # Start rendition as defined in artwork-specific pre-rendition
d27df4
        # configuration file.
6523cc
        render_getIdentityBase
d27df4
d27df4
        # Unset artwork-specific actions so they can be redefined by
d27df4
        # artwork-specific pre-rendition configuration scripts. This
d27df4
        # is required in massive rendition. For example, if you say
d27df4
        # centos-art.sh to render the whole Distro directory it first
d27df4
        # renders Prompt entry, which defines the renderSyslinux
d27df4
        # post-rendition action, and later Progress entry which does
d27df4
        # not defines post-rendition actions. If we do not unset the
d27df4
        # ACTIONS variable, post-rendition actions defined in Prompt
d27df4
        # entry remain for Progress entry and that is not desired. We
d27df4
        # want ACTIONS to do what we exactly tell it to do inside each
d27df4
        # artwork-specific pre-rendition configuration script.
d27df4
        unset ACTIONS
d27df4
        unset BASEACTIONS
d27df4
        unset POSTACTIONS
d27df4
        unset LASTACTIONS
f3bce7
07c2fe
    done
4c79b5
4c79b5
}