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
e3ad4e
provides the standard way of maintaining files inside your working
e3ad4e
copy 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
e3ad4e
Artwork Repository. Some of these maintainance tasks are updating top
e3ad4e
comments on shell scripts, creating table of contents for web pages,
e3ad4e
updating metadata related to design models and remove unused
e3ad4e
definitions on design models.
e3ad4e
e3ad4e
The maintainance tasks are associated to file extensions. This way,
e3ad4e
the @code{tuneup} functionality know what maintainance tasks should be
e3ad4e
applied to what files inside the working copy of CentOS Artwork
e3ad4e
Repository. For example, when you execute the @code{tuneup}
e3ad4e
functionality, it makes a list of files based on supported extensions
e3ad4e
(e.g., @file{.sh}, @file{.svg} and @file{.xhtml}) and apply
e3ad4e
maintainance tasks file by file accordingly to its file extension.
e3ad4e
e3ad4e
@subsubheading Maintaining @file{.sh} files
e3ad4e
e3ad4e
If shell scripts are found, the @code{tuneup} functionality reads a
e3ad4e
comment template
e3ad4e
(@file{trunk/Scripts/Functions/Prepare/Config/shell_topcomment.sed})
e3ad4e
and applies it to the shell scripts, 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
e3ad4e
In order for the comment template to be applied correctly, the shell
e3ad4e
script you write must have the following 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
e3ad4e
The comment template replaces all the lines between the
e3ad4e
@samp{Copyright} line (e.g., line 5) and the first separator line
e3ad4e
(e.g., line 9). Everything else in the file will remain immutable.
7c40cb
e3ad4e
From time to time, we use the @code{tuneup} functionality on the
e3ad4e
`trunk/Scripts' directory structure to update the copyright and
e3ad4e
license notice of all the shell scripts we have therein.
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
e3ad4e
using the file found absolute path, the workstation time information
e3ad4e
and the @command{centos-art.sh} script copyright 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}
e3ad4e
command-line interface.
7c40cb
e3ad4e
Frequently, we use the @code{tuneup} functionality on the
e3ad4e
@file{trunk/Identity/Models} and @file{trunk/Identity/Themes/Models}
e3ad4e
directory structure to update metadata and remove unused definitions
e3ad4e
from design models therein.
e3ad4e
e3ad4e
@subsubheading Maintaining @file{.xhtml} files
e3ad4e
e3ad4e
If web pages are found, the @code{tuneup} functionality transforms web
e3ad4e
page headings to make them accessible through a table of contents.
e3ad4e
The table of contents is expanded in place, wherever the @code{
e3ad4e
class="toc">} piece 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
e3ad4e
In order for the @code{tuneup} functionality to transform headings,
e3ad4e
you need to put headings in just one line using one of the following
e3ad4e
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
e3ad4e
@code{tuneup} functionality in order for the anchor elements to use
e3ad4e
the correct information.
7c40cb
e3ad4e
Frequently, we use the @code{tuneup} functionality on the
e3ad4e
@file{trunk/Identity/Webenv/App/Home} directory structure to update
e3ad4e
the heading information and the related table of contents of web pages
e3ad4e
therein.
397885
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
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