Blame Artworks/Docs/Docbook/Tcar-ug/Scripts/Bash/tuneup.docbook

Alain Reguera Delgado 46de3c
<refentry id="scripts-bash-tuneup">
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refmeta>
Alain Reguera Delgado 46de3c
        <refentrytitle>tuneup</refentrytitle>
Alain Reguera Delgado 46de3c
        <indexterm type="specific-function">
Alain Reguera Delgado 46de3c
            <primary>Standardize maintainance tasks inside &TCAR;</primary>
Alain Reguera Delgado 46de3c
        </indexterm>
Alain Reguera Delgado 46de3c
    </refmeta>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refnamediv>
Alain Reguera Delgado 46de3c
        <refname>tuneup</refname>
Alain Reguera Delgado 46de3c
        <refpurpose>Standardize maintainance tasks inside &TCAR;</refpurpose>
Alain Reguera Delgado 46de3c
    </refnamediv>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsynopsisdiv>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <varname>DIRECTORY</varname> parameter specifies the
Alain Reguera Delgado 46de3c
        directory path, inside the working copy of &TCAR;, where the
Alain Reguera Delgado 46de3c
        files you want to process are stored in.  This paramter can be
Alain Reguera Delgado 46de3c
        provided more than once in order to process more than one
Alain Reguera Delgado 46de3c
        directory path in a single command execution.  When this
Alain Reguera Delgado 46de3c
        parameter is not provided, the current directory path where
Alain Reguera Delgado 46de3c
        the command was called from is used instead.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </refsynopsisdiv>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsection id="scripts-bash-tuneup-description">
Alain Reguera Delgado 46de3c
    <title>Description</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Tasks related to file maintainance are repetitive. You might
Alain Reguera Delgado 46de3c
        find yourself doing them time after time inside the working
Alain Reguera Delgado 46de3c
        copy of &TCAR;. Some of these maintainance tasks do update top
Alain Reguera Delgado 46de3c
        comments on shell scripts, create table of contents for web
Alain Reguera Delgado 46de3c
        pages, update metadata related to design models and remove
Alain Reguera Delgado 46de3c
        unused definitions from design models.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        When you execute the tuneup functionality of centos-art.sh
Alain Reguera Delgado 46de3c
        script, it looks for all files that match the supported
Alain Reguera Delgado 46de3c
        extensions (e.g., <filename class="extension">.sh</filename>,
Alain Reguera Delgado 46de3c
        <filename class="extension">.svg</filename> and 
Alain Reguera Delgado 46de3c
        class="extension">.xhtml</filename>) in the directory
Alain Reguera Delgado 46de3c
        specified, builds a list with them and applies the
Alain Reguera Delgado 46de3c
        maintainance tasks using file extensions as refentry.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        When shell scripts are found, the <function>tuneup</function>
Alain Reguera Delgado 46de3c
        functionality of centos-art.sh script reads a comment template
Alain Reguera Delgado 46de3c
        from
Alain Reguera Delgado 46de3c
        <filename>Scripts/Functions/Tuneup/Shell/Config/topcomment.sed</filename>
Alain Reguera Delgado 46de3c
        and applies it to all shell scripts found, one by one. As
Alain Reguera Delgado 46de3c
        result, all shell scripts will end up having the same
Alain Reguera Delgado 46de3c
        copyright and license information the comment template does.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        In order for the shell script top comment template to be
Alain Reguera Delgado 46de3c
        applied correctly, the shell scripts you write must have the
Alain Reguera Delgado 46de3c
        structure described in <xref linkend="scripts-bash-tuneup-fig1" />.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <example id="scripts-bash-tuneup-fig1">
Alain Reguera Delgado 46de3c
    <title>Shell script top-comment template.</title>
Alain Reguera Delgado 46de3c
    <screenshot>
Alain Reguera Delgado 46de3c
    <screeninfo>Shell script top-comment template.</screeninfo>
Alain Reguera Delgado 46de3c
    <mediaobject>
Alain Reguera Delgado 46de3c
    <textobject>
Alain Reguera Delgado 46de3c
<programlisting>
Alain Reguera Delgado 46de3c
 1| #!/bin/bash
Alain Reguera Delgado 46de3c
 2| #
Alain Reguera Delgado 46de3c
 3| # doSomething.sh -- The function description goes here.
Alain Reguera Delgado 46de3c
 4| # 
Alain Reguera Delgado 46de3c
 5| # Copyright
Alain Reguera Delgado 46de3c
 6| #
Alain Reguera Delgado 46de3c
 7| # ...
Alain Reguera Delgado 46de3c
 8| #
Alain Reguera Delgado 46de3c
 9| # ----------------------------------------------------------------------
Alain Reguera Delgado 46de3c
10| # $Id$
Alain Reguera Delgado 46de3c
11| # ----------------------------------------------------------------------
Alain Reguera Delgado 46de3c
12|
Alain Reguera Delgado 46de3c
13| function doSomething {
Alain Reguera Delgado 46de3c
14|     
Alain Reguera Delgado 46de3c
15| }
Alain Reguera Delgado 46de3c
</programlisting>
Alain Reguera Delgado 46de3c
    </textobject>
Alain Reguera Delgado 46de3c
    </mediaobject>
Alain Reguera Delgado 46de3c
    </screenshot>
Alain Reguera Delgado 46de3c
    </example>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <function>tuneup</function> functionality of
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script replaces all lines
Alain Reguera Delgado 46de3c
        between the <literal>Copyright</literal> line (e.g., line 5)
Alain Reguera Delgado 46de3c
        and the first separator line (e.g., line 9), inclusively.
Alain Reguera Delgado 46de3c
        Everything else will remain immutable in the file.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        When scalable vector graphics are found, the tuneup
Alain Reguera Delgado 46de3c
        functionality reads a SVG metadata template from
Alain Reguera Delgado 46de3c
        <filename>Scripts/Functions/Tuneup/Svg/Config/metadata.sed</filename>
Alain Reguera Delgado 46de3c
        and applies it to all files found, one by one. Immediatly
Alain Reguera Delgado 46de3c
        after the metadata template has been applied and, before
Alain Reguera Delgado 46de3c
        passing to next file, all unused definition are removed from
Alain Reguera Delgado 46de3c
        the file, too.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The metadata applied by the SVG metadata template is created
Alain Reguera Delgado 46de3c
        dynamicaly combining the absolute path of the file being
Alain Reguera Delgado 46de3c
        currently modified, the workstation's date information, the
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script copyright holder
Alain Reguera Delgado 46de3c
        (e.g., =COPYRIGHT_HOLDER=) as refentry and the Creative
Alain Reguera Delgado 46de3c
        Common Distribution-ShareAlike 3.0 License as default license
Alain Reguera Delgado 46de3c
        to release SVG files.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The elimination of unused definitions inside SVG files takes
Alain Reguera Delgado 46de3c
        place through Inkscape's <option>--vacuum-defs</option>
Alain Reguera Delgado 46de3c
        option, as described in its man page (e.g., <command>man
Alain Reguera Delgado 46de3c
        inkscape</command>).
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        When HTML files are found, the <function>tuneup</function>
Alain Reguera Delgado 46de3c
        functionality of <command>centos-art.sh</command> script
Alain Reguera Delgado 46de3c
        transforms web page headings to make them accessible through a
Alain Reguera Delgado 46de3c
        table of contents.  The table of contents is expanded in
Alain Reguera Delgado 46de3c
        place, wherever the <div
Alain Reguera Delgado 46de3c
        class="toc"></div> piece of code be in the
Alain Reguera Delgado 46de3c
        file.  Once the table of contents has been expanded, there is
Alain Reguera Delgado 46de3c
        no need to put anything else in the page.  You can run the
Alain Reguera Delgado 46de3c
        <function>tuneup</function> functionality everytime you update
Alain Reguera Delgado 46de3c
        the heading information so as to update the table of contents,
Alain Reguera Delgado 46de3c
        too.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        In order for this functionality to build the table of contents
Alain Reguera Delgado 46de3c
        from headings, you need to put headings in just one line. The
Alain Reguera Delgado 46de3c
        headin level can vary from h1 to h6
Alain Reguera Delgado 46de3c
        with attribute definitions accepted.  Closing tag must be
Alain Reguera Delgado 46de3c
        present and also match the openning tag.  Inside the heading
Alain Reguera Delgado 46de3c
        definition an anchor definition must be present with attribute
Alain Reguera Delgado 46de3c
        definitions accepted. The value of <property>name</property>
Alain Reguera Delgado 46de3c
        and <property>href</property> attributes from the anchor
Alain Reguera Delgado 46de3c
        element are set dynamically using the md5sum output of
Alain Reguera Delgado 46de3c
        combining the page location, the <literal>head-</literal>
Alain Reguera Delgado 46de3c
        string and the heading content itself.  If any of the
Alain Reguera Delgado 46de3c
        components used to build the heading refentry changes, you
Alain Reguera Delgado 46de3c
        need to run the the tuneup functionality of
Alain Reguera Delgado 46de3c
        <command>centos-art.sh</command> script in order for the
Alain Reguera Delgado 46de3c
        anchor elements to use the correct information.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        For example, the headings shown in 
Alain Reguera Delgado 46de3c
        linkend="scripts-bash-tuneup-fig2" /> produces the table of
Alain Reguera Delgado 46de3c
        contents shown in <xref linkend="scripts-bash-tuneup-fig3" />.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <example id="scripts-bash-tuneup-fig2">
Alain Reguera Delgado 46de3c
    <title>HTML heading definition.</title>
Alain Reguera Delgado 46de3c
    <screenshot>
Alain Reguera Delgado 46de3c
    <screeninfo>HTML heading definition.</screeninfo>
Alain Reguera Delgado 46de3c
    <mediaobject>
Alain Reguera Delgado 46de3c
    <textobject>
Alain Reguera Delgado 46de3c
<programlisting>
Alain Reguera Delgado 46de3c
<h1 class="title"><a name="head-8a23b56a28dfa7277d176576f217054a">Forms</a></h1>
Alain Reguera Delgado 46de3c
<h2 class="title"><a name="head-629f38bc607f2a270177106b450aeae3">Elements</a></h2>
Alain Reguera Delgado 46de3c
<h2 class="title"><a name="head-f49cae1d73592c984bbb0bffb1d5699a">Recommendations</a></h2>
Alain Reguera Delgado 46de3c
</programlisting>
Alain Reguera Delgado 46de3c
    </textobject>
Alain Reguera Delgado 46de3c
    </mediaobject>
Alain Reguera Delgado 46de3c
    </screenshot>
Alain Reguera Delgado 46de3c
    </example>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <example id="scripts-bash-tuneup-fig3">
Alain Reguera Delgado 46de3c
    <title>HTML table of contents definition.</title>
Alain Reguera Delgado 46de3c
    <screenshot>
Alain Reguera Delgado 46de3c
    <screeninfo>HTML table of contents definition.</screeninfo>
Alain Reguera Delgado 46de3c
    <mediaobject>
Alain Reguera Delgado 46de3c
    <textobject>
Alain Reguera Delgado 46de3c
<programlisting>
Alain Reguera Delgado 46de3c
<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>
Alain Reguera Delgado 46de3c
</programlisting>
Alain Reguera Delgado 46de3c
    </textobject>
Alain Reguera Delgado 46de3c
    </mediaobject>
Alain Reguera Delgado 46de3c
    </screenshot>
Alain Reguera Delgado 46de3c
    </example>
Alain Reguera Delgado 46de3c
    </refsection>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsection id="scripts-bash-tuneup-options">
Alain Reguera Delgado 46de3c
    <title>Options</title>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The <function>tuneup</function> functionality accepts the
Alain Reguera Delgado 46de3c
        following options: 
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <variablelist>
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><option>--quiet</option></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Supress all output messages except error messages.  When this
Alain Reguera Delgado 46de3c
        option is passed, all confirmation requests are supressed and
Alain Reguera Delgado 46de3c
        a possitive answer is assumed for them, just as if the
Alain Reguera Delgado 46de3c
        <option>--answer-yes</option> option would have been provided.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><option>--answer-yes</option></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
       Assume <emphasis>yes</emphasis> to all confirmation requests.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><option>--filter="REGEX"</option></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Reduce the list of files to process inside
Alain Reguera Delgado 46de3c
        <replaceable>path/to/dir</replaceable> using
Alain Reguera Delgado 46de3c
        <replaceable>REGEX</replaceable> as pattern.  You can use this
Alain Reguera Delgado 46de3c
        option to control the amount of files you want to tuneup.  The
Alain Reguera Delgado 46de3c
        deeper you go into the directory structure the more specific
Alain Reguera Delgado 46de3c
        you'll be about the files you want to tuneup.  When you cannot
Alain Reguera Delgado 46de3c
        go deeper into the directory structure through
Alain Reguera Delgado 46de3c
        <replaceable>path/to/dir</replaceable> specification, use this
Alain Reguera Delgado 46de3c
        option to reduce the list of files therein.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <varlistentry>
Alain Reguera Delgado 46de3c
    <term><option>--synchronize</option></term>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Synchronizes available changes between the working copy and
Alain Reguera Delgado 46de3c
        the central repository.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </varlistentry>
Alain Reguera Delgado 46de3c
    </variablelist>
Alain Reguera Delgado 46de3c
    </refsection>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsection id="scripts-bash-tuneup-environment">
Alain Reguera Delgado 46de3c
    <title>Function Specific Environment</title>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        ...
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </refsection>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsection id="scripts-bash-tuneup-authors">
Alain Reguera Delgado 46de3c
    <title>Authors</title>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        The following people have worked in the
Alain Reguera Delgado 46de3c
        <function>tuneup</function> functionality:
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    <itemizedlist>
Alain Reguera Delgado 46de3c
    <listitem>
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Alain Reguera Delgado <<ulink url="mailto:alain.reguera@gmail.com">alain.reguera@gmail.com</ulink>>, =COPYRIGHT_YEAR_LIST=
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </listitem>
Alain Reguera Delgado 46de3c
    </itemizedlist>
Alain Reguera Delgado 46de3c
    </refsection>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <refsection id="scripts-bash-tuneup-licence">
Alain Reguera Delgado 46de3c
    <title>License</title>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        Copyright © =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER=
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
 
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This program is free software; you can redistribute it and/or
Alain Reguera Delgado 46de3c
        modify it under the terms of the GNU General Public License as
Alain Reguera Delgado 46de3c
        published by the Free Software Foundation; either version 2 of
Alain Reguera Delgado 46de3c
        the License, or (at your option) any later version.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
 
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        This program is distributed in the hope that it will be
Alain Reguera Delgado 46de3c
        useful, but WITHOUT ANY WARRANTY; without even the implied
Alain Reguera Delgado 46de3c
        warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
Alain Reguera Delgado 46de3c
        PURPOSE.  See the GNU General Public License for more details.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
 
Alain Reguera Delgado 46de3c
    <para>
Alain Reguera Delgado 46de3c
        You should have received a copy of the GNU General Public
Alain Reguera Delgado 46de3c
        License along with this program; if not, write to the Free
Alain Reguera Delgado 46de3c
        Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
Alain Reguera Delgado 46de3c
        USA.
Alain Reguera Delgado 46de3c
    </para>
Alain Reguera Delgado 46de3c
    </refsection>
Alain Reguera Delgado 46de3c
Alain Reguera Delgado 46de3c
</refentry>