Blame Scripts/Bash/Cli/Functions/Identity/identity_render.sh

4c79b5
#!/bin/bash
4c79b5
#
ce597a
# identity_render.sh -- This function initiates rendition
ce597a
# configuration functions and executes them to perform the rendition
ce597a
# action specified in the `ACTIONS' array variable. Function
ce597a
# initialization and execution is based on the absolute path
ce597a
# 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
# ----------------------------------------------------------------------
7b46a4
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
7fde83
function identity_render {
4c79b5
107351
    local FILE=''
107351
107351
    # Initialize artwork identification.
d27df4
    local ARTCOMP=''
d27df4
107351
    # Define default theme model.
d27df4
    local THEMEMODEL='Default'
d27df4
107351
    # Build list of files to process.
107351
    local FILES=$(cli_getFilesList "$ARTCONF" ".*/?render\.conf\.sh")
107351
107351
    # Set action preamble.
ebb30d
    cli_printAction Preamble "$FILES"
107351
107351
    # Process list of files.
107351
    for FILE in $FILES;do
d27df4
d27df4
        # Output action message.
d27df4
        cli_printMessage $FILE 'AsConfigurationLine'
d27df4
d27df4
        # Define artwork-specific action arrays. We need to do this
d27df4
        # here because ACTIONS variable is unset after
ce597a
        # identity_renders execution. Otherwise, undesired
d27df4
        # concatenations may occur.
d27df4
        local -a ACTIONS
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
107351
        # (function) scripts to re-define artwork-specific ACTIONS.
e912f5
        identity_loadConfig
d27df4
d27df4
        # Check variables passed from artwork-specific pre-rendition
d27df4
        # configuration scripts and make required transformations.
130f90
        identity_getConfig
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 \
fa8704
            -e 's!Scripts/Bash/Functions/Identity/Config/(Identity)/!\1/!' \
e0066e
            -e "s!Themes/!Themes/Motifs/$(cli_getPathComponent '--theme')/!"))
d27df4
107351
        # Redefine artwork identification using redefined action
107351
        # value.
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.
9b4d7d
        ARTCOMP=$(echo $ARTCOMP \
9b4d7d
            | sed -r "s!Themes/Motifs/$(cli_getPathComponent '--theme')/!Themes/!")
d27df4
ad3ecd
        # Initiate base rendition using pre-rendition configuration
ad3ecd
        # files.
ad3ecd
        identity_renderBase
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 POSTACTIONS
d27df4
        unset LASTACTIONS
f3bce7
07c2fe
    done
4c79b5
4c79b5
}