Blame Scripts/Functions/Tuneup/tuneup_doBaseActions.sh

66b51c
#!/bin/bash
66b51c
#
66b51c
# tuneup_doBaseActions.sh -- This function builds the list of files to
66b51c
# process, determines the their extensions and performs maintainance
66b51c
# tasks file by file them accordingly.
66b51c
#
66b51c
# Copyright (C) 2009-2011 Alain Reguera Delgado
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
fa95b1
# the Free Software Foundation; either version 2 of the License, or
fa95b1
# (at your option) any later version.
fa95b1
#
66b51c
# This program is distributed in the hope that it will be useful, but
66b51c
# 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
66b51c
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
66b51c
# USA.
66b51c
# ----------------------------------------------------------------------
66b51c
# $Id$
66b51c
# ----------------------------------------------------------------------
66b51c
66b51c
function tuneup_doBaseActions {
66b51c
66b51c
    local FILE=''
66b51c
    local FILES=''
66b51c
    local EXTENSION=''
66b51c
66b51c
    # Define file extensions we'll look files for. This is, the
66b51c
    # extension of files we want to perform maintainance tasks for.
66b51c
    EXTENSION='(svg|xhtml|sh)'
66b51c
66b51c
    # Build list of files to process using action value as reference.
566f5e
    FILES=$(cli_getFilesList "${ACTIONVAL}" "${FLAG_FILTER}.*\.${EXTENSION}")
66b51c
66b51c
    # Verify list of files.
66b51c
    cli_printActionPreamble "$FILES" '' ''
66b51c
be7de3
    # Print separator line.
be7de3
    cli_printMessage '-' 'AsSeparatorLine'
be7de3
66b51c
    # Process list of files and perform maintainance tasks
66b51c
    # accordingly.
66b51c
    for FILE in $FILES;do
66b51c
0a3f74
        # Print action message.
0a3f74
        cli_printMessage $FILE 'AsTunningLine'
0a3f74
66b51c
        if [[ $FILE =~ '\.svg$' ]];then
66b51c
            ${FUNCNAM}_doSvg
66b51c
        elif [[ $FILE =~ '\.xhtml$' ]];then
66b51c
            ${FUNCNAM}_doXhtml
66b51c
        elif [[ $FILE =~ '\.sh$' ]];then
66b51c
            ${FUNCNAM}_doShell
66b51c
        fi
66b51c
66b51c
    done
66b51c
66b51c
}