From 03a4b47cc75e9ad2fc33e253857573fac80b10f2 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Feb 17 2011 17:38:34 +0000 Subject: Update svg functionality. --- diff --git a/Scripts/Bash/Functions/Svg/svg.sh b/Scripts/Bash/Functions/Svg/svg.sh index de12065..8ae161e 100755 --- a/Scripts/Bash/Functions/Svg/svg.sh +++ b/Scripts/Bash/Functions/Svg/svg.sh @@ -26,9 +26,6 @@ function svg { - # Define variables. - local FILES='' - # Define command-line interface. svg_getActions diff --git a/Scripts/Bash/Functions/Svg/svg_getActions.sh b/Scripts/Bash/Functions/Svg/svg_getActions.sh index 2120ca0..62c5588 100755 --- a/Scripts/Bash/Functions/Svg/svg_getActions.sh +++ b/Scripts/Bash/Functions/Svg/svg_getActions.sh @@ -30,7 +30,7 @@ function svg_getActions { local ARGSS="" # Define long options we want to support. - local ARGSL="update-metadata:,vacuum-defs:,filter:" + local ARGSL="update-metadata:,vacuum-defs:" # Parse arguments using getopt(1) command parser. cli_doParseArguments @@ -49,37 +49,11 @@ function svg_getActions { # Define action value. ACTIONVAL="$2" - # 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. ACTIONNAM="${FUNCNAM}_updateMetadata" - # Look for sub-options passed through command-line. - while true; do - - case "$3" in - - --filter ) - - # Redefine regular expression. - FLAG_FILTER="$4" - - # Rotate positional parameters. - shift 4 - ;; - - * ) - # Break sub-options loop. - break - ;; - esac - done - - # Break options loop. - break + # Rotate positional parameters. + shift 2 ;; --vacuum-defs ) @@ -87,37 +61,11 @@ function svg_getActions { # Define action value. ACTIONVAL="$2" - # 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. ACTIONNAM="${FUNCNAM}_vacuumDefs" - # Look for sub-options passed through command-line. - while true; do - - case "$3" in - - --filter ) - - # Redefine regular expression. - FLAG_FILTER="$4" - - # Rotate positional parameters. - shift 4 - ;; - - * ) - # Break sub-options loop. - break - ;; - esac - done - - # Break options loop. - break + # Rotate positional parameters. + shift 2 ;; * ) @@ -126,21 +74,25 @@ function svg_getActions { esac done - # Verify action value variable. - if [[ $ACTIONVAL == '' ]];then - cli_printMessage "$(caller)" 'AsToKnowMoreLine' - fi + # Check action value. Be sure the action value matches the + # convenctions defined for source locations inside the working + # copy. + cli_checkRepoDirSource - # Re-define regular expression to match scalable vector graphic - # files only. - FLAG_FILTER=$(echo "${FLAG_FILTER}.*\.(svgz|svg)") + # Syncronize changes between the working copy and the central + # repository to bring down changes. + cli_commitRepoChanges # 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 "`gettext "A valid action is required."`" 'AsErrorLine' cli_printMessage "$(caller)" 'AsToKnowMoreLine' fi + # Syncronize changes between the working copy and the central + # repository to commit up changes. + cli_commitRepoChanges + } diff --git a/Scripts/Bash/Functions/Svg/svg_updateMetadata.sh b/Scripts/Bash/Functions/Svg/svg_updateMetadata.sh index c2f1e1f..971b0c1 100755 --- a/Scripts/Bash/Functions/Svg/svg_updateMetadata.sh +++ b/Scripts/Bash/Functions/Svg/svg_updateMetadata.sh @@ -29,12 +29,14 @@ function svg_updateMetadata { - local TEMPLATES='' - local INSTANCE='' - local COUNT=0 local NAM='' local URL='' local KEYS='' + local FILE='' + local COUNT=0 + local FILES='' + local INSTANCE='' + local TEMPLATES='' local -a TITLE local -a VALUE local -a PATTERN @@ -144,10 +146,15 @@ function svg_updateMetadata { done - # Define list of files to process. + # Redefine filter flag to specify the extension of scalable vector + # graphics files we want to update metadata in. Use action value + # as reference to find out different shell files. + FLAG_FILTER=".*${FLAG_FILTER}.*\.(svgz|svg)" + + # Build list of files to process. cli_getFilesList - # Process list of files. + # Process list of scalable vector graphics. for FILE in $FILES;do # Output action message. @@ -223,17 +230,13 @@ function svg_updateMetadata { sed -i -f $INSTANCE $FILE # Remove template instance. - cli_checkFiles "${INSTANCE}" 'f' - rm $INSTANCE + if [[ -f $INSTANCE ]];then + rm $INSTANCE + fi # Sanitate scalable vector graphic. sed -i -r '/^[[:space:]]*$/d' $FILE - done \ - | awk -f /home/centos/artwork/trunk/Scripts/Bash/Styles/output_forTwoColumns.awk - - # Check repository changes and ask you to commit them up to - # central repository. - cli_commitRepoChanges + done } diff --git a/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh b/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh index bd177b7..5de56e6 100755 --- a/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh +++ b/Scripts/Bash/Functions/Svg/svg_vacuumDefs.sh @@ -26,7 +26,15 @@ function svg_vacuumDefs { - # Define list of files to process. + local FILE='' + local FILES='' + + # Redefine filter flag to specify the extension of scalable vector + # graphics files we want to update metadata in. Use action value + # as reference to find out different shell files. + FLAG_FILTER=".*${FLAG_FILTER}.*\.(svgz|svg)" + + # Build list of files to process. cli_getFilesList # Process list of files. @@ -40,8 +48,4 @@ function svg_vacuumDefs { done - # Check repository changes and ask user to commit them up to - # central repository. - cli_commitRepoChanges - }