From 2a08b71700f33f9015ec7387784092428da17c85 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Jun 11 2011 01:12:31 +0000 Subject: Update `svg' backend in `tuneup' functionality. --- diff --git a/Scripts/Functions/Tuneup/Backends/Svg/svg.sh b/Scripts/Functions/Tuneup/Backends/Svg/svg.sh index ed1caa9..d386ada 100755 --- a/Scripts/Functions/Tuneup/Backends/Svg/svg.sh +++ b/Scripts/Functions/Tuneup/Backends/Svg/svg.sh @@ -1,7 +1,6 @@ #!/bin/bash # -# tuneup_svg.sh -- This function performs maintainance tasks for -# SVG files. +# svg.sh -- This function standardizes maintainance of SVG files. # # Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG # @@ -23,12 +22,15 @@ # $Id$ # ---------------------------------------------------------------------- -function tuneup_svg { +function svg { + + # Define backend-specific configuration directory. + TUNEUP_BACKEND_CONFIG="${TUNEUP_BACKEND_DIR}/$(cli_getRepoName ${TUNEUP_BACKEND} -d)/Config" # Update metadata information. - tuneup_svg_doMetadata + ${TUNEUP_BACKEND}_doMetadata # Remove all unused items. - tuneup_svg_doUnusedItems + ${TUNEUP_BACKEND}_doUnusedItems } diff --git a/Scripts/Functions/Tuneup/Backends/Svg/svg_doMetadata.sh b/Scripts/Functions/Tuneup/Backends/Svg/svg_doMetadata.sh index c48aee2..9c13063 100755 --- a/Scripts/Functions/Tuneup/Backends/Svg/svg_doMetadata.sh +++ b/Scripts/Functions/Tuneup/Backends/Svg/svg_doMetadata.sh @@ -1,8 +1,8 @@ #!/bin/bash # -# tuneup_doSvgMetadata.sh -- This function updates metadata values -# inside scalable vector graphic (SVG) files using The CentOS Project -# default values. +# svg_doMetadata.sh -- This function updates metadata values inside +# scalable vector graphic (SVG) files using default values from The +# CentOS Project. # # Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG # @@ -24,29 +24,24 @@ # $Id$ # ---------------------------------------------------------------------- -function tuneup_doSvgMetadata { - - local NAM='' - local URL='' - local KEYS='' - local INSTANCE='' - local TEMPLATES='' +function svg_doMetadata { # Define template file name. - TEMPLATE="${FUNCCONFIG}/svg_metadata.sed" + local CONFIG_TEMPLATE="${TUNEUP_BACKEND_CONFIG}/$(cli_getRepoName ${TUNEUP_BACKEND} -f)_metadata.sed" # Check template file existence. - cli_checkFiles $TEMPLATE + cli_checkFiles $CONFIG_TEMPLATE # Build title from file path. - NAM=$(basename "$FILE") + local TITLE=$(basename "$FILE") # Build url from file path. - URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!') + local URL=$(echo $FILE | sed 's!/home/centos!https://projects.centos.org/svn!') # Build keywords from file path. Do not include filename, it is # already on title. - KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n') + local KEY='' + local KEYS=$(dirname "$FILE" | cut -d/ -f6- | tr '/' '\n') # Build keywords using SVG standard format. Note that this # information is inserted inside template file. The template file @@ -61,10 +56,10 @@ function tuneup_doSvgMetadata { done) # Redefine template instance file name. - INSTANCE=$(cli_getTemporalFile $TEMPLATE) + local INSTANCE=$(cli_getTemporalFile $CONFIG_TEMPLATE) - # Create template instance. - cp $TEMPLATE $INSTANCE + # Create instance. + cp $CONFIG_TEMPLATE $INSTANCE # Check template instance. We cannot continue if the template # instance couldn't be created. @@ -72,7 +67,7 @@ function tuneup_doSvgMetadata { # Expand translation markers inside template instance. sed -r -i \ - -e "s!=TITLE=!$NAM!" \ + -e "s!=TITLE=!$TITLE!" \ -e "s!=URL=!$URL!" \ -e "s!=DATE=!$(date "+%Y-%m-%d")!" $INSTANCE sed -i -r "/=KEYWORDS=/c\\${KEYS}" $INSTANCE diff --git a/Scripts/Functions/Tuneup/Backends/Svg/svg_doUnusedItems.sh b/Scripts/Functions/Tuneup/Backends/Svg/svg_doUnusedItems.sh index 8b1aa52..978e8fb 100755 --- a/Scripts/Functions/Tuneup/Backends/Svg/svg_doUnusedItems.sh +++ b/Scripts/Functions/Tuneup/Backends/Svg/svg_doUnusedItems.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# tuneup_svg_doUnusedItems.sh -- This function removes all unused items -# from the defs section of the SVG file. +# svg_doUnusedItems.sh -- This function removes all unused items from +# the defs section of the SVG file. # # Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG # @@ -23,7 +23,7 @@ # $Id$ # ---------------------------------------------------------------------- -function tuneup_svg_doUnusedItems { +function svg_doUnusedItems { # Vacuum unused svg definition using inkscape. inkscape --vacuum-defs $FILE &> /dev/null