diff --git a/Scripts/Functions/Tuneup/Shell/shell.sh b/Scripts/Functions/Tuneup/Shell/shell.sh index 3dd3023..da719b2 100755 --- a/Scripts/Functions/Tuneup/Shell/shell.sh +++ b/Scripts/Functions/Tuneup/Shell/shell.sh @@ -25,9 +25,6 @@ function shell { - # Define backend-specific configuration directory. - local CONFIG_DIR="${TUNEUP_BACKEND_DIR}/$(cli_getRepoName ${TUNEUP_BACKEND} -d)/Config" - # Rebuild top comment inside shell scripts, mainly to update # copyright information. shell_doTopComment diff --git a/Scripts/Functions/Tuneup/Shell/shell_doTopComment.sh b/Scripts/Functions/Tuneup/Shell/shell_doTopComment.sh index 628b2c2..259e948 100755 --- a/Scripts/Functions/Tuneup/Shell/shell_doTopComment.sh +++ b/Scripts/Functions/Tuneup/Shell/shell_doTopComment.sh @@ -26,7 +26,7 @@ function shell_doTopComment { # Define absolute path to template file. - local TEMPLATE="${CONFIG_DIR}/topcomment.sed" + local TEMPLATE="${TUNEUP_CONFIG_DIR}/topcomment.sed" # Check template file existence. cli_checkFiles $TEMPLATE diff --git a/Scripts/Functions/Tuneup/Svg/svg.sh b/Scripts/Functions/Tuneup/Svg/svg.sh index 9420e07..b3e55d0 100755 --- a/Scripts/Functions/Tuneup/Svg/svg.sh +++ b/Scripts/Functions/Tuneup/Svg/svg.sh @@ -24,9 +24,6 @@ function svg { - # Define backend-specific configuration directory. - local CONFIG_DIR="${TUNEUP_BACKEND_DIR}/Svg/Config" - # Update metadata information. svg_doMetadata diff --git a/Scripts/Functions/Tuneup/Svg/svg_doMetadata.sh b/Scripts/Functions/Tuneup/Svg/svg_doMetadata.sh index 132cc0e..da58c2f 100755 --- a/Scripts/Functions/Tuneup/Svg/svg_doMetadata.sh +++ b/Scripts/Functions/Tuneup/Svg/svg_doMetadata.sh @@ -27,7 +27,7 @@ function svg_doMetadata { # Define template file name. - local TEMPLATE="${CONFIG_DIR}/metadata.sed" + local TEMPLATE="${TUNEUP_CONFIG_DIR}/metadata.sed" # Check template file existence. cli_checkFiles $TEMPLATE diff --git a/Scripts/Functions/Tuneup/Xhtml/xhtml.sh b/Scripts/Functions/Tuneup/Xhtml/xhtml.sh index 28567ef..201401a 100755 --- a/Scripts/Functions/Tuneup/Xhtml/xhtml.sh +++ b/Scripts/Functions/Tuneup/Xhtml/xhtml.sh @@ -25,9 +25,6 @@ function xhtml { - # Define backend-specific configuration directory. - local CONFIG_DIR="${TUNEUP_BACKEND_DIR}/Xhtml/Config" - # Transforms xhtml headings to make them accessible (e.g., through # a table of contents). xhtml_doToc diff --git a/Scripts/Functions/Tuneup/Xhtml/xhtml_doToc.sh b/Scripts/Functions/Tuneup/Xhtml/xhtml_doToc.sh index c697530..314a310 100755 --- a/Scripts/Functions/Tuneup/Xhtml/xhtml_doToc.sh +++ b/Scripts/Functions/Tuneup/Xhtml/xhtml_doToc.sh @@ -58,7 +58,7 @@ function xhtml_doToc { # Define table of content configuration file, the file used to # produce the table of content XHTML output code. - local TOC_CONFIG=${CONFIG_DIR}/toc.awk + local TOC_CONFIG=${TUNEUP_CONFIG_DIR}/toc.awk # Verify table of content configuration file. cli_checkFiles ${TOC_CONFIG} diff --git a/Scripts/Functions/Tuneup/tuneup.sh b/Scripts/Functions/Tuneup/tuneup.sh index 644f69b..b4a9efb 100755 --- a/Scripts/Functions/Tuneup/tuneup.sh +++ b/Scripts/Functions/Tuneup/tuneup.sh @@ -36,7 +36,7 @@ function tuneup { # Initialize absolute path to backend's base directory, the place # where backend-specific directories are stored in. - local TUNEUP_BACKEND_DIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}" + local TUNEUP_BASEDIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}" # Initialize list of supported file extensions. This is, the file # extensions we want to perform maintainance tasks for. diff --git a/Scripts/Functions/Tuneup/tuneup_doBaseActions.sh b/Scripts/Functions/Tuneup/tuneup_doBaseActions.sh index 087587f..232ee5c 100755 --- a/Scripts/Functions/Tuneup/tuneup_doBaseActions.sh +++ b/Scripts/Functions/Tuneup/tuneup_doBaseActions.sh @@ -26,6 +26,9 @@ function tuneup_doBaseActions { + local TUNEUP_CONFIG_DIR='' + local TUNEUP_BACKEND_DIR='' + local TUNEUP_BACKEND_INIT='' local TUNEUP_EXTENSION='' local FILE='' local FILES='' @@ -36,18 +39,29 @@ function tuneup_doBaseActions { # Loop through list of supported file extensions. for TUNEUP_EXTENSION in ${TUNEUP_EXTENSIONS};do - # Redefine name of tuneup backend based on supported file - # extension. - if [[ $TUNEUP_EXTENSION == 'svg' ]];then - TUNEUP_BACKEND='svg' - elif [[ $TUNEUP_EXTENSION == 'xhtml' ]];then - TUNEUP_BACKEND='xhtml' - elif [[ $TUNEUP_EXTENSION == 'sh' ]];then - TUNEUP_BACKEND='shell' - else - cli_printMessage "`gettext "No file to tune up found."`" --as-error-line + # Define backend name based on supported file extensions. + TUNEUP_BACKEND="${TUNEUP_EXTENSION}" + + # Define absolute path to directory where backend-specific + # functionalities are stored in. + TUNEUP_BACKEND_DIR="${TUNEUP_BASEDIR}/$(cli_getRepoName \ + ${TUNEUP_BACKEND} -d)" + + # Define absolute path to backend initialization script. + TUNEUP_BACKEND_INIT="${TUNEUP_BACKEND_DIR}/$(cli_getRepoName ${TUNEUP_BACKEND} -f)" + + # Verify absolute path to backend initialization script. When + # a file extension is provided, but no backend initialization + # script exists for it, continue with the next file extension + # in the list. + if [[ ! -f ${TUNEUP_BACKEND_INIT} ]];then + continue fi + # Define absolute path to directory where backend-specific + # configurations are retrived from. + TUNEUP_CONFIG_DIR="${TUNEUP_BACKEND_DIR}/Config" + # Build list of files to process using action value as # reference. FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${TUNEUP_EXTENSION}") @@ -58,22 +72,23 @@ function tuneup_doBaseActions { continue fi - # Initialize backend-specific functionalities. - cli_exportFunctions "${TUNEUP_BACKEND_DIR}/$(cli_getRepoName \ + # Export backend-specific functionalities up to the + # execution environment. + cli_exportFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \ ${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}" - # Apply backend-specific maintainance tasks. + # Execute backend-specific maintainance tasks. for FILE in $FILES;do cli_printMessage "$FILE" --as-tuningup-line ${TUNEUP_BACKEND} done - # Unset backend-specific functionalities from environment. - # This is required to prevent end up with more than one - # backend-specifc function initialization, in those cases when - # different template files are rendered in just one execution - # of `centos-art.sh' script. - cli_unsetFunctions "${TUNEUP_BACKEND_DIR}/$(cli_getRepoName \ + # Unset backend-specific functionalities from execution + # environment. This is required to prevent end up with more + # than one backend-specifc function initialization, in those + # cases when different template files are rendered in just one + # execution of `centos-art.sh' script. + cli_unsetFunctions "${TUNEUP_BASEDIR}/$(cli_getRepoName \ ${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}" done