tuneup — Standardize File Maintainance
The tuneup functionality is the
interface the centos-art.sh script provides
to standardize the maintainance tasks related to individual
files inside the working copy.
centos-art tuneup [OPTIONS] [DIRECTORY]
The DIRECTORY parameter specifies the
directory path, inside the working copy of &TCAR;, where the
files you want to process are stored in. This paramter can be
provided more than once in order to process more than one
directory path in a single command execution. When this
parameter is not provided, the current directory path where
the command was called from is used instead.
The tuneup functionality accepts the
following options:
Supress all output messages except error messages. When this
option is passed, all confirmation requests are supressed and
a possitive answer is assumed for them, just as if the
option would have been provided.
Assume yes to all confirmation requests.
Reduce the list of files to process inside
path/to/dir using
REGEX as pattern. You can use this
option to control the amount of files you want to tuneup. The
deeper you go into the directory structure the more specific
you'll be about the files you want to tuneup. When you cannot
go deeper into the directory structure through
path/to/dir specification, use this
option to reduce the list of files therein.
Supress all commit and update actions realized over files,
before and after the action itself had took place over files
in the working copy.
Tasks related to file maintainance are repetitive. You might
find yourself doing them time after time inside the working
copy of &TCAR;. 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 tuneup functionality of centos-art.sh
script, it looks for all files that match the supported
extensions (e.g., .sh,
.svg and .xhtml) in the directory
specified, builds a list with them and applies the
maintainance tasks using file extensions as reference.
When shell scripts are found, the tuneup
functionality of centos-art.sh script reads a comment template
from
trunk/Scripts/Functions/Tuneup/Shell/Config/topcomment.sed
and applies it to all 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
structure described in .
Shell script top-comment template.Shell script top-comment template.
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 tuneup functionality of
centos-art.sh script replaces all lines
between the Copyright line (e.g., line 5)
and the first separator line (e.g., line 9), inclusively.
Everything else will remain immutable in the file.
When scalable vector graphics are found, the tuneup
functionality reads a SVG metadata template from
trunk/Scripts/Functions/Tuneup/Svg/Config/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
the file, too.
The metadata applied by the SVG metadata template is created
dynamicaly combining the absolute path of the file being
currently modified, the workstation's date information, the
centos-art.sh script copyright holder
(e.g., =COPYRIGHT_HOLDER=) as reference and the Creative
Common Distribution-ShareAlike 3.0 License as default license
to release SVG files.
The elimination of unused definitions inside SVG files takes
place through Inkscape's
option, as described in its man page (e.g., man
inkscape).
When HTML files are found, the tuneup
functionality of 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 <div
class="toc"></div> piece of code be in the
file. Once the table of contents has been 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 this functionality to build the table of contents
from headings, you need to put headings in just one line. The
headin level can vary from h1 to h6
with attribute definitions accepted. Closing tag must be
present and also match the openning tag. Inside the heading
definition an anchor definition must be present with attribute
definitions accepted. The value of name
and href attributes from the anchor
element are set dynamically using the md5sum output of
combining the page location, the head-
string and the heading content itself. If any of the
components used to build the heading reference changes, you
need to run the the tuneup functionality of
centos-art.sh script in order for the
anchor elements to use the correct information.
For example, the headings shown in produces the table of
contents shown in .
HTML heading definition.HTML heading definition.
<h1 class="title"><a name="head-8a23b56a28dfa7277d176576f217054a">Forms</a></h1>
<h2 class="title"><a name="head-629f38bc607f2a270177106b450aeae3">Elements</a></h2>
<h2 class="title"><a name="head-f49cae1d73592c984bbb0bffb1d5699a">Recommendations</a></h2>
HTML table of contents definition.HTML table of contents definition.
<div class="toc"> <p>Table of contents</p> <dl><dt><a href="#head-8a23b56a28dfa7277d176576f217054a">Forms</a> <dl><dt><a href="#head-629f38bc607f2a270177106b450aeae3">Elements</a> </dt><dt><a href="#head-f49cae1d73592c984bbb0bffb1d5699a">Recommendations</a> </dt></dl> </dt></dl> </div>