Blob Blame History Raw
@subheading Goals

This section provides the automation work line. The automation work
line exists to standardize content production in CentOS Artwork
Repository.  There is no need to type several tasks, time after time,
if they can be programmed into just one executable script.

In this section you'll find how to organize and extend the
@command{centos-art.sh} script, a bash scripts specially designed to
automate most frequent tasks in the repository (e.g., image rendition,
documenting directory structures, translating content, etc.).  If you
can't resist the idea of automating repeatable tasks, then take a look
here.

@subheading Description

The best way to understand @file{centos-art.sh} automation script is
studying its source code.  However, as start point, you may prefer to
read an introductory resume before diving into the source code
details.

The @file{centos-art.sh} script is written in Bash. Most tasks, inside
@file{centos-art.sh} script, have been organized in many specific
functionalities that you can invoke from the @command{centos-art}
command-line interface.

When you type the @command{centos-art} command in your terminal, the
operating system trys to execute that command. In order to execute the
command, the operating system needs to know where it is, so the
operating system uses the @var{PATH} environment variable to look for
that command location. If your system was prepared to use CentOS
Artwork Repository correctly (@pxref{Directories trunk Scripts
Functions Prepare}) you should have a symbolic link inside
@file{~/bin} directory that points to the @file{centos-art.sh} script
file. As @file{~/bin} directory is, by default, inside @var{PATH}
environment variable, the execution of @command{centos-art} command
runs the @file{centos-art.sh} script.

When @file{centos-art.sh} script is executed, the first it does is
initializing global variables (e.g., @command{gettext} variables) and
global function scripts.  Global function scripts are located inside
@file{trunk/Scripts/Functions} directory and their file names begin
with @samp{cli}. Global function scripts provide common
functionalities that can be used anywhere inside @file{centos-art.sh}
script execution environment.

Once global variables and function scripts have been loaded,
@file{centos-art.sh} script executes the @command{cli} global function
from @file{cli.sh} function script to retrive command-line arguments
and define some default values that may be used later by specific
function scripts (@pxref{Directories trunk Scripts Functions}).

As convenction, the @file{centos-art.sh} command-line arguments have
the following format:

@verbatim
centos-art function path/to/dir --option='value'
@end verbatim

In the above example, @samp{centos-art} is the command you use to
invoke @file{centos-art.sh} script. The @samp{arg1} is required and
represents the functionality you want to perform (e.g.,
@option{verify}, @option{render}, @option{locale}, @option{manual},
etc.). The remaining arguments are modifiers to @option{arg1}. The
@option{--arg2} definition is required and represets, specifically,
the action inside the functionality you want to perform.  The
@option{--arg3} and on, are optional.

Once command-line arguments have been retrived, the
@file{centos-art.sh} script loads specific functionalities using the
@file{cli_getFunctions.sh} function script. Only one specific
functionality can be loaded at one script execution I.e., you run
@command{centos-art.sh} script to run just one functionality.

@float Figure, Functionalities initialization
@verbatim
+----------------------------------------------------------------------+
| [centos@host]$ centos-art function path/to/dir --option='value'      |
+----------------------------------------------------------------------+
| ~/bin/centos-art --> ~/artwork/trunk/Scripts/centos-art.sh           |
+---v--------------------------------------------------------------v---+
    | centos-art.sh                                                |
    +-v--------------------------------------------------------v---+
    . | cli $@                                                 |   .
    . +-v--------------------------------------------------v---+   .
    . . | cli_getFunctions                                 |   .   .
    . . +-v-----------v-----------v-----------v------------+   .   .
    . . . | function1 | function2 | functionN |            .   .   .
    . . . +-----------+-----------+-----------+            .   .   .
    . . ....................................................   .   .
    . ..........................................................   .
    ................................................................
@end verbatim
@caption{Functionalities initialization environment.}
@end float

Functionalities are implemented by means of actions.  Once the
functionality has been initiazalized, actions initialization take
place for that functionality. Actions initialization model is very
similar to functions initialization model. But with the difference,
that actions are loaded inside function environment, and so, share
variables and functions defined inside function environment.

@float Figure, Actions initialization
@verbatim
+----------------------------------------------------------------------+
| cli_getFunctions                                                     |
+---v----------------------------v----v----------------------------v---+
.   | function1                  |    | function2                  |   .
.   +-v------------------------v-+    +-v------------------------v-+   .
.   . | function1_getArguments | .    . | function2_getArguments | .   .
.   . +-v--------------------v-+ .    . +-v--------------------v-+ .   .
.   . . | action 1           | . .    . . | action 1           | . .   .
.   . . | action 2           | . .    . . | action 2           | . .   .
.   . . | action N           | . .    . . | action N           | . .   .
.   . . +--------------------+ . .    . . +--------------------+ . .   .
.   . .......................... .    . .......................... .   .
.   ..............................    ..............................   .
........................................................................
@end verbatim
@caption{Actions initialization environment.}
@end float

@subheading Usage

The @file{centos-art.sh} script usage information is described inside
each specific function documentation (@pxref{Directories trunk Scripts
Functions}).

@subheading See also

@itemize
@item @ref{Directories trunk}
@end itemize