diff --git a/Scripts/Bash/Style/Tpl/sh-topcomment.sed b/Scripts/Bash/Style/Tpl/sh-topcomment.sed deleted file mode 100644 index a265970..0000000 --- a/Scripts/Bash/Style/Tpl/sh-topcomment.sed +++ /dev/null @@ -1,38 +0,0 @@ -# This file standardizes the look and feel of top comments used by -# scripts inside CentOS Artwork Repository. It contains the copyright -# note and the license under which the script is released. This files -# is used with the regular expression '.*\.sh$' only. -# --------------------------------------------------- -# $Id: svg-metadata-centos.sed 5962 2010-06-16 05:44:51Z al $ -# --------------------------------------------------- -/^# +Copyright .*$/a\ -# Copyright (C) 2009-2010 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.\ -# \ -#------------------------------------------------------------ - -# Remove previous comments. -/^# +Copyright .*$/,/^#-+$/{ -d -} - -# Remove more than one space after comments. -s/^# +/# / - -# Define first line -1c\ -#!/bin/bash diff --git a/Scripts/Bash/Style/Tpl/svg-metadata-al.sed b/Scripts/Bash/Style/Tpl/svg-metadata-al.sed deleted file mode 100644 index 8029ae6..0000000 --- a/Scripts/Bash/Style/Tpl/svg-metadata-al.sed +++ /dev/null @@ -1,68 +0,0 @@ -# This file is the personal metadata information used by Alain Reguera -# Delgado on his svg files. This files is used with the regular -# expression '.*\.svg$'. -# --------------------------------------------------- -# $Id: svg-metadata-al.sed 5964 2010-06-16 06:51:37Z al $ -# --------------------------------------------------- -/\ - \ - \ - image/svg+xml\ - \ - \ - The Modern Theme\ - 2010-06-15\ - \ - \ - Alain Reguera Delgado\ - \ - \ - \ - \ - Alain Reguera Delgado\ - \ - \ - \ - \ - The CentOS Project\ - \ - \ - \ - \ - \ - en\ - \ - \ -=KEYWORDS=\ - \ - \ - The CentOS Project\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - diff --git a/Scripts/Bash/Style/Tpl/svg-metadata-centos.sed b/Scripts/Bash/Style/Tpl/svg-metadata-centos.sed deleted file mode 100644 index 93b3ddb..0000000 --- a/Scripts/Bash/Style/Tpl/svg-metadata-centos.sed +++ /dev/null @@ -1,68 +0,0 @@ -# This file is the metadata information used by The CentOS Project -# entity on its svg files. This files is used with the regular -# expression '.*\.svg$' only. -# --------------------------------------------------- -# $Id: svg-metadata-centos.sed 5964 2010-06-16 06:51:37Z al $ -# --------------------------------------------------- -/\ - \ - \ - image/svg+xml\ - \ - \ - The CentOS Logo\ - 2010-06-15\ - \ - \ - The CentOS Project\ - \ - \ - \ - \ - The CentOS Project\ - \ - \ - \ - \ - The CentOS Project\ - \ - \ - \ - \ - \ - en\ - \ - \ -=KEYWORDS=\ - \ - \ - The CentOS Project\ - \ - \ - \ - Alain Reguera Delgado\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - diff --git a/Scripts/Bash/Style/renameFile.sh b/Scripts/Bash/Style/renameFile.sh deleted file mode 100755 index fc7cce1..0000000 --- a/Scripts/Bash/Style/renameFile.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# renameFiles.sh -- Rename files names, inside svn repository, -# massively. -# -# Copyright (C) 2009-2010 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: renameFile.sh 12 2010-09-10 09:55:08Z al $ -# ---------------------------------------------------------------------- - - -if [ ! $# = 4 ];then - cli_printMessage "`gettext "Syntax: ./update-filenames.sh "`" - exit; -fi - -ROOTDIR="$1" -FILTER="$2" -PATTERN="$3" -VALUE="$4" - -for FILE in `find $ROOTDIR -regex $FILTER`;do - DIR=`dirname $FILE` - FILE=`basename $FILE` - svn mv $DIR/$FILE $DIR/`echo $FILE | sed -r "s!$PATTERN!$VALUE!"` -done diff --git a/Scripts/Bash/Style/replaceInFiles.sh b/Scripts/Bash/Style/replaceInFiles.sh deleted file mode 100755 index 4f4df8c..0000000 --- a/Scripts/Bash/Style/replaceInFiles.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -# -# Use this script to update svg metadata information massively, based -# on one Tpl file. To use this script you need to be located inside -# the artwork component you want to update. For example if you want to -# update the svg metadata information used by CentOS Brands files, you -# type: -# -# cd ~/artwork/trunk/Identity/Brands -# -# first, and later -# -# ~/artwork/trunk/Scripts/Bash/Style/replaceInFiles '.*\.svg$' -# -# At this point you select the translation file you want to apply to -# all files matching the regular expression you defined as first -# argument ('.*\.svg$') in the above command. The svg metadata -# translation file used for CentOS Brands' svg file is: -# svg-metadata-centos.sed. Pick that and press return to go on. After -# that, if you are using subversion, use the following command to see -# changes: -# -# svn diff | less -# -# Note that inside trunk/Scripts/Bash/Style/Tpl directory you can find -# standard translation files that you can apply to files. In order to -# have the appropriate result, it is important that you know what -# translation file you apply to which file. As convenction each -# translation file inside the above location have a comment on the -# first lines describing which kind of files they apply to. -# -# Copyright (C) 2009-2010 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: replaceInFiles.sh 12 2010-09-10 09:55:08Z al $ -# ---------------------------------------------------------------------- - -REGEX=$1 -TRANSLATIONS=~/artwork/trunk/Scripts/Bash/Style/Tpl - -# Define translation file. -cli_printMessage "`gettext "Select the translation you want to apply:"`" -select TRANSLATION in $(ls $TRANSLATIONS);do - TRANSLATION=$TRANSLATIONS/$TRANSLATION - break -done - -# Check regular expression. -if [ $REGEX == '' ];then - cli_printMessage "`gettext "You need to provide a regular expression as first argument."`" - exit -fi - -# Check translation file. -if [ ! -f $TRANSLATION ];then - cli_printMessage "`gettext "You need to provide a valid translation file."`" - exit -fi - -# Define keywords using repo path as base. -PATH_KEYWORDS=$(pwd | cut -d/ -f6- | tr '/' '\n') - -# Redifine keywords using SVG standard format. -SVG_KEYWORDS=$(\ - for KEY in $PATH_KEYWORDS;do - echo " $KEY\\" - done) - -for FILE in $(find . -regextype posix-egrep -regex $REGEX);do - cli_printMessage $FILE "AsUpdatingLine" - sed -i -r -f $TRANSLATION $FILE - sed -i -r -e /=KEYWORDS=/c\\"$SVG_KEYWORDS" $FILE -done \ - | awk 'BEGIN {FS=": "} \ - { if ( $0 ~ /^-+$/ ) print $0; else \ - printf "%s: \t%s\n", $1, $2 }' diff --git a/Scripts/Bash/Styles/Tpl/sh-topcomment.sed b/Scripts/Bash/Styles/Tpl/sh-topcomment.sed new file mode 100644 index 0000000..a265970 --- /dev/null +++ b/Scripts/Bash/Styles/Tpl/sh-topcomment.sed @@ -0,0 +1,38 @@ +# This file standardizes the look and feel of top comments used by +# scripts inside CentOS Artwork Repository. It contains the copyright +# note and the license under which the script is released. This files +# is used with the regular expression '.*\.sh$' only. +# --------------------------------------------------- +# $Id: svg-metadata-centos.sed 5962 2010-06-16 05:44:51Z al $ +# --------------------------------------------------- +/^# +Copyright .*$/a\ +# Copyright (C) 2009-2010 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.\ +# \ +#------------------------------------------------------------ + +# Remove previous comments. +/^# +Copyright .*$/,/^#-+$/{ +d +} + +# Remove more than one space after comments. +s/^# +/# / + +# Define first line +1c\ +#!/bin/bash diff --git a/Scripts/Bash/Styles/Tpl/svg-metadata-al.sed b/Scripts/Bash/Styles/Tpl/svg-metadata-al.sed new file mode 100644 index 0000000..8029ae6 --- /dev/null +++ b/Scripts/Bash/Styles/Tpl/svg-metadata-al.sed @@ -0,0 +1,68 @@ +# This file is the personal metadata information used by Alain Reguera +# Delgado on his svg files. This files is used with the regular +# expression '.*\.svg$'. +# --------------------------------------------------- +# $Id: svg-metadata-al.sed 5964 2010-06-16 06:51:37Z al $ +# --------------------------------------------------- +/\ + \ + \ + image/svg+xml\ + \ + \ + The Modern Theme\ + 2010-06-15\ + \ + \ + Alain Reguera Delgado\ + \ + \ + \ + \ + Alain Reguera Delgado\ + \ + \ + \ + \ + The CentOS Project\ + \ + \ + \ + \ + \ + en\ + \ + \ +=KEYWORDS=\ + \ + \ + The CentOS Project\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + diff --git a/Scripts/Bash/Styles/Tpl/svg-metadata-centos.sed b/Scripts/Bash/Styles/Tpl/svg-metadata-centos.sed new file mode 100644 index 0000000..93b3ddb --- /dev/null +++ b/Scripts/Bash/Styles/Tpl/svg-metadata-centos.sed @@ -0,0 +1,68 @@ +# This file is the metadata information used by The CentOS Project +# entity on its svg files. This files is used with the regular +# expression '.*\.svg$' only. +# --------------------------------------------------- +# $Id: svg-metadata-centos.sed 5964 2010-06-16 06:51:37Z al $ +# --------------------------------------------------- +/\ + \ + \ + image/svg+xml\ + \ + \ + The CentOS Logo\ + 2010-06-15\ + \ + \ + The CentOS Project\ + \ + \ + \ + \ + The CentOS Project\ + \ + \ + \ + \ + The CentOS Project\ + \ + \ + \ + \ + \ + en\ + \ + \ +=KEYWORDS=\ + \ + \ + The CentOS Project\ + \ + \ + \ + Alain Reguera Delgado\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + diff --git a/Scripts/Bash/Styles/renameFile.sh b/Scripts/Bash/Styles/renameFile.sh new file mode 100755 index 0000000..fc7cce1 --- /dev/null +++ b/Scripts/Bash/Styles/renameFile.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# renameFiles.sh -- Rename files names, inside svn repository, +# massively. +# +# Copyright (C) 2009-2010 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: renameFile.sh 12 2010-09-10 09:55:08Z al $ +# ---------------------------------------------------------------------- + + +if [ ! $# = 4 ];then + cli_printMessage "`gettext "Syntax: ./update-filenames.sh "`" + exit; +fi + +ROOTDIR="$1" +FILTER="$2" +PATTERN="$3" +VALUE="$4" + +for FILE in `find $ROOTDIR -regex $FILTER`;do + DIR=`dirname $FILE` + FILE=`basename $FILE` + svn mv $DIR/$FILE $DIR/`echo $FILE | sed -r "s!$PATTERN!$VALUE!"` +done diff --git a/Scripts/Bash/Styles/replaceInFiles.sh b/Scripts/Bash/Styles/replaceInFiles.sh new file mode 100755 index 0000000..4f4df8c --- /dev/null +++ b/Scripts/Bash/Styles/replaceInFiles.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# +# Use this script to update svg metadata information massively, based +# on one Tpl file. To use this script you need to be located inside +# the artwork component you want to update. For example if you want to +# update the svg metadata information used by CentOS Brands files, you +# type: +# +# cd ~/artwork/trunk/Identity/Brands +# +# first, and later +# +# ~/artwork/trunk/Scripts/Bash/Style/replaceInFiles '.*\.svg$' +# +# At this point you select the translation file you want to apply to +# all files matching the regular expression you defined as first +# argument ('.*\.svg$') in the above command. The svg metadata +# translation file used for CentOS Brands' svg file is: +# svg-metadata-centos.sed. Pick that and press return to go on. After +# that, if you are using subversion, use the following command to see +# changes: +# +# svn diff | less +# +# Note that inside trunk/Scripts/Bash/Style/Tpl directory you can find +# standard translation files that you can apply to files. In order to +# have the appropriate result, it is important that you know what +# translation file you apply to which file. As convenction each +# translation file inside the above location have a comment on the +# first lines describing which kind of files they apply to. +# +# Copyright (C) 2009-2010 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: replaceInFiles.sh 12 2010-09-10 09:55:08Z al $ +# ---------------------------------------------------------------------- + +REGEX=$1 +TRANSLATIONS=~/artwork/trunk/Scripts/Bash/Style/Tpl + +# Define translation file. +cli_printMessage "`gettext "Select the translation you want to apply:"`" +select TRANSLATION in $(ls $TRANSLATIONS);do + TRANSLATION=$TRANSLATIONS/$TRANSLATION + break +done + +# Check regular expression. +if [ $REGEX == '' ];then + cli_printMessage "`gettext "You need to provide a regular expression as first argument."`" + exit +fi + +# Check translation file. +if [ ! -f $TRANSLATION ];then + cli_printMessage "`gettext "You need to provide a valid translation file."`" + exit +fi + +# Define keywords using repo path as base. +PATH_KEYWORDS=$(pwd | cut -d/ -f6- | tr '/' '\n') + +# Redifine keywords using SVG standard format. +SVG_KEYWORDS=$(\ + for KEY in $PATH_KEYWORDS;do + echo " $KEY\\" + done) + +for FILE in $(find . -regextype posix-egrep -regex $REGEX);do + cli_printMessage $FILE "AsUpdatingLine" + sed -i -r -f $TRANSLATION $FILE + sed -i -r -e /=KEYWORDS=/c\\"$SVG_KEYWORDS" $FILE +done \ + | awk 'BEGIN {FS=": "} \ + { if ( $0 ~ /^-+$/ ) print $0; else \ + printf "%s: \t%s\n", $1, $2 }'