Blame Scripts/Functions/Tuneup/tuneup.sh

9f1608
#!/bin/bash
9f1608
#
1a6676
# tuneup.sh -- This function standardizes maintainance tasks for files
1a6676
# inside the repository. Maintainance tasks are applied to files using
1a6676
# file extension as reference.
9f1608
#
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
9f1608
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9f1608
# General Public License for more details.
9f1608
#
9f1608
# You should have received a copy of the GNU General Public License
9f1608
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
9f1608
# ----------------------------------------------------------------------
9f1608
# $Id$
9f1608
# ----------------------------------------------------------------------
9f1608
66b51c
function tuneup {
9f1608
66b51c
    local ACTIONNAM=''
66b51c
    local ACTIONVAL=''
9f1608
1a6676
    # Initialize name of rendition backend as an empty value. The name
1a6676
    # of rendition backend is determined automatically based on
1a6676
    # template file extension, later, when files are processed.
1a6676
    local TUNEUP_BACKEND=''
1a6676
1a6676
    # Initialize absolute path to backend's base directory, the place
1a6676
    # where backend-specific directories are stored in.
903cf1
    local TUNEUP_BACKEND_DIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}"
13ac0d
a6bab3
    # Initialize list of supported file extensions. This is, the file
a6bab3
    # extensions we want to perform maintainance tasks for.
a6bab3
    local TUNEUP_EXTENSIONS='svg xhtml sh'
a6bab3
66b51c
    # Interpret arguments and options passed through command-line.
1bd8df
    tuneup_getOptions
ffdd74
66b51c
    # Redefine positional parameters using ARGUMENTS. At this point,
66b51c
    # option arguments have been removed from ARGUMENTS variable and
66b51c
    # only non-option arguments remain in it. 
1a9d63
    eval set -- "$ARGUMENTS"
1a9d63
66b51c
    # Define action name. No matter what option be passed to
66b51c
    # centos-art, there is only one action to perform (i.e., build the
66b51c
    # list of files and interpretation of file extensions for further
66b51c
    # processing).
5a5b08
    ACTIONNAM="${CLI_FUNCNAME}_doBaseActions"
1a9d63
66b51c
    # Define action value. We use non-option arguments to define the
66b51c
    # action value (ACTIONVAL) variable.
66b51c
    for ACTIONVAL in "$@";do
66b51c
        
66b51c
        # Check action value. Be sure the action value matches the
66b51c
        # convenctions defined for source locations inside the working
66b51c
        # copy.
75e135
        ACTIONVAL=$(cli_checkRepoDirSource $ACTIONVAL)
1a9d63
66b51c
        # Syncronize changes between repository and working copy. At
66b51c
        # this point, changes in the repository are merged in the
66b51c
        # working copy and changes in the working copy committed up to
66b51c
        # repository.
66b51c
        cli_syncroRepoChanges
1a9d63
66b51c
        # Execute action name.
a6bab3
        $ACTIONNAM
1a9d63
3906a2
        # Syncronize changes between repository and working copy. At
3906a2
        # this point, changes in the repository are merged in the
3906a2
        # working copy and changes in the working copy committed up to
3906a2
        # repository.
3906a2
        cli_syncroRepoChanges
1a9d63
1a9d63
    done
1a9d63
9f1608
}