Goals
-----

This section describes the tuneup functionality of centos-art.sh script and general examples about file maintainance inside a working copy of CentOS Artwork Repository.

Description
-----------

The tuneup functionality of centos-art.sh script provides the standard way of maintaining files inside your 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 are updating top comments on shell scripts, creating table of contents for web pages, updating metadata related to design models and remove unused definitions on design models.

The maintainance tasks are associated to file extensions. This way, the tuneup functionality know what maintainance tasks should be applied to what files inside the working copy of CentOS Artwork Repository. For example, when you execute the tuneup functionality, it makes a list of files based on supported extensions (e.g., .sh, .svg and .xhtml) and apply maintainance tasks file by file accordingly to its file extension.

Maintaining .sh files
.....................

If shell scripts are found, the tuneup functionality reads a comment template (trunk/Scripts/Functions/Prepare/Config/shell_topcomment.sed) and applies it to the shell scripts, 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 comment template to be applied correctly, the shell script you write must have the following structure:

 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| }

The comment template replaces all the lines between the Copyright line (e.g., line 5) and the first separator line (e.g., line 9). Everything else in the file will remain immutable.

Maintaining .svg files
......................

If scalable vector graphics are found, the tuneup functionality reads a metadata template (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 using the file found absolute path, the workstation time information and the centos-art.sh script copyright information as reference.  Additionally, the 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 --vacuum-defs option of inkscape command-line interface.

Maintaining .xhtml files
........................

If web pages are found, the tuneup functionality transforms web page headings to make them accessible through a table of contents. The table of contents is expanded in place, wherever the <div class="toc"></div> piece of code be in the page.

Once the <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 tuneup functionality everytime you update the heading information so as to update the table of contents, too.

In order for the tuneup functionality to transform headings, you need to put headings in just one line using one of the following forms:

<h1><a name="">Title</a></h1>
<h1><a href="">Title</a></h1>
<h1><a name="" href="">Title</a></h1>

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 name and href options from the anchor element are set dynamically using the md5sum output of combining the page location, the head- string and the heading string.  If any of the components used to build the heading reference changes, you need to run the the tuneup functionality in order for the anchor elements to use the correct information.

Usage
-----

Synopsis
........

centos-art tuneup [OPTIONS] path/to/dir

Options
.......

--quiet
     Supress all output messages, including confirmation question. Use this option with care.

--filter='regex'
     Reduce the amount of files to process using regex as pattern.

--answer-yes
     Assume `yes' to all confirmation questions.

--dont-commit-changes
     Supress all commit and update actions realized over files already processed, before and after the action itself had took place in the working copy.

Examples
........

centos-art tuneup trunk/Scripts

     Update the copyright and license notice of all the shell scripts we have in trunk/Scripts directory structure.

centos-art tuneup trunk/Identity/Models/Brands --filter="symbol"
     Update metadata and remove unused definitions from all design models in trunk/Identity/Models/Brands which have the word symbol in the file name.

centos-art tuneup trunk/Identity/Webenv/App/Home
     Update headings and the related table of contents to all web pages inside trunk/Identity/Webenv/App/Home, recusively.

See also
--------

  * Directories trunk Scripts Functions

  * Directories trunk Scripts

  * Directories trunk