Blame Scripts/Bash/Functions/Tuneup/tuneup.sh

878a2b
#!/bin/bash
878a2b
#
878a2b
# tuneup.sh -- This function standardizes maintainance tasks for files
878a2b
# inside the repository. Maintainance tasks are applied to files using
878a2b
# file extension as reference.
878a2b
#
03486a
# Copyright (C) 2009, 2010, 2011, 2012 The CentOS Project
878a2b
#
878a2b
# This program is free software; you can redistribute it and/or modify
878a2b
# it under the terms of the GNU General Public License as published by
878a2b
# the Free Software Foundation; either version 2 of the License, or (at
878a2b
# your option) any later version.
878a2b
#
878a2b
# This program is distributed in the hope that it will be useful, but
878a2b
# WITHOUT ANY WARRANTY; without even the implied warranty of
878a2b
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
878a2b
# General Public License for more details.
878a2b
#
878a2b
# You should have received a copy of the GNU General Public License
878a2b
# along with this program; if not, write to the Free Software
878a2b
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
878a2b
#
878a2b
# ----------------------------------------------------------------------
878a2b
# $Id$
878a2b
# ----------------------------------------------------------------------
878a2b
878a2b
function tuneup {
878a2b
878a2b
    local ACTIONNAM=''
878a2b
    local ACTIONVAL=''
878a2b
24ece8
    # Initialize name of rendition format as an empty value. The name
24ece8
    # of rendition format is determined automatically based on
878a2b
    # template file extension, later, when files are processed.
24ece8
    local TUNEUP_FORMAT=''
878a2b
24ece8
    # Initialize absolute path to format's base directory, the place
24ece8
    # where format-specific directories are stored in.
878a2b
    local TUNEUP_BASEDIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}"
878a2b
878a2b
    # Initialize list of supported file extensions. This is, the file
878a2b
    # extensions we want to perform maintainance tasks for.
878a2b
    local TUNEUP_EXTENSIONS='svg xhtml sh'
878a2b
878a2b
    # Interpret arguments and options passed through command-line.
878a2b
    tuneup_getOptions
878a2b
878a2b
    # Redefine positional parameters using ARGUMENTS. At this point,
878a2b
    # option arguments have been removed from ARGUMENTS variable and
878a2b
    # only non-option arguments remain in it. 
878a2b
    eval set -- "$ARGUMENTS"
878a2b
878a2b
    # Define action name. No matter what option be passed to
878a2b
    # centos-art, there is only one action to perform (i.e., build the
878a2b
    # list of files and interpretation of file extensions for further
878a2b
    # processing).
878a2b
    ACTIONNAM="tuneup_doBaseActions"
878a2b
878a2b
    # Define action value. We use non-option arguments to define the
878a2b
    # action value (ACTIONVAL) variable.
878a2b
    for ACTIONVAL in "$@";do
878a2b
        
878a2b
        # Check action value. Be sure the action value matches the
878a2b
        # convenctions defined for source locations inside the working
878a2b
        # copy.
878a2b
        ACTIONVAL=$(cli_checkRepoDirSource $ACTIONVAL)
878a2b
878a2b
        # Syncronize changes between repository and working copy. At
878a2b
        # this point, changes in the repository are merged in the
878a2b
        # working copy and changes in the working copy committed up to
878a2b
        # repository.
878a2b
        cli_syncroRepoChanges
878a2b
878a2b
        # Execute action name.
878a2b
        $ACTIONNAM
878a2b
878a2b
        # Syncronize changes between repository and working copy. At
878a2b
        # this point, changes in the repository are merged in the
878a2b
        # working copy and changes in the working copy committed up to
878a2b
        # repository.
878a2b
        cli_syncroRepoChanges
878a2b
878a2b
    done
878a2b
878a2b
}