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

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