diff --git a/Scripts/Bash/Functions/Render/render.sh b/Scripts/Bash/Functions/Render/render.sh index 5ff73d1..85e1a33 100644 --- a/Scripts/Bash/Functions/Render/render.sh +++ b/Scripts/Bash/Functions/Render/render.sh @@ -30,12 +30,6 @@ function render { # Define rendering variables. local RELEASE_FORMAT='[[:digit:]]+(\.[[:digit:]]+){,1}' - # Re-define root directory used to load pre-rendering - # configuration scripts based on action value. - local ARTCONF=$(echo "$ACTIONVAL" \ - | sed -r -e 's!/(Identity|Translations)!/Scripts/Bash/Functions/Render/Config/\1!' \ - -e "s!Motifs/$(cli_getThemeName)/?!!") - # Define rendering actions. render_getActions diff --git a/Scripts/Bash/Functions/Render/render_doIdentity.sh b/Scripts/Bash/Functions/Render/render_doIdentity.sh index 3ee0ffe..9850fbe 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentity.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentity.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# render_doIdentity.sh -- This function provides identity -# rendering features for centos-art.sh script. +# render_doIdentity.sh -- This function initiates rendering features +# taking BASEACTIONS as reference. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # @@ -36,27 +36,27 @@ function render_doIdentity { local FILTER='' local FILES='' - # Re-define absolute path to artwork's related translation entry. + # Redefine absolute path to artwork's related translation entry. render_getIdentityTranslationDir - # Re-define absolute path to artwork's related design template + # 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 - # Re-define absolute path to artwork's related final output + # Redefine absolute path to artwork's related final output # directory. render_getIdentityOutputDir - # Re-define parent directory for current workplace. + # Redefine parent directory for current workplace. PARENTDIR=$(basename $ACTIONVAL) - # Re-define directory path used as reference to build the list of + # 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 performs. + # to perform. for ACTION in "${BASEACTIONS[@]}"; do case $ACTION in @@ -73,6 +73,6 @@ function render_doIdentity { esac - done + done } diff --git a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh index d7b921f..b71761a 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityGroupByType.sh @@ -81,7 +81,7 @@ function render_doIdentityGroupByType { # Define file types for last-rendering action. FORMATS=$2 else - cli_printMessage "`gettext "groupByType: Wrong invokation."`" + cli_printMessage "`gettext "groupByType: Wrong invokation."`" 'AsErrorLine' cli_printMessage $(caller) "AsToKnowMoreLine" fi @@ -92,7 +92,7 @@ function render_doIdentityGroupByType { # Check file types passed from render.conf.sh pre-rendering # configuration script. if [[ "$FORMATS" == "" ]];then - cli_printMessage "`gettext "There is no file type information to process."`" + cli_printMessage "`gettext "There is no file type information to process."`" 'AsErrorLine' cli_printMessage $(caller) "AsToKnowMoreLine" fi diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImageDm.sh b/Scripts/Bash/Functions/Render/render_doIdentityImageDm.sh index f89dad5..45a7eee 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityImageDm.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImageDm.sh @@ -69,7 +69,7 @@ function render_doIdentityImageDm { elif [[ $DM =~ '^KDE$' ]];then TPL=/home/centos/artwork/trunk/Identity/Themes/Models/${THEMEMODEL}/Distro/BootUp/KDM else - cli_printMessage "`eval_gettext "The display manager \\\"\\\$DM\\\" is not supported."`" + cli_printMessage "`eval_gettext "The display manager \\\`\\\$DM' is not supported."`" 'AsErrorLine' cli_printMessage "$(caller)" 'AsToKnowMoreLine' fi @@ -82,7 +82,7 @@ function render_doIdentityImageDm { # Check sanitated screen resolutions. if [[ "$RESOLUTIONS" == '' ]];then - cli_printMessage "`gettext "There is no resolution information to process."`" + cli_printMessage "`gettext "There is no resolution information to process."`" 'AsErrorLine' cli_printMessage $(caller) "AsToKnowMoreLine" fi @@ -96,7 +96,7 @@ function render_doIdentityImageDm { # Check release numbers list. if [[ "$VERSIONS" == '' ]];then - cli_printMessage "`gettext "There is no release number to work with"`" + cli_printMessage "`gettext "There is no release number to work with"`" 'AsErrorLine' cli_printMessage "$(caller)" 'AsToKnowMoreLine' fi diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh b/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh index af01728..48d6535 100755 --- a/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImageKsplash.sh @@ -32,7 +32,7 @@ function render_doIdentityImageKsplash { local KSPLASH_TOP='' local KSPLASH_PREVIEW='' local RELDIRS=$(find $ACTIONVAL -regextype posix-egrep -maxdepth 1 \ - -type d -regex "^.*/$RELEASE_FORMAT$" | egrep $REGEX) + -type d -regex "^.*/${RELEASE_FORMAT}$" | egrep $REGEX) # Define font file used to render Preview.png bottom text. local KSPLASH_PREVIEW_FONT=/home/centos/artwork/trunk/Identity/Fonts/Ttf/DejaVuLGCSans-Bold.ttf diff --git a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh index 56885a3..4f77825 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityImages.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityImages.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# render_doIdentityImages.sh -- This function provides image -# rendering feature to centos-art.sh script. +# render_doIdentityImages.sh -- This function renders image-based +# identity contents. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # diff --git a/Scripts/Bash/Functions/Render/render_doIdentityTextFormats.sh b/Scripts/Bash/Functions/Render/render_doIdentityTextFormats.sh index 5d13fdb..ae179cc 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityTextFormats.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityTextFormats.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# render_doIdentityTextFormats.sh -- This function give format to +# render_doIdentityTextFormats.sh -- This function gives format to # text files. # # Copyright (C) 2009, 2010 Alain Reguera Delgado @@ -26,9 +26,12 @@ function render_doIdentityTextFormats { - # Get file path. + # Define file path. local FILE="$1" + # Define temporal file path. + local TMPFILE=$(cli_getTemporalFile "${FILE}") + # Get action to do over text file. local OPTIONS=$(render_getConfOption "$2" '2-') @@ -48,8 +51,8 @@ function render_doIdentityTextFormats { # Apply OPTIONS to plain text files. Doing the same with html # (and similar) files can mess up the markup, so apply format # options to plain text only. - cat $FILE | fmt $(echo -n "$OPTIONS") > ${FILE}.fmt - mv ${FILE}.fmt $FILE + cat $FILE | fmt $(echo -n "$OPTIONS") > ${TMPFILE} + mv ${TMPFILE} ${FILE} ;; esac diff --git a/Scripts/Bash/Functions/Render/render_doIdentityTexts.sh b/Scripts/Bash/Functions/Render/render_doIdentityTexts.sh index 568eaaa..da10214 100644 --- a/Scripts/Bash/Functions/Render/render_doIdentityTexts.sh +++ b/Scripts/Bash/Functions/Render/render_doIdentityTexts.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# render_doIdentityTexts.sh -- This function provides text rendering -# feature to centos-art.sh script. +# render_doIdentityTexts.sh -- This function renders text-based +# identity contents. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # diff --git a/Scripts/Bash/Functions/Render/render_getActions.sh b/Scripts/Bash/Functions/Render/render_getActions.sh index d05e442..30cab21 100644 --- a/Scripts/Bash/Functions/Render/render_getActions.sh +++ b/Scripts/Bash/Functions/Render/render_getActions.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# render_getActions.sh -- This function initializes documentation -# functionalities, using action value as reference. +# render_getActions.sh -- This function interprets arguments passed to +# render functionality and calls actions accordingly. # # Copyright (C) 2009, 2010 Alain Reguera Delgado # @@ -26,43 +26,89 @@ function render_getActions { - # Evaluate action name and define which actions does centos-art.sh - # script supports. - case $ACTIONNAM in + # Define short options we want to support. + local ARGSS="d:f:" - --directory ) + # Define long options we want to support. + local ARGSL="directory:,filter:" - if [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then + # Parse arguments using getopt(1) command parser. + cli_doParseArguments - # Define identity rendering support. - render_getActionsIdentity + # Reset positional parameters using output from (getopt) argument + # parser. + eval set -- "$ARGUMENTS" - elif [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then + # Look for options passed through command-line. + while true; do - # Define translation rendering support. - render_getActionsTranslations + case "$1" in - else + -d|--directory ) - cli_printMessage "`gettext "The path provided can't be processed."`" 'AsErrorLine' - cli_printMessage "$(caller)" 'AsToKnowMoreLine' + # Define action value. + ACTIONVAL="$2" - fi - ;; + # Check action value. Be sure the action value matches + # the convenctions defined for source locations inside + # the working copy. + cli_checkRepoDirSource - * ) + # Define action name using action value as reference. + if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/.+$" ]];then + ACTIONNAM="${FUNCNAM}_getActionsIdentity" + elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Translations/.+$" ]];then + ACTIONNAM="${FUNCNAM}_getActionsTranslations" + else + cli_printMessage "`eval_gettext "Cannot process the path \\\`\\\$ACTIONVAL'."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi - cli_printMessage "`gettext "The option provided is not valid."`" 'AsErrorLine' + # Look for sub-options passed through command-line. + while true; do + case "$3" in + -f|--filter ) + # Redefine regular expression. + REGEX="$4" + # Rotate positional parameters + shift 4 + ;; + * ) + # Break sub-options loop. + break + ;; + esac + done - if [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Identity/.+$' ]];then - cli_printMessage "$ACTIONVAL" 'AsToKnowMoreLine' - elif [[ $ACTIONVAL =~ '^/home/centos/artwork/(trunk|branches|tags)/Translations/.+$' ]];then - cli_printMessage "$ACTIONVAL" 'AsToKnowMoreLine' - else - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi - ;; + # Break options loop. + break + ;; - esac + * ) + # Break options loop. + break + esac + done + + # Verify action value variable. + if [[ $ACTIONVAL == '' ]];then + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi + + # Redefine pre-rendering configuration directory. Pre-rendering + # configuration directory is where we store render.conf.sh + # scripts. The render.conf.sh scripts define how each artwork is + # rendered. + local ARTCONF=$(echo "$ACTIONVAL" \ + | sed -r -e 's!/(Identity|Translations)!/Scripts/Bash/Functions/Render/Config/\1!' \ + -e "s!Motifs/$(cli_getThemeName)/?!!") + + # Execute action name. + if [[ $ACTIONNAM =~ "^${FUNCNAM}_[A-Za-z]+$" ]];then + eval $ACTIONNAM + else + cli_printMessage "`eval_gettext "A valid action is required."`" 'AsErrorLine' + cli_printMessage "$(caller)" 'AsToKnowMoreLine' + fi } diff --git a/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh b/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh index 543991e..7eacb4a 100755 --- a/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh +++ b/Scripts/Bash/Functions/Render/render_getActionsIdentity.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# render_getActionsIdentity.sh -- This function initializes rendering +# render_getActionsIdentity.sh -- This function initiates rendering # configuration functions and executes them to perform the rendering -# action specified in the variable `$ACTIONS[0]'. Function +# action specified in the `ACTIONS' array variable. Function # initialization and execution is based on the absolute path # convenction defined by ARTCONF variable. # @@ -42,7 +42,7 @@ function render_getActionsIdentity { # 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 be defined inside + # applied to specific design templates are defined inside # artwork-specific pre-rendering configuration scripts. local MATCHINGLIST='' @@ -62,7 +62,8 @@ function render_getActionsIdentity { # Define artwork-specific action arrays. We need to do this # here because ACTIONS variable is unset after - # render_doIdentityImages execution. + # render_doIdentityImages execution. Otherwise, undesired + # concatenations may occur. local -a ACTIONS local -a BASEACTIONS local -a POSTACTIONS @@ -81,20 +82,22 @@ function render_getActionsIdentity { # configuration scripts and make required transformations. render_checkConfig - # Re-define action value (ACTIONVAL) based on pre-rendering - # configuration script path value. Otherwise massive rendering - # may fail. Functions like renderImage need to know the exact - # artwork path (that is, where images will be stored). + # Redefine action value (ACTIONVAL) based on pre-rendering + # configuration script path value. Otherwise, massive + # rendering 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)/!")) - # Re-define artwork identification. + # 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. + # 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 @@ -103,7 +106,7 @@ function render_getActionsIdentity { # configuration file. render_doIdentity - # Unset artwork-specific actions so they can be re-defined by + # Unset artwork-specific actions so they can be redefined by # artwork-specific pre-rendering configuration scripts. This # is required in massive rendering. For example, if you say # centos-art.sh to render the whole Distro directory it first diff --git a/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh b/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh index b79ebff..3e8abb7 100755 --- a/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh +++ b/Scripts/Bash/Functions/Render/render_getActionsTranslations.sh @@ -43,8 +43,8 @@ function render_getActionsTranslations { # processing already has render.conf.sh configuration scripts, # inside its trunk/Scripts/Bash/Config/... asociated strucutre. If # such directory entry exists, the translation rendering should - # end immediatly on at this point because it is surely not a - # release-specif translation rendering. + # end immediatly at this point because it is surely not a + # release-specific translation rendering. if [[ -d $ARTCONF ]];then for FILE in $(find $ARTCONF -name 'render.conf.sh');do # Initialize configuration function. @@ -52,13 +52,13 @@ function render_getActionsTranslations { # Execute configuration function render_loadConfig done - # In this point, an entry inside trunk/Scripts/Bash/Config/... + # At this point, an entry inside trunk/Scripts/Bash/Config/... # was found for the directory being processed. If the # render.conf.sh files were there, they were executed. Because # render.conf.sh has to do with very specificy translation # rendering features (e.g., brands translation rendering), # that doesn't match release-specifc rendering translation - # (the one done after this block), we need to end the + # (the one done after this block). So, we need to end the # translation rendering right here. cli_printMessage "$(caller)" "AsToKnowMoreLine" fi @@ -77,7 +77,7 @@ function render_getActionsTranslations { local TRANSLATION='' local FILE='' - # Define warnning message about the nature of release notes + # Define warning message about the nature of release notes # translation files. This message is included in the very top of # every translation file. local MESSAGE="\ @@ -97,7 +97,7 @@ function render_getActionsTranslations { # release-specific directories. Otherwise, all release-specific # translations directories available in the current location will # be affected. - if [[ $REGEX =~ "^$RELEASE_FORMAT$" ]];then + if [[ $REGEX =~ "^${RELEASE_FORMAT}$" ]];then RELEASES=$ACTIONVAL/$REGEX # Re-define releases using regular expression value. If you need @@ -105,7 +105,7 @@ function render_getActionsTranslations { # 5, 5.1, 5.2, and 6.0), you can use a command similar to # 'centos-art render --translation=./ --filter=5,5.1,5.2,6.0' to # create them all using just one command. - elif [[ $REGEX =~ "^($RELEASE_FORMAT,?)+" ]];then + elif [[ $REGEX =~ "^(${RELEASE_FORMAT},?)+" ]];then for RELEASE in $(echo $REGEX | tr ',' ' ');do RELEASES="$RELEASES $RELEASE" done @@ -114,7 +114,7 @@ function render_getActionsTranslations { # use them all. else RELEASES=$(find $ACTIONVAL -regextype posix-egrep \ - -regex "^$ACTIONVAL/$RELEASE_FORMAT$" | sort) + -regex "^${ACTIONVAL}/${RELEASE_FORMAT}$" | sort) fi # At this point, if there isn't release-specific directories diff --git a/Scripts/Bash/Functions/Render/render_getFilesList.sh b/Scripts/Bash/Functions/Render/render_getFilesList.sh index 505f9ad..ba9870f 100644 --- a/Scripts/Bash/Functions/Render/render_getFilesList.sh +++ b/Scripts/Bash/Functions/Render/render_getFilesList.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# render_getFilesList.sh -- This function re-defines list of -# files that will be rendered using matching list and translation path +# render_getFilesList.sh -- This function redefines the list of files +# that will be rendered using matching list and translation path # information as reference. # # Copyright (C) 2009, 2010 Alain Reguera Delgado @@ -27,31 +27,6 @@ function render_getFilesList { - # Define short options we want to support. - local ARGSS="" - - # Define long options we want to support. - local ARGSL="filter:" - - # Parse arguments using getopt(1) command parser. - cli_doParseArguments - - # Reset positional parameters using output from (getopt) argument - # parser. - eval set -- "$ARGUMENTS" - - # Define action to take for each option passed. - while true; do - case "$1" in - --filter ) - REGEX="$2" - shift 2 - ;; - * ) - break - esac - done - # Define source location to look files for. In order to define # source location we evaluate both matching list and translation # path information, and based on them, we set which is the source diff --git a/Scripts/Bash/Functions/Render/render_getIdentityDefs.sh b/Scripts/Bash/Functions/Render/render_getIdentityDefs.sh index 270ccac..d7e1eaf 100644 --- a/Scripts/Bash/Functions/Render/render_getIdentityDefs.sh +++ b/Scripts/Bash/Functions/Render/render_getIdentityDefs.sh @@ -41,10 +41,10 @@ function render_getIdentityDefs { TRANSLATION=`gettext "None"` fi - # Check translation file existence. This may seems silly + # Check translation file existence. This may seem unnecessary # because we already built the file list using existent files. - # But what happen if any of the files already loaded are - # removed after being loaded? well, just skip it. + # But what happen if any of the files already loaded are removed + # after being loaded? well, just skip it. if [[ "$TRANSLATION" == 'None' ]];then cli_printMessage "`gettext "None"`" "AsTranslationLine" else @@ -184,8 +184,9 @@ function render_getIdentityDefs { # Possible configuration 2.1: If not design template was found # with the .svg extension, lets try design template without - # extension. This configuration is useful for when rendering - # some plain text files. + # extension. This configuration is useful for rendering plain + # text files that doesn't use an extension (e.g., see inside + # `trunk/Identity/Release' directory structure). # # template: \ # translation1.sed \ @@ -235,8 +236,7 @@ function render_getIdentityDefs { # prevent an empty template from being used. It is a missing # assignment definition in the pre-rendering script surely. if [[ "$TEMPLATE" == '' ]];then - cli_printMessage "`eval_gettext "No template defined for \\\$FILE."`" - cli_printMessage "`gettext "Check the matching list (render_getIdentityMatchinglist) script."`" + cli_printMessage "`eval_gettext "There is no design template defined for \\\`\\\$FILE'."`" 'AsErrorLine' cli_printMessage "$(caller)" "AsToKnowMoreLine" fi @@ -270,7 +270,7 @@ function render_getIdentityDefs { fi fi - # Re-define design template using absolute path. + # Redefine design template using absolute path. if [[ -f $SVG/$(basename $TEMPLATE) ]];then # Generally, template files are stored one level inside # Tpl/ directory. diff --git a/Scripts/Bash/Functions/Render/render_getIdentityOutputDir.sh b/Scripts/Bash/Functions/Render/render_getIdentityOutputDir.sh index d337c53..8232add 100644 --- a/Scripts/Bash/Functions/Render/render_getIdentityOutputDir.sh +++ b/Scripts/Bash/Functions/Render/render_getIdentityOutputDir.sh @@ -30,13 +30,10 @@ function render_getIdentityOutputDir { # under identity entry structure. IMG=$ACTIONVAL - # But if Img/ directory exists, use it instead. + # But if Img/ or Txt/ directory exists, use it instead. if [[ -d $ACTIONVAL/Img ]]; then IMG=$ACTIONVAL/Img - fi - - # But if Txt/ directory exists, use it instead. - if [[ -d $ACTIONVAL/Txt ]]; then + elif [[ -d $ACTIONVAL/Txt ]]; then IMG=$ACTIONVAL/Txt fi