Blame Manual/Directories/trunk/Scripts/Functions/Tuneup.texi

397885
@subheading Goals
397885
e3ad4e
This section describes the @code{tuneup} functionality of
e3ad4e
@command{centos-art.sh} script and general examples about file
e3ad4e
maintainance inside a working copy of CentOS Artwork Repository.
397885
397885
@subheading Description
397885
e3ad4e
The @code{tuneup} functionality of @command{centos-art.sh} script
950de4
provides the standard way of maintaining files inside the working copy
950de4
of CentOS Artwork Repository.
e3ad4e
e3ad4e
Tasks related to file maintainance are repetitive. You might find
e3ad4e
yourself doing them time after time inside the working copy of CentOS
950de4
Artwork Repository. Some of these maintainance tasks do update top
950de4
comments on shell scripts, create table of contents for web pages,
950de4
update metadata related to design models and remove unused definitions
950de4
from design models.
950de4
950de4
When you execute the @code{tuneup} functionality of
950de4
@command{centos-art.sh} script, it looks for all files that match the
950de4
supported extensions (e.g., @file{.sh}, @file{.svg} and @file{.xhtml})
950de4
in the directory specified, builds a list with them and applies the
950de4
maintainance tasks using file extensions as reference.
e3ad4e
e3ad4e
@subsubheading Maintaining @file{.sh} files
e3ad4e
950de4
If shell scripts are found, the @code{tuneup} functionality of
950de4
@command{centos-art.sh} script reads a comment template from
950de4
@file{trunk/Scripts/Functions/Prepare/Config/shell_topcomment.sed} and
950de4
applies it to shell scripts found, one by one. As result, all shell
e3ad4e
scripts will end up having the same copyright and license information
e3ad4e
the comment template does.
e3ad4e
950de4
In order for the shell script top comment template to be applied
950de4
correctly, the shell scripts you write must have the following
950de4
structure:
7c40cb
7c40cb
@verbatim
7c40cb
 1| #!/bin/bash
7c40cb
 2| #
7c40cb
 3| # doSomething.sh -- The function description goes here.
7c40cb
 4| # 
7c40cb
 5| # Copyright
7c40cb
 6| #
7c40cb
 7| # ...
7c40cb
 8| #
7c40cb
 9| # ----------------------------------------------------------------------
7c40cb
10| # $Id$
7c40cb
11| # ----------------------------------------------------------------------
7c40cb
12|
7c40cb
13| function doSomething {
7c40cb
14|     
7c40cb
15| }
7c40cb
@end verbatim
7c40cb
950de4
The @code{tuneup} functionality of @command{centos-art.sh} script
950de4
replaces all lines between the @samp{Copyright} line (e.g., line 5)
950de4
and the first separator line (e.g., line 9), inclusively. Everything
950de4
else in the file will remain immutable.
7c40cb
e3ad4e
@subsubheading Maintaining @file{.svg} files
7c40cb
e3ad4e
If scalable vector graphics are found, the @code{tuneup} functionality
e3ad4e
reads a metadata template
e3ad4e
(@file{trunk/Scripts/Functions/Tuneup/Config/svg_metadata.sed}) and
e3ad4e
applies it to all files found, one by one. Immediatly after the
e3ad4e
metadata template has been applied and, before passing to next file,
e3ad4e
all unused definition are removed from file, too.
7c40cb
e3ad4e
The metadata we apply from the metadata template is created dynamicaly
950de4
combining the file absolute path, the workstation time information and
950de4
the @command{centos-art.sh} script copyright holder information as
e3ad4e
reference.  Additionally, the @emph{Creative Common
e3ad4e
Distribution-ShareAlike 3.0 License} is also set in the metadata.
7c40cb
e3ad4e
The elimination of unused definitions inside SVG files takes place
e3ad4e
through the @option{--vacuum-defs} option of @command{inkscape}
950de4
command-line interface which is described in its man page
950de4
(@command{man inkscape}).
7c40cb
e3ad4e
@subsubheading Maintaining @file{.xhtml} files
e3ad4e
950de4
If web pages are found, the @code{tuneup} functionality of
950de4
@command{centos-art.sh} script transforms web page headings to make
950de4
them accessible through a table of contents.  The table of contents is
950de4
expanded in place, wherever the @code{
} piece
950de4
of code be in the page. 
7c40cb
e3ad4e
Once the @code{
} piece of code has be expanded,
e3ad4e
there is no need to put anything else in the page. You can run the
e3ad4e
@code{tuneup} functionality everytime you update the heading
e3ad4e
information so as to update the table of contents, too.
e3ad4e
950de4
In order for the @code{tuneup} functionality of
950de4
@command{centos-art.sh} script to transform headings, you need to put
950de4
headings in just one line using one of the following forms:
e3ad4e
e3ad4e
@verbatim
e3ad4e

Title

e3ad4e

Title

e3ad4e

Title

7c40cb
@end verbatim
7c40cb
e3ad4e
In the example above, h1 can vary from h1 to h6. Closing tag must be
e3ad4e
present and also match the openning tag. The value of @option{name}
e3ad4e
and @option{href} options from the anchor element are set dynamically
e3ad4e
using the md5sum output of combining the page location, the
e3ad4e
@code{head-} string and the heading string.  If any of the components
e3ad4e
used to build the heading reference changes, you need to run the the
950de4
@code{tuneup} functionality of @command{centos-art.sh} script in order
950de4
for the anchor elements to use the correct information.
7c40cb
397885
@subheading Usage
397885
e3ad4e
@subsubheading Synopsis
e3ad4e
e3ad4e
@command{centos-art tuneup [OPTIONS] path/to/dir}
e3ad4e
e3ad4e
@subsubheading Options
e3ad4e
e3ad4e
@table @option
e3ad4e
@item --quiet
e3ad4e
Supress all output messages, including confirmation question. Use this
e3ad4e
option with care.
e3ad4e
@item --filter='regex'
e3ad4e
Reduce the amount of files to process using @samp{regex} as pattern.
e3ad4e
@item --answer-yes
e3ad4e
Assume `yes' to all confirmation questions.
e3ad4e
@item --dont-commit-changes
e3ad4e
Supress all @code{commit} and @code{update} actions realized over
e3ad4e
files already processed, before and after the action itself had took
e3ad4e
place in the working copy.
e3ad4e
@end table
397885
dbcb80
@subsubheading Examples
dbcb80
dbcb80
@table @command
dbcb80
@item centos-art tuneup trunk/Scripts
dbcb80
dbcb80
Update the copyright and license notice of all the shell scripts we
dbcb80
have in @file{trunk/Scripts} directory structure.
dbcb80
dbcb80
@item centos-art tuneup trunk/Identity/Models/Brands --filter="symbol"
dbcb80
Update metadata and remove unused definitions from all design models
dbcb80
in @file{trunk/Identity/Models/Brands} which have the word
dbcb80
@samp{symbol} in the file name.
dbcb80
dbcb80
@item centos-art tuneup trunk/Identity/Webenv/App/Home
dbcb80
Update headings and the related table of contents to all web pages
dbcb80
inside @file{trunk/Identity/Webenv/App/Home}, recusively.
dbcb80
@end table
dbcb80
397885
@subheading See also
397885
397885
@itemize
e3ad4e
@item @ref{Directories trunk Scripts Functions}
e3ad4e
@item @ref{Directories trunk Scripts}
e3ad4e
@item @ref{Directories trunk}
397885
@end itemize