|
|
66b51c |
#!/bin/bash
|
|
|
66b51c |
#
|
|
|
66b51c |
# tuneup_doBaseActions.sh -- This function builds the list of files to
|
|
|
8b1490 |
# process and performs maintainance tasks, file by file.
|
|
|
66b51c |
#
|
|
|
3b0984 |
# Copyright (C) 2009, 2010, 2011 The CentOS Artwork SIG
|
|
|
fa95b1 |
#
|
|
|
fa95b1 |
# This program is free software; you can redistribute it and/or modify
|
|
|
fa95b1 |
# it under the terms of the GNU General Public License as published by
|
|
|
dcd347 |
# the Free Software Foundation; either version 2 of the License, or (at
|
|
|
dcd347 |
# your option) any later version.
|
|
|
fa95b1 |
#
|
|
|
74a058 |
# This program is distributed in the hope that it will be useful, but
|
|
|
74a058 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
66b51c |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
66b51c |
# General Public License for more details.
|
|
|
66b51c |
#
|
|
|
66b51c |
# You should have received a copy of the GNU General Public License
|
|
|
66b51c |
# along with this program; if not, write to the Free Software
|
|
|
dcd347 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
7ac5a5 |
#
|
|
|
66b51c |
# ----------------------------------------------------------------------
|
|
|
66b51c |
# $Id$
|
|
|
66b51c |
# ----------------------------------------------------------------------
|
|
|
66b51c |
|
|
|
66b51c |
function tuneup_doBaseActions {
|
|
|
66b51c |
|
|
|
66b51c |
# Define file extensions we'll look files for. This is, the
|
|
|
66b51c |
# extension of files we want to perform maintainance tasks for.
|
|
|
ec4ed8 |
local EXTENSION='(svg|xhtml|sh)'
|
|
|
66b51c |
|
|
|
66b51c |
# Build list of files to process using action value as reference.
|
|
|
ec4ed8 |
local FILE=''
|
|
|
ec4ed8 |
local FILES=$(cli_getFilesList ${ACTIONVAL} --pattern="${FLAG_FILTER}\.${EXTENSION}")
|
|
|
66b51c |
|
|
|
be7de3 |
# Print separator line.
|
|
|
4a423a |
cli_printMessage '-' --as-separator-line
|
|
|
be7de3 |
|
|
|
66b51c |
# Process list of files and perform maintainance tasks
|
|
|
66b51c |
# accordingly.
|
|
|
66b51c |
for FILE in $FILES;do
|
|
|
66b51c |
|
|
|
0a3f74 |
# Print action message.
|
|
|
4a423a |
cli_printMessage "$FILE" --as-tuningup-line
|
|
|
0a3f74 |
|
|
|
ec4ed8 |
# Redefine name of tuneup backend based on the file extension
|
|
|
ec4ed8 |
# of file being processed.
|
|
|
66b51c |
if [[ $FILE =~ '\.svg$' ]];then
|
|
|
ec4ed8 |
TUNEUP_BACKEND='svg'
|
|
|
66b51c |
elif [[ $FILE =~ '\.xhtml$' ]];then
|
|
|
ec4ed8 |
TUNEUP_BACKEND='xhtml'
|
|
|
66b51c |
elif [[ $FILE =~ '\.sh$' ]];then
|
|
|
ec4ed8 |
TUNEUP_BACKEND='shell'
|
|
|
66b51c |
fi
|
|
|
66b51c |
|
|
|
ec4ed8 |
# Initialize backend-specific functionalities.
|
|
|
ec4ed8 |
cli_exportFunctions "${TUNEUP_BACKEND_DIR}/$(cli_getRepoName \
|
|
|
ec4ed8 |
${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}"
|
|
|
ec4ed8 |
|
|
|
ec4ed8 |
# Perform backend base-rendition.
|
|
|
ec4ed8 |
${TUNEUP_BACKEND}
|
|
|
ec4ed8 |
|
|
|
ec4ed8 |
# Unset backend-specific functionalities from environment.
|
|
|
ec4ed8 |
# This is required to prevent end up with more than one
|
|
|
ec4ed8 |
# backend-specifc function initialization, in those cases when
|
|
|
ec4ed8 |
# different template files are rendered in just one execution
|
|
|
ec4ed8 |
# of `centos-art.sh' script.
|
|
|
ec4ed8 |
cli_unsetFunctions "${TUNEUP_BACKEND_DIR}/$(cli_getRepoName \
|
|
|
ec4ed8 |
${TUNEUP_BACKEND} -d)" "${TUNEUP_BACKEND}"
|
|
|
ec4ed8 |
|
|
|
66b51c |
done
|
|
|
66b51c |
|
|
|
66b51c |
}
|