From c554f1c0cbcbf343f4d2038636ee97d1eba1b628 Mon Sep 17 00:00:00 2001 From: Alain Reguera Delgado Date: Dec 13 2013 01:48:17 +0000 Subject: Add tcar-scripts-prepare to a branch of its own. --- diff --git a/tcar-scripts-prepare/Locales/es_ES/prepare.sh.po b/tcar-scripts-prepare/Locales/es_ES/prepare.sh.po new file mode 100644 index 0000000..0bf026e --- /dev/null +++ b/tcar-scripts-prepare/Locales/es_ES/prepare.sh.po @@ -0,0 +1,28 @@ +msgid "" +msgstr "" +"Project-Id-Version: prepare.sh 0.6\n" +"Report-Msgid-Bugs-To: centos-l10n-es@centos.org.cu\n" +"POT-Creation-Date: 2013-10-28 16:31-0400\n" +"PO-Revision-Date: 2013-10-28 16:31-0400\n" +"Last-Translator: Localization SIG \n" +"Language-Team: Spanish\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: Automation/Modules/Prepare/Modules/Packages/packages.sh:54 +msgid "All required packages are installed already." +msgstr "Todos los paquetes requeridos ya est\'an instalados." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:55 +msgid "The option name cannot be empty." +msgstr "El nombre de la opción no puede estar vacío." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:64 +msgid "The option value cannot be empty." +msgstr "El valor de la opción no puede estar vacío." + +#: Automation/Modules/Prepare/prepare_setRenderEnvironment.sh:80 +msgid "The search path cannot be empty." +msgstr "El camino de búsqueda no puede estar vacío." diff --git a/tcar-scripts-prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl b/tcar-scripts-prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl new file mode 100644 index 0000000..3883162 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Conf/Configs/asciidoc.render.conf.tpl @@ -0,0 +1,10 @@ +[=SECTION=.html] +render-type = "asciidoc" +render-flow = "article" +render-from = "=SECTION=.asciidoc" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.asciidoc.po" +images-from = "${TCAR_BASEDIR}/Artworks/Icons/Webenv" +styles-from = "${TCAR_BASEDIR}/Artworks/Webenv/Docbook/1.69.1/Css" +formats = "xhtml" +render-page = "single chunks" + diff --git a/tcar-scripts-prepare/Modules/Conf/Configs/svg.render.conf.tpl b/tcar-scripts-prepare/Modules/Conf/Configs/svg.render.conf.tpl new file mode 100644 index 0000000..10d323d --- /dev/null +++ b/tcar-scripts-prepare/Modules/Conf/Configs/svg.render.conf.tpl @@ -0,0 +1,6 @@ +[=SECTION=.png] +render-type = "svg" +render-flow = "base" +render-from = "=SECTION=.svg" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.svg.po" + diff --git a/tcar-scripts-prepare/Modules/Conf/Configs/svgz.render.conf.tpl b/tcar-scripts-prepare/Modules/Conf/Configs/svgz.render.conf.tpl new file mode 100644 index 0000000..6e45b4e --- /dev/null +++ b/tcar-scripts-prepare/Modules/Conf/Configs/svgz.render.conf.tpl @@ -0,0 +1,6 @@ +[=SECTION=.png] +render-type = "svg" +render-flow = "base" +render-from = "=SECTION=.svgz" +locale-from = "Locales/${TCAR_SCRIPT_LANG_LC}/=SECTION=.svgz.po" + diff --git a/tcar-scripts-prepare/Modules/Conf/conf.sh b/tcar-scripts-prepare/Modules/Conf/conf.sh new file mode 100755 index 0000000..4000d9f --- /dev/null +++ b/tcar-scripts-prepare/Modules/Conf/conf.sh @@ -0,0 +1,81 @@ +#!/bin/bash +###################################################################### +# +# conf.sh -- This module prepares configuration files used by both +# render and locale modules. +# +# To build the configuration file, this module creates a list of +# files to process based on the arguments provided in the +# command-line line. With this list, then, it creates the +# configuration file using configuration templates for each file +# extension supported inside the repository. +# +# The configuration file this module creates doesn't include options +# like brand which require information about the image you are about +# to produce. The intention of this module is create the +# configuration files you need to produce content right away in the +# simplest way possible and then letting you improve it as needed. +# +# The name and location of the final configuration file is that +# passed as argument to prepare module in the command-line. +# +# Written by: +# * Alain Reguera Delgado , 2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function conf { + + # Verify that a configuration file was provided as argument. + if [[ $# -eq 0 ]];then + tcar_printMessage "`gettext "The configuration file wasn't provided."`" --as-error-line + fi + + # Define configuration file. + local CONF_FILE=$(tcar_checkRepoDirSource "${1}") + tcar_checkFiles -m "\.conf$" ${CONF_FILE} + + # Define parent directory of configuration file. + local CONF_DIR=$(dirname ${CONF_FILE}) + tcar_checkFiles -ed "${CONF_DIR}" + + # Build the list of files to process. This is all the source files + # we want to produce th configuration file for. + local SOURCE_FILES=$(tcar_getFilesList ${CONF_DIR} \ + --mindepth=1 --maxdepth=1 --type=f \ + --pattern='.+\.(svgz|svg|asciidoc)$') + + # Verify the list of files to process. + tcar_checkFiles -ef ${SOURCE_FILES} + + # Print action message. + tcar_printMessage "${CONF_FILE}" --as-creating-line + + # Process list of files. + for SOURCE_FILE in ${SOURCE_FILES};do + + local CONF_FILE_NAME=$(tcar_getFileName "${SOURCE_FILE}") + local CONF_FILE_EXTENSION=$(tcar_getFileExtension "${SOURCE_FILE}") + local CONF_FILE_TEMPLATE=${TCAR_MODULE_DIR_CONFIGS}/${CONF_FILE_EXTENSION}.render.conf.tpl + + sed -r "s/=SECTION=/${CONF_FILE_NAME}/g" ${CONF_FILE_TEMPLATE} >> ${CONF_FILE} + + done + +} diff --git a/tcar-scripts-prepare/Modules/Documents/documents.sh b/tcar-scripts-prepare/Modules/Documents/documents.sh new file mode 100755 index 0000000..8f13836 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Documents/documents.sh @@ -0,0 +1,46 @@ +#!/bin/bash +###################################################################### +# +# documents.sh -- This function renders all documentation files +# inside the repository using the render module. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function documents { + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS='/' + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='asciidoc' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} diff --git a/tcar-scripts-prepare/Modules/Images/images.sh b/tcar-scripts-prepare/Modules/Images/images.sh new file mode 100755 index 0000000..5916d70 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Images/images.sh @@ -0,0 +1,58 @@ +#!/bin/bash +###################################################################### +# +# images.sh -- This function renders all configuration images files +# inside the repository, using the render module and the correct +# production order. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function images { + + # CAUTION: The order in which repository components are processed + # affect the final result. For instance, in order for theme images + # to hold the CentOS branding information the `Artworks/Brands' + # directory must be rendered before the `Artworks/Themes' + # directory. The reason of this is that brand images are not + # drawn inside theme design models but combined with them using + # ImageMagick, once they both have been rendered as PNG files. + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS="\ + Artworks/Brands\ + Artworks/Documentation\ + Artworks/Themes" + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='svg' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} diff --git a/tcar-scripts-prepare/Modules/Links/Configs/render.conf b/tcar-scripts-prepare/Modules/Links/Configs/render.conf new file mode 100755 index 0000000..6982fd7 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Links/Configs/render.conf @@ -0,0 +1,26 @@ +# Install centos-art command. +[centos-art] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Automation/centos-art.sh" +link-target = "${HOME}/bin" + +# Install vim's settings used as convention to edit files inside the +# repository. In case the conventions change, and link-target is +# updated inside the repository, the new conventions will be available +# to you immediately after fetching changes from central repository. +[.vimrc] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Automation/Modules/Prepare/Modules/Links/Configs/vimrc" +link-target = "${HOME}" + +# Install corporate typography. +[denmark.ttf] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Artworks/Fonts/denmark.ttf" +link-target = "${HOME}/.fonts" + +# Install corporate palette of colors (for inkscape). +[corporate.gpl] +render-type = "symlink" +render-from = "${TCAR_BASEDIR}/Artworks/Palettes/corporate.gpl" +link-target = "${HOME}/.inkscape/palettes" diff --git a/tcar-scripts-prepare/Modules/Links/Configs/vimrc b/tcar-scripts-prepare/Modules/Links/Configs/vimrc new file mode 100755 index 0000000..5737ebd --- /dev/null +++ b/tcar-scripts-prepare/Modules/Links/Configs/vimrc @@ -0,0 +1,8 @@ +set nu +set textwidth=70 +set autoindent +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set tags=./tags,tags diff --git a/tcar-scripts-prepare/Modules/Links/links.sh b/tcar-scripts-prepare/Modules/Links/links.sh new file mode 100755 index 0000000..d33b94a --- /dev/null +++ b/tcar-scripts-prepare/Modules/Links/links.sh @@ -0,0 +1,50 @@ +#!/bin/bash +###################################################################### +# +# links.sh -- This function renders configuration files inside +# automation scripts directory structure, using the render module. +# These configuration files are mainly used to connect content +# inside the repository with applications outside the repository, +# using symbolic links. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function links { + + # Define base location where configuration files will be searched + # from. You can provide more than one location here. + local DIRS="/" + + # Define the name of the option you want to look configuration + # files for. + local NAME='render-type' + + # Define the value of the option you want to look configuration + # files for. + local VALUE='symlink' + + # Render configuration files that match specified options and + # values in the search directories. + prepare_setRenderEnvironment -o "${NAME}" -v "${VALUE}" "${DIRS}" + +} + diff --git a/tcar-scripts-prepare/Modules/Locales/locales.sh b/tcar-scripts-prepare/Modules/Locales/locales.sh new file mode 100755 index 0000000..b733cb1 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Locales/locales.sh @@ -0,0 +1,33 @@ +#!/bin/bash +###################################################################### +# +# locales.sh -- This module retrieves translatable strings from +# automation scripts and creates the related machine objects, so +# script messages can be rendered in different languages. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function locales { + + tcar_setModuleEnvironment locale "Automation/centos-art.sh" --update + +} diff --git a/tcar-scripts-prepare/Modules/Packages/packages.sh b/tcar-scripts-prepare/Modules/Packages/packages.sh new file mode 100755 index 0000000..17c0695 --- /dev/null +++ b/tcar-scripts-prepare/Modules/Packages/packages.sh @@ -0,0 +1,56 @@ +#!/bin/bash +###################################################################### +# +# packages.sh -- This function defines and verifies packages +# required by centos-art.sh script. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function packages { + + # Define required packages used by centos-art.sh script inside + # CentOS base repository. + local BASE_PACKAGES="ImageMagick netpbm netpbm-progs syslinux-perl + gimp coreutils texinfo texinfo-tex info tetex-latex + tetex-fonts tetex-xdvi tetex-dvips gettext texi2html libxml2 + gnome-doc-utils elinks docbook-style-xsl docbook-utils + docbook-dtds docbook-style-dsssl docbook-simple + docbook-utils-pdf docbook-slides firefox sudo yum rpm ctags + vim-enhanced" + + # Define required packages used by centos-art.sh script inside + # EPEL repository. Start verifying the package that contains + # repository configuration, then everything else. + local EPEL_PACKAGES="epel-release inkscape asciidoc" + + # Verify required packages. The order in which packages are + # verified my help to reduce some loops (e.g., verify packages + # containing the repository's configuration files first and + # packages from that repository later. It is rather possible that + # you won't be able to install any package from a repository you + # don't have configuration files for, in first place). + tcar_checkFiles -n ${BASE_PACKAGES} ${EPEL_PACKAGES} + + # Print a confirmation message here. + tcar_printMessage "`gettext "All required packages are installed already."`" --as-stdout-line + +} diff --git a/tcar-scripts-prepare/prepare.sh b/tcar-scripts-prepare/prepare.sh new file mode 100755 index 0000000..8a9f95c --- /dev/null +++ b/tcar-scripts-prepare/prepare.sh @@ -0,0 +1,52 @@ +#!/bin/bash +###################################################################### +# +# prepare.sh -- This module standardizes repository configuration +# tasks. +# +# When you download a fresh working copy of CentOS artwork +# repository, most of its content is in source format. You need to +# process source formats in order to produce final content and make +# the connections between components (e.g., render brand images so +# they can be applied to other images). This function takes care of +# those actions and should be the first module you run in your +# workstation after downloading a fresh working copy of CentOS +# artwork repository. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare { + + local ACTION='' + local ACTIONS='' + + prepare_getOptions + + if [[ -z ${ACTIONS} ]];then + ACTIONS='packages locales images docs links' + fi + + for ACTION in ${ACTIONS};do + tcar_setModuleEnvironment -m "${ACTION}" -t "child" ${TCAR_MODULE_ARGUMENT} + done + +} diff --git a/tcar-scripts-prepare/prepare_getOptions.sh b/tcar-scripts-prepare/prepare_getOptions.sh new file mode 100755 index 0000000..80b35e3 --- /dev/null +++ b/tcar-scripts-prepare/prepare_getOptions.sh @@ -0,0 +1,99 @@ +#!/bin/bash +###################################################################### +# +# prepare_getOptions.sh -- This function parses options passed to +# `centos-art.sh' script command-line, when the first argument is +# the `prepare' word. To parse options, this function makes use of +# getopt program. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_getOptions { + + # Define short options we want to support. + local ARGSS="h::,v" + + # Define long options we want to support. + local ARGSL="help::,version,packages,locales,links,documents,images,conf" + + # Redefine arguments using getopt(1) command parser. + tcar_setModuleArguments + + # Reset positional parameters on this function, using output + # produced from (getopt) arguments parser. + eval set -- "${TCAR_MODULE_ARGUMENT}" + + # Look for options passed through command-line. + while true; do + case "${1}" in + + -h | --help ) + tcar_printHelp "${2}" + ;; + + -v | --version ) + tcar_printVersion "${TCAR_MODULE_NAME}" + ;; + + --packages ) + ACTIONS="${ACTIONS} packages" + shift 1 + ;; + + --locales ) + ACTIONS="${ACTIONS} locales" + shift 1 + ;; + + --links ) + ACTIONS="${ACTIONS} links" + shift 1 + ;; + + --documents ) + ACTIONS="${ACTIONS} documents" + shift 1 + ;; + + --images ) + ACTIONS="${ACTIONS} images" + shift 1 + ;; + + --conf ) + ACTIONS="${ACTIONS} conf" + shift 1 + ;; + + -- ) + shift 1 + break + ;; + + esac + done + + # Redefine arguments using current positional parameters. Only + # paths should remain as arguments, at this point. + TCAR_MODULE_ARGUMENT="${@}" + +} diff --git a/tcar-scripts-prepare/prepare_setRenderEnvironment.sh b/tcar-scripts-prepare/prepare_setRenderEnvironment.sh new file mode 100755 index 0000000..dc8d91e --- /dev/null +++ b/tcar-scripts-prepare/prepare_setRenderEnvironment.sh @@ -0,0 +1,113 @@ +#!/bin/bash +###################################################################### +# +# prepare_setRenderEnvironment.sh -- This function provides a secure +# interface to render content outside the render module. You can use +# this function to call the render module from other modules, +# safely. +# +# This function builds a list of all available configuration files +# in locations passed as argument and reduces the list by applying +# regular expression patterns to each file in the list. Only files +# that match the regular expression pattern will remain in the final +# list. The regular expression patterns are applied to file's +# content, generally to find out if it has an specific option, value +# or combination of both inside. Later, the resultant list of +# configuration files is passed to render module for processing. +# +# This function verifies the search path provided to render module +# to grant it is inside the repository before passing it to render +# module for processing. +# +# Written by: +# * Alain Reguera Delgado , 2009-2013 +# +# Copyright (C) 2009-2013 The CentOS Artwork SIG +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or (at +# your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# +###################################################################### + +function prepare_setRenderEnvironment { + + OPTIND=1 + while getopts "o:,v:" OPTION "${@}"; do + + case "${OPTION}" in + + o ) + # Define the name of the option you want to look + # configuration files for. + local OPTION_NAME=${OPTARG} + if [[ -z ${OPTION_NAME} ]];then + tcar_printMessage "`gettext "The option name cannot be empty."`" --as-error-line + fi + ;; + + v ) + # Define the value of the option you want to look + # configuration files for. + local OPTION_VALUE=${OPTARG} + if [[ -z ${OPTION_VALUE} ]];then + tcar_printMessage "`gettext "The option value cannot be empty."`" --as-error-line + fi + ;; + + esac + + done + + # Clean up positional parameters to reflect the fact that options + # have been processed already. + shift $(( ${OPTIND} - 1 )) + + # Now that option arguments have been removed from positional + # parameter, verify all other remaining arguments (the search + # paths) do exist. They are required to search. + if [[ -z ${@} ]];then + tcar_printMessage "`gettext "The search path cannot be empty."`" --as-error-line + fi + + # Define array variable to store configuration file paths. + local -a CONFIGURATION_FILES + + # Define final filter regular expression. This regular expression + # must match the option = "value" format we are using inside + # configuration files. + local CONFIGURATION_PATTERN="^${OPTION_NAME}[[:space:]]*=[[:space:]]*\"${OPTION_VALUE}\"$" + + for DIRECTORY in ${@};do + + # Clean-up the search path. This location must point a + # directory inside the repository. References to directories + # outside the repository are not supported. + DIRECTORY=$(tcar_checkRepoDirSource ${DIRECTORY}) + + # Verify the search path. It must exist and being a directory. + tcar_checkFiles -ed ${DIRECTORY} + + # Define the list of configuration files the render module + # will use as reference to produce documentation. At this + # point it is very difficult that DIRECTORY doesn't exist or + # be outside the repository directory structure. + CONFIGURATION_FILES[++${#CONFIGURATION_FILES[*]}]=$(tcar_getFilesList \ + ${DIRECTORY} --pattern='.+\.conf$' --type='f' \ + | xargs egrep ${CONFIGURATION_PATTERN} | cut -d: -f1 | sort | uniq) + + done + + # Process the list of configuration files using the render module. + tcar_setModuleEnvironment -m "render" -t "parent" ${CONFIGURATION_FILES[*]} +}