Blame Manual/Directories/trunk/Scripts/Functions/Tuneup.texi

397885
@subheading Goals
397885
397885
@itemize
397885
@item ...
397885
@end itemize
397885
397885
@subheading Description
397885
7c40cb
@subsubheading Shell Script Files
7c40cb
7c40cb
The @code{shell} functionality of @file{centos-art.sh} script helps
7c40cb
you to maintain bash scripts inside repository. For example, suppose
7c40cb
you've created many functionalities for @file{centos-art.sh} script,
7c40cb
and you want to use a common copyright and license note for
7c40cb
consistency in all your script files. If you have a bunch of files,
7c40cb
doing this one by one wouldn't be a big deal. In contrast, if the
7c40cb
amount of files grows, updating the copyright and license note for all
7c40cb
of them would be a task rather tedious. The @code{shell} functionality
7c40cb
exists to solve maintainance tasks just as the one previously
7c40cb
mentioned.
7c40cb
7c40cb
When you use @code{shell} functionality to update copyright inside
7c40cb
script files, it is required that your script files contain (at least)
7c40cb
the following top commentary 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
7c40cb
Relevant lines in the above structure are lines from 5 to 9.
7c40cb
Everything else in the file is left immutable.
7c40cb
7c40cb
When you are updating copyright through @code{shell}
7c40cb
functionality,  the @file{centos-art.sh} script replaces everything
7c40cb
in-between line 5 ---the first one matching @samp{^# Copyright .+$}
7c40cb
string--- and line 9---the first long dash separator matching @samp{^#
7c40cb
-+$}--- with the content of copyright template instance.
7c40cb
7c40cb
@quotation
7c40cb
@strong{Caution} Be sure to add the long dash separator that matches
7c40cb
@samp{^# -+$} regular expression @emph{before} the function
7c40cb
definition. Otherwise, if the @samp{Copyright} line is present but no
7c40cb
long dash separator exists, @file{centos-art.sh} will remove anything
7c40cb
in-between the @samp{Copyright} line and the end of file. This way you
7c40cb
may lost your function definitions entirely.
7c40cb
@end quotation
7c40cb
7c40cb
The copyright template instance is created from one copyright template
7c40cb
stored in the @file{Config/tpl_forCopyright.sed} file.  The template
7c40cb
instance is created once, and later removed when no longer needed. At
7c40cb
this moment, when template instance is created, the
7c40cb
@file{centos-art.sh} script takes advantage of automation in order to
7c40cb
set copyright full name and date dynamically.
7c40cb
7c40cb
When you use @code{shell} functionality to update copyright, the first
7c40cb
thing @file{shell} functionality does is requesting copyright
7c40cb
information to user, and later, if values were left empty (i.e., no
7c40cb
value was typed before pressing @key{RET} key), the @file{shell}
7c40cb
functionality uses its own default values.
7c40cb
7c40cb
When @code{shell} functionality uses its own default values, the final
7c40cb
copyright note looks like the following:
7c40cb
7c40cb
@verbatim
7c40cb
 1| #!/bin/bash
7c40cb
 2| #
7c40cb
 3| # doSomthing.sh -- The function description goes here.
7c40cb
 4| #
7c40cb
 5| # Copyright (C) 2003, 2010 The CentOS Project
7c40cb
 6| # 
7c40cb
 7| # This program is free software; you can redistribute it and/or modify
7c40cb
 8| # it under the terms of the GNU General Public License as published by
7c40cb
 9| # the Free Software Foundation; either version 2 of the License, or
7c40cb
10| # (at your option) any later version.
7c40cb
11| # 
7c40cb
12| # This program is distributed in the hope that it will be useful, but
7c40cb
13| # WITHOUT ANY WARRANTY; without even the implied warranty of
7c40cb
14| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
7c40cb
15| # General Public License for more details.
7c40cb
16| #
7c40cb
17| # You should have received a copy of the GNU General Public License
7c40cb
18| # along with this program; if not, write to the Free Software
7c40cb
19| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
7c40cb
20| # USA.
7c40cb
21| #
7c40cb
22| # ----------------------------------------------------------------------
7c40cb
23| # $Id$
7c40cb
24| # ----------------------------------------------------------------------
7c40cb
25|
7c40cb
26| function doSomething {
7c40cb
27|
7c40cb
28| }
7c40cb
@end verbatim
7c40cb
7c40cb
Relevant lines in the above structure are lines from 5 to 22.  Pay
7c40cb
attention how the copyright line was built, and how the license was
7c40cb
added into the top comment where previously was just three dots.
7c40cb
Everything else in the file was left immutable. 
7c40cb
7c40cb
To change copyright information (i.e., full name or year information),
7c40cb
run the @code{shell} functionality over the root directory containing
7c40cb
the script files you want to update copyright in and enter the
7c40cb
appropriate information when it be requested. You can run the
7c40cb
@code{shell} functionality as many times as you need to.
7c40cb
7c40cb
To change copyright license (i.e., the text in-between lines 7 and
7c40cb
20), you need to edit the @file{Config/tpl_forCopyright.sed} file, set
7c40cb
the appropriate information, and run the @code{shell} functionality
7c40cb
once again for changes to take effect over the files you specify.
7c40cb
7c40cb
@quotation
7c40cb
@strong{Important} The @file{centos-art.sh} script is released as: 
7c40cb
7c40cb
@verbatim
7c40cb
GNU GENERAL PUBLIC LICENSE
7c40cb
Version 2, June 1991
7c40cb
7c40cb
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
7c40cb
                         675 Mass Ave, Cambridge, MA 02139, USA
7c40cb
@end verbatim
7c40cb
7c40cb
Do not change the license information under which @file{centos-art.sh}
7c40cb
script is released. Instead, if you think a different license must be
7c40cb
used, please share your reasons at @email{centos-devel@@centos-art.sh}
7c40cb
mailing list.
7c40cb
7c40cb
See file
7c40cb
@url{file:///home/centos/artwork/trunk/Scripts/COPYING,trunk/Scripts/COPYING},
7c40cb
for a complete license description.
7c40cb
@end quotation
7c40cb
7c40cb
@subsubheading SVG Files
7c40cb
7c40cb
The @code{svg} functionality of @file{centos-art.sh} script helps you
7c40cb
to maintain scalable vector graphics (SVG) inside repository. For
7c40cb
example, suppose you've been working in CentOS default design models
7c40cb
under @file{trunk/Identity/Themes/Models/}, and you want to set common
7c40cb
metadata to all of them, and later remove all unused SVG defintions
7c40cb
from @samp{*.svg} files. Doing so file by file may be a tedious task,
7c40cb
so the @file{centos-art.sh} script provides the @code{svg}
7c40cb
functionality to aid you maintain such actions.
7c40cb
7c40cb
The metadata used is defined by Inkscape 0.46 using the SVG standard
7c40cb
markup. The @file{centos-art.sh} script replaces everything
7c40cb
in-between @code{<metadata} and @code{</metadata>} tags with a
7c40cb
predefined metadata template we've set for this purpose.
7c40cb
7c40cb
The metadata template was created using the metadata information of a
7c40cb
file which, using Inkscape 0.46, all metadata fields were set. This
7c40cb
created a complete markup representation of how SVG metadata would
7c40cb
look like. Later, we replaced every single static value with a
7c40cb
translation marker in the form @samp{=SOMETEXT=}, where
7c40cb
@code{SOMETEXT} is the name of its main opening tag. Later, we
7c40cb
transform the metadata template into a sed replacement set of commads
7c40cb
escaping new lines at the end of each line.
7c40cb
7c40cb
With metadata template in place, the @file{centos-art.sh} script uses
7c40cb
it to create a metadata template instance for the file being processed
7c40cb
currently.  The metadata template instance contains the metadata
7c40cb
portion of sed replacement commands with translation markers already
7c40cb
traduced.  In this action, instance creation, is where we take
7c40cb
advantage of automation and generate metadata values like title, date,
7c40cb
keywords, source, identifier, and relation dynamically, based on the
7c40cb
file path @file{centos-art.sh} script is currently creating metadata
7c40cb
information for.
7c40cb
7c40cb
With metadata template instance in place, the @file{centos-art.sh}
7c40cb
script uses it to replace real values inside all @samp{.svg} files
7c40cb
under the current location you're running the @file{centos-art.sh}
7c40cb
script on.  Default behaviour is to ask user to enter each metadatum
7c40cb
required, one by one. If user leaves metadatum empty, by pressing
7c40cb
@key{RET} key, @file{centos-art.sh} uses its default value.
7c40cb
7c40cb
Many of the no-longer-used gradients, patterns, and markers (more
7c40cb
precisely, those which you edited manually) remain in the
7c40cb
corresponding palettes and can be reused for new objects. However if
7c40cb
you want to optimize your document, use the @samp{Vacuum Defs} command
7c40cb
in @samp{File} menu. It will remove any gradients, patterns, or
7c40cb
markers which are not used by anything in the document, making the
7c40cb
file smaller. 
7c40cb
7c40cb
If you have one or two couple of files, removing unused definitions
7c40cb
using the graphical interface may be enough to you.  In contrast, if
7c40cb
you have dozens or even houndreds of scalable vector graphics files to
7c40cb
maintain it is not a fun task to use the graphical interface to remove
7c40cb
unused definitions editing those files one by one.
7c40cb
7c40cb
To remove unused definitions from several scalable vector graphics
7c40cb
files, the @file{centos-art.sh} script uses Inkscape command-line
7c40cb
interface, specifically with the @option{--vaccum-defs} option.
7c40cb
7c40cb
@subsubheading XHTML Files
7c40cb
397885
@itemize
397885
@item ...
397885
@end itemize
397885
397885
@subheading Usage
397885
397885
@itemize
397885
@item ...
397885
@end itemize
397885
397885
@subheading See also
397885
397885
@itemize
397885
@item ...
397885
@end itemize