@subheading Goals
This section describes the @code{tuneup} functionality of
@command{centos-art.sh} script and general examples about file
maintainance inside a working copy of CentOS Artwork Repository.
@subheading Description
The @code{tuneup} functionality of @command{centos-art.sh} script
provides the standard way of maintaining files inside the working copy
of CentOS Artwork Repository.
Tasks related to file maintainance are repetitive. You might find
yourself doing them time after time inside the working copy of CentOS
Artwork Repository. Some of these maintainance tasks do update top
comments on shell scripts, create table of contents for web pages,
update metadata related to design models and remove unused definitions
from design models.
When you execute the @code{tuneup} functionality of
@command{centos-art.sh} script, it looks for all files that match the
supported extensions (e.g., @file{.sh}, @file{.svg} and @file{.xhtml})
in the directory specified, builds a list with them and applies the
maintainance tasks using file extensions as reference.
@subsubheading Maintaining @file{.sh} files
If shell scripts are found, the @code{tuneup} functionality of
@command{centos-art.sh} script reads a comment template from
@file{trunk/Scripts/Functions/Prepare/Config/shell_topcomment.sed} and
applies it to shell scripts found, one by one. As result, all shell
scripts will end up having the same copyright and license information
the comment template does.
In order for the shell script top comment template to be applied
correctly, the shell scripts you write must have the following
structure:
@verbatim
1| #!/bin/bash
2| #
3| # doSomething.sh -- The function description goes here.
4| #
5| # Copyright
6| #
7| # ...
8| #
9| # ----------------------------------------------------------------------
10| # $Id$
11| # ----------------------------------------------------------------------
12|
13| function doSomething {
14|
15| }
@end verbatim
The @code{tuneup} functionality of @command{centos-art.sh} script
replaces all lines between the @samp{Copyright} line (e.g., line 5)
and the first separator line (e.g., line 9), inclusively. Everything
else in the file will remain immutable.
@subsubheading Maintaining @file{.svg} files
If scalable vector graphics are found, the @code{tuneup} functionality
reads a metadata template
(@file{trunk/Scripts/Functions/Tuneup/Config/svg_metadata.sed}) and
applies it to all files found, one by one. Immediatly after the
metadata template has been applied and, before passing to next file,
all unused definition are removed from file, too.
The metadata we apply from the metadata template is created dynamicaly
combining the file absolute path, the workstation time information and
the @command{centos-art.sh} script copyright holder information as
reference. Additionally, the @emph{Creative Common
Distribution-ShareAlike 3.0 License} is also set in the metadata.
The elimination of unused definitions inside SVG files takes place
through the @option{--vacuum-defs} option of @command{inkscape}
command-line interface which is described in its man page
(@command{man inkscape}).
@subsubheading Maintaining @file{.xhtml} files
If web pages are found, the @code{tuneup} functionality of
@command{centos-art.sh} script transforms web page headings to make
them accessible through a table of contents. The table of contents is
expanded in place, wherever the @code{<div class="toc"></div>} piece
of code be in the page.
Once the @code{<div class="toc"></div>} piece of code has be expanded,
there is no need to put anything else in the page. You can run the
@code{tuneup} functionality everytime you update the heading
information so as to update the table of contents, too.
In order for the @code{tuneup} functionality of
@command{centos-art.sh} script to transform headings, you need to put
headings in just one line using one of the following forms:
@verbatim
<h1><a name="">Title</a></h1>
<h1><a href="">Title</a></h1>
<h1><a name="" href="">Title</a></h1>
@end verbatim
In the example above, h1 can vary from h1 to h6. Closing tag must be
present and also match the openning tag. The value of @option{name}
and @option{href} options from the anchor element are set dynamically
using the md5sum output of combining the page location, the
@code{head-} string and the heading string. If any of the components
used to build the heading reference changes, you need to run the the
@code{tuneup} functionality of @command{centos-art.sh} script in order
for the anchor elements to use the correct information.
@subheading Usage
@subsubheading Synopsis
@command{centos-art tuneup [OPTIONS] path/to/dir}
@subsubheading Options
@table @option
@item --quiet
Supress all output messages, including confirmation question. Use this
option with care.
@item --filter='regex'
Reduce the amount of files to process using @samp{regex} as pattern.
@item --answer-yes
Assume `yes' to all confirmation questions.
@item --dont-commit-changes
Supress all @code{commit} and @code{update} actions realized over
files already processed, before and after the action itself had took
place in the working copy.
@end table
@subsubheading Examples
@table @command
@item centos-art tuneup trunk/Scripts
Update the copyright and license notice of all the shell scripts we
have in @file{trunk/Scripts} directory structure.
@item centos-art tuneup trunk/Identity/Models/Brands --filter="symbol"
Update metadata and remove unused definitions from all design models
in @file{trunk/Identity/Models/Brands} which have the word
@samp{symbol} in the file name.
@item centos-art tuneup trunk/Identity/Webenv/App/Home
Update headings and the related table of contents to all web pages
inside @file{trunk/Identity/Webenv/App/Home}, recusively.
@end table
@subheading See also
@itemize
@item @ref{Directories trunk Scripts Functions}
@item @ref{Directories trunk Scripts}
@item @ref{Directories trunk}
@end itemize