diff --git a/Scripts/Bash/Functions/Render/render_doIdentity.sh b/Scripts/Bash/Functions/Render/render_doIdentity.sh index 68bbf90..cf83758 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentity.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentity.sh @@ -1,7 +1,10 @@ #!/bin/bash # -# render_doIdentity.sh -- This function initiates rendition features -# taking BASEACTIONS as reference. +# render_doIdentity.sh -- This function initiates rendition +# configuration functions and executes them to perform the rendition +# action specified in the `ACTIONS' array variable. Function +# initialization and execution is based on the absolute path +# convenction defined by ARTCONF variable. # # Copyright (C) 2009-2011 Alain Reguera Delgado # @@ -26,52 +29,107 @@ function render_doIdentity { + # Check parent directory. Identity rendition takes place under + # trunk/Identity directory structure only. Be sure action value + # referes an identity directory structure before perform identity + # rendition. + if [[ ! $ACTIONVAL =~ "^$(cli_getRepoTLDir $ACTIONVAL)/Identity/.+$" ]];then + cli_printMessage "`eval_gettext "Can't do identity rendition at \\\`\\\$ACTIONVAL'."`" 'AsErrorLine' + cli_printMessage "$(caller)" "AsToKnowMoreLine" + fi + # Define variables as local to avoid conflicts outside. - local TRANSLATIONPATH='' - local SVG='' - local IMG='' - local PARENTDIR='' - local LOCATION='' - local EXTENSION='' - local FILTER='' - local FILES='' - - # Redefine absolute path to artwork's related translation entry. - render_getIdentityTranslationDir - - # Redefine absolute path to artwork's related design template - # directory. By default design templates are stored in the Tpl/ - # directory which is stored in the workplace's root. - render_getIdentityTemplateDir - - # Redefine absolute path to artwork's related final output - # directory. - render_getIdentityOutputDir - - # Redefine parent directory for current workplace. - PARENTDIR=$(basename $ACTIONVAL) - - # Redefine directory path used as reference to build the list of - # files that will be rendered. - render_getFilesList - - # Define which type of features does centos-art.sh script is able - # to perform. - for ACTION in "${BASEACTIONS[@]}"; do - - case $ACTION in - - renderText ) - # Provides text rendition feature. - render_doIdentityTexts - ;; - - renderImage ) - # Provides image rendition feature. - render_doIdentityImages - ;; - - esac + local ARTCOMP='' + + # Define default theme model to use. + local THEMEMODEL='Default' + + # Define default artworks matching list. The artworks matching + # list lets you customize how translation files are applied to + # design templates. When matching list is empty (the default + # value), translation files are applied to design templates + # sharing the same name (without the extension). This produces one + # translated design for each translation file available. + # Matching list definitions where translation files need to be + # applied to specific design templates are defined inside + # artwork-specific pre-rendition configuration scripts. + local MATCHINGLIST='' + + # Check current scripts path value. If scripts path points to a + # directory which currently doesn't exist there is nothing to do + # here, so leave a message quit script execution. + if [[ ! -d $ARTCONF ]];then + cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + for FILE in $(find $ARTCONF -name 'render.conf.sh');do + + # Output action message. + cli_printMessage $FILE 'AsConfigurationLine' + cli_printMessage '-' 'AsSeparatorLine' + + # Define artwork-specific action arrays. We need to do this + # here because ACTIONS variable is unset after + # render_doIdentityImages execution. Otherwise, undesired + # concatenations may occur. + local -a ACTIONS + local -a BASEACTIONS + local -a POSTACTIONS + local -a LASTACTIONS + + # Initialize artwork-specific pre-rendition configuration + # (function) scripts. + . $FILE + + # Execute artwork-specific pre-rendition configuration + # (function) scripts to re-define artwork-specific ACTIONS and + # MATCHINGLIST variables. + render_loadConfig + + # Check variables passed from artwork-specific pre-rendition + # configuration scripts and make required transformations. + render_checkConfig + + # Redefine action value (ACTIONVAL) based on pre-rendition + # configuration script path value. Otherwise, massive + # rendition may fail. Functions like renderImage need to know + # the exact artwork path (that is, where images will be + # stored). + ACTIONVAL=$(dirname $(echo $FILE | sed -r \ + -e 's!Scripts/Bash/Functions/Render/Config/Identity/!Identity/!' \ + -e "s!Themes/!Themes/Motifs/$(cli_getThemeName)/!")) + + # Redefine artwork identification. + ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-) + + # Remove motif name from artwork identification in order to + # reuse motif artwork identification. There is not need to + # create one artwork identification for each motif directory + # structure if we can reuse just one. + if [[ $ARTCOMP =~ "Themes/Motifs/$(cli_getThemeName)/" ]];then + ARTCOMP=$(echo $ARTCOMP | sed -r "s!Themes/Motifs/$(cli_getThemeName)/!Themes/!") + fi + + # Start rendition as defined in artwork-specific pre-rendition + # configuration file. + render_doIdentityBase + + # Unset artwork-specific actions so they can be redefined by + # artwork-specific pre-rendition configuration scripts. This + # is required in massive rendition. For example, if you say + # centos-art.sh to render the whole Distro directory it first + # renders Prompt entry, which defines the renderSyslinux + # post-rendition action, and later Progress entry which does + # not defines post-rendition actions. If we do not unset the + # ACTIONS variable, post-rendition actions defined in Prompt + # entry remain for Progress entry and that is not desired. We + # want ACTIONS to do what we exactly tell it to do inside each + # artwork-specific pre-rendition configuration script. + unset ACTIONS + unset BASEACTIONS + unset POSTACTIONS + unset LASTACTIONS done diff --git a/Scripts/Bash/Functions/Render/render_doIdentityBase.sh b/Scripts/Bash/Functions/Render/render_doIdentityBase.sh new file mode 100755 index 0000000..7e91944 --- /dev/null +++ b/Scripts/Bash/Functions/Render/render_doIdentityBase.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# render_doIdentityBase.sh -- This function initiates rendition features +# taking BASEACTIONS as reference. +# +# Copyright (C) 2009-2011 Alain Reguera Delgado +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 +# USA. +# +# ---------------------------------------------------------------------- +# $Id$ +# ---------------------------------------------------------------------- + +function render_doIdentityBase { + + # Define variables as local to avoid conflicts outside. + local TRANSLATIONPATH='' + local SVG='' + local IMG='' + local PARENTDIR='' + local LOCATION='' + local EXTENSION='' + local FILTER='' + local FILES='' + + # Redefine absolute path to artwork's related translation entry. + render_getIdentityTranslationDir + + # Redefine absolute path to artwork's related design template + # directory. By default design templates are stored in the Tpl/ + # directory which is stored in the workplace's root. + render_getIdentityTemplateDir + + # Redefine absolute path to artwork's related final output + # directory. + render_getIdentityOutputDir + + # Redefine parent directory for current workplace. + PARENTDIR=$(basename $ACTIONVAL) + + # Redefine directory path used as reference to build the list of + # files that will be rendered. + render_getFilesList + + # Define which type of features does centos-art.sh script is able + # to perform. + for ACTION in "${BASEACTIONS[@]}"; do + + case $ACTION in + + renderText ) + # Provides text rendition feature. + render_doIdentityTexts + ;; + + renderImage ) + # Provides image rendition feature. + render_doIdentityImages + ;; + + esac + + done + +} diff --git a/Scripts/Bash/Functions/Render/render_getActions.sh b/Scripts/Bash/Functions/Render/render_getActions.sh index d078f27..cf84842 100644 --- a/Scripts/Bash/Functions/Render/render_getActions.sh +++ b/Scripts/Bash/Functions/Render/render_getActions.sh @@ -50,7 +50,7 @@ function render_getActions { ACTIONVAL="$2" # Redefine action name. - ACTIONNAM="${FUNCNAM}_getActionsIdentity" + ACTIONNAM="${FUNCNAM}_doIdentity" # Rotate positional parameters shift 2 diff --git a/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh b/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh deleted file mode 100755 index 874cf19..0000000 --- a/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh +++ /dev/null @@ -1,136 +0,0 @@ -#!/bin/bash -# -# render_getActionsIdentity.sh -- This function initiates rendition -# configuration functions and executes them to perform the rendition -# action specified in the `ACTIONS' array variable. Function -# initialization and execution is based on the absolute path -# convenction defined by ARTCONF variable. -# -# Copyright (C) 2009-2011 Alain Reguera Delgado -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -# USA. -# -# ---------------------------------------------------------------------- -# $Id$ -# ---------------------------------------------------------------------- - -function render_getActionsIdentity { - - # Check parent directory. Identity rendition takes place under - # trunk/Identity directory structure only. Be sure action value - # referes an identity directory structure before perform identity - # rendition. - if [[ ! $ACTIONVAL =~ "^$(cli_getRepoTLDir $ACTIONVAL)/Identity/.+$" ]];then - cli_printMessage "`eval_gettext "Can't do identity rendition at \\\`\\\$ACTIONVAL'."`" 'AsErrorLine' - cli_printMessage "$(caller)" "AsToKnowMoreLine" - fi - - # Define variables as local to avoid conflicts outside. - local ARTCOMP='' - - # Define default theme model to use. - local THEMEMODEL='Default' - - # Define default artworks matching list. The artworks matching - # list lets you customize how translation files are applied to - # design templates. When matching list is empty (the default - # value), translation files are applied to design templates - # sharing the same name (without the extension). This produces one - # translated design for each translation file available. - # Matching list definitions where translation files need to be - # applied to specific design templates are defined inside - # artwork-specific pre-rendition configuration scripts. - local MATCHINGLIST='' - - # Check current scripts path value. If scripts path points to a - # directory which currently doesn't exist there is nothing to do - # here, so leave a message quit script execution. - if [[ ! -d $ARTCONF ]];then - cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - - for FILE in $(find $ARTCONF -name 'render.conf.sh');do - - # Output action message. - cli_printMessage $FILE 'AsConfigurationLine' - cli_printMessage '-' 'AsSeparatorLine' - - # Define artwork-specific action arrays. We need to do this - # here because ACTIONS variable is unset after - # render_doIdentityImages execution. Otherwise, undesired - # concatenations may occur. - local -a ACTIONS - local -a BASEACTIONS - local -a POSTACTIONS - local -a LASTACTIONS - - # Initialize artwork-specific pre-rendition configuration - # (function) scripts. - . $FILE - - # Execute artwork-specific pre-rendition configuration - # (function) scripts to re-define artwork-specific ACTIONS and - # MATCHINGLIST variables. - render_loadConfig - - # Check variables passed from artwork-specific pre-rendition - # configuration scripts and make required transformations. - render_checkConfig - - # Redefine action value (ACTIONVAL) based on pre-rendition - # configuration script path value. Otherwise, massive - # rendition may fail. Functions like renderImage need to know - # the exact artwork path (that is, where images will be - # stored). - ACTIONVAL=$(dirname $(echo $FILE | sed -r \ - -e 's!Scripts/Bash/Functions/Render/Config/Identity/!Identity/!' \ - -e "s!Themes/!Themes/Motifs/$(cli_getThemeName)/!")) - - # Redefine artwork identification. - ARTCOMP=$(echo $ACTIONVAL | cut -d/ -f6-) - - # Remove motif name from artwork identification in order to - # reuse motif artwork identification. There is not need to - # create one artwork identification for each motif directory - # structure if we can reuse just one. - if [[ $ARTCOMP =~ "Themes/Motifs/$(cli_getThemeName)/" ]];then - ARTCOMP=$(echo $ARTCOMP | sed -r "s!Themes/Motifs/$(cli_getThemeName)/!Themes/!") - fi - - # Start rendition as defined in artwork-specific pre-rendition - # configuration file. - render_doIdentity - - # Unset artwork-specific actions so they can be redefined by - # artwork-specific pre-rendition configuration scripts. This - # is required in massive rendition. For example, if you say - # centos-art.sh to render the whole Distro directory it first - # renders Prompt entry, which defines the renderSyslinux - # post-rendition action, and later Progress entry which does - # not defines post-rendition actions. If we do not unset the - # ACTIONS variable, post-rendition actions defined in Prompt - # entry remain for Progress entry and that is not desired. We - # want ACTIONS to do what we exactly tell it to do inside each - # artwork-specific pre-rendition configuration script. - unset ACTIONS - unset BASEACTIONS - unset POSTACTIONS - unset LASTACTIONS - - done - -}