Blame Scripts/CentOS-Art/Functions/Render/render.sh

4c79b5
#!/bin/bash
4c79b5
#
ab1d67
# render.sh -- This function initializes rendition variables and
294842
# actions to centos-art.sh script.
4c79b5
#
2fe9b7
# Copyright (C) 2009, 2010, 2011 The CentOS Project
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
4c79b5
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4c79b5
# General Public License for more details.
4c79b5
#
4c79b5
# You should have received a copy of the GNU General Public License
4c79b5
# along with this program; if not, write to the Free Software
dcd347
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7ac5a5
#
4c79b5
# ----------------------------------------------------------------------
418249
# $Id$
4c79b5
# ----------------------------------------------------------------------
4c79b5
ab1d67
function render {
4c79b5
d538ed
    local ACTIONNAM=''
4d7186
    local ACTIONVAL=''
4d7186
61bb5b
    # Initialize `--releasever' option. The release version option
61bb5b
    # controls the release number used to produce release-specific
fa3fc3
    # content.  By default, the release number of The CentOS
fa3fc3
    # Distribution you have installed in your workstation is used.
fa3fc3
    local FLAG_RELEASEVER=$(cat /etc/redhat-release \
fa3fc3
        | gawk '{ print $3 }')
15b1d2
61bb5b
    # Initialize `--basearch' option. The base architecture option
61bb5b
    # controls the architecture type used to produce
fa3fc3
    # architecture-specific content.  By default, the hardware
fa3fc3
    # platform of your workstation is used.
fa3fc3
    local FLAG_BASEARCH=$(uname -i)
c9f7fa
61bb5b
    # Initialize `--theme-model' option. The theme model option
61bb5b
    # specifies the the theme model name used to produce theme
61bb5b
    # artistic motifs.
294842
    local FLAG_THEME_MODEL='Default'
294842
af80d5
    # Initialize `--post-rendition' option. This option defines what
af80d5
    # command to use as post-rendition. Post-rendition takes palce
af80d5
    # over base-rendition output.
af80d5
    local FLAG_POSTRENDITION=''
b463d6
af80d5
    # Initialize `--last-rendition' option. This option defines what
af80d5
    # command to use as last-rendition. Last-rendition takes palce
af80d5
    # once both base-rendition and post-rendition has been performed
af80d5
    # in the same directory structure.
af80d5
    local FLAG_LASTRENDITION=''
61bb5b
af80d5
    # Initialize `--dont-dirspecific' option. This option can take two
af80d5
    # values only (e.g., `true' or `false') and controls whether to
af80d5
    # perform or not directory-specific rendition.  Directory-specific
af80d5
    # rendition may use any of the three types of renditions (e.g.,
af80d5
    # base-rendition, post-rendition and last-rendition) to accomplish
af80d5
    # specific tasks when specific directory structures are detected
af80d5
    # in the rendition flow. By default, the centos-art.sh script
af80d5
    # performs directory-specific rendition.
af80d5
    local FLAG_DONT_DIRSPECIFIC='false'
b463d6
195960
    # Initialize `--with-brands' option. This option controls whether
195960
    # to brand output images or not. By default output images are not
195960
    # branded.
195960
    local FLAG_WITH_BRANDS='false'
195960
8e58dd
    # Initialize name of rendition backend as an empty value. The name
8e58dd
    # of rendition backend is determined automatically based on
8e58dd
    # template file extension, later, at rendition time. 
8e58dd
    local RENDER_BACKEND=''
8e58dd
8e58dd
    # Initialize absolute path to backend's base directory, the place
8e58dd
    # where backend-specific directories are stored in.
903cf1
    local RENDER_BACKEND_DIR="${CLI_FUNCDIR}/${CLI_FUNCDIRNAM}"
8e58dd
4591de
    # Initialize list of supported file extensions. These file
4591de
    # extensions are used by design model files, the files used as
4591de
    # base-rendition input. In order for design model files to be
4591de
    # correclty rendered, they must end with one of the file
4591de
    # extensions listed here.
4591de
    local RENDER_EXTENSIONS='svg docbook'
69a31c
49237e
    # Interpret arguments and options passed through command-line.
8c13b6
    render_getOptions
4c79b5
49237e
    # Redefine positional parameters using ARGUMENTS. At this point,
49237e
    # option arguments have been removed from ARGUMENTS variable and
49237e
    # only non-option arguments remain in it. 
49237e
    eval set -- "$ARGUMENTS"
49237e
eb2554
    # Define action value. We use non-option arguments to define the
eb2554
    # action value (ACTIONVAL) variable.
49237e
    for ACTIONVAL in "$@";do
49237e
        
49237e
        # Check action value. Be sure the action value matches the
49237e
        # convenctions defined for source locations inside the working
49237e
        # copy.
aa540b
        ACTIONVAL=$(cli_checkRepoDirSource "$ACTIONVAL")
49237e
49237e
        # Syncronize changes between repository and working copy. At
49237e
        # this point, changes in the repository are merged in the
49237e
        # working copy and changes in the working copy committed up to
49237e
        # repository.
49237e
        cli_syncroRepoChanges
49237e
69a31c
        # Define renderable directories and the way they are produced.
69a31c
        # To describe the way renderable directories are produced, we
69a31c
        # take the action value (ACTIONVAL) as reference and describe
4591de
        # the production through an action name (ACTIONNAM).
cff13a
        if [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images/Themes" ]];then
8c13b6
            ACTIONNAM="render_doThemeActions"
cff13a
        elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Identity/Images" ]];then
8c13b6
            ACTIONNAM="render_doBaseActions"
4c60a0
        elif [[ $ACTIONVAL =~ "^$(cli_getRepoTLDir)/Manuals" ]];then
8c13b6
            ACTIONNAM="render_doBaseActions"
cff13a
        else
16a67e
            cli_printMessage "`gettext "The path provided doesn't support rendition."`" --as-error-line
cff13a
        fi
cff13a
d538ed
        # Execute action name.
69a31c
        ${ACTIONNAM}
49237e
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
49237e
49237e
    done
49237e
4c79b5
}