|
Alain Reguera Delgado |
f23b0d |
#!/bin/bash
|
|
Alain Reguera Delgado |
f23b0d |
######################################################################
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
c0ca71 |
# tcar - The CentOS Artwork Repository automation tool.
|
|
Alain Reguera Delgado |
c0ca71 |
# Copyright © 2014 The CentOS Artwork SIG
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
c0ca71 |
# This program is free software; you can redistribute it and/or
|
|
Alain Reguera Delgado |
c0ca71 |
# modify it under the terms of the GNU General Public License as
|
|
Alain Reguera Delgado |
c0ca71 |
# published by the Free Software Foundation; either version 2 of the
|
|
Alain Reguera Delgado |
c0ca71 |
# License, or (at your option) any later version.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
c0ca71 |
# This program is distributed in the hope that it will be useful,
|
|
Alain Reguera Delgado |
c0ca71 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Alain Reguera Delgado |
c0ca71 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Alain Reguera Delgado |
c0ca71 |
# General Public License for more details.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
c0ca71 |
# You should have received a copy of the GNU General Public License
|
|
Alain Reguera Delgado |
c0ca71 |
# along with this program; if not, write to the Free Software
|
|
Alain Reguera Delgado |
c0ca71 |
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
c0ca71 |
# Alain Reguera Delgado <al@centos.org.cu>
|
|
Alain Reguera Delgado |
c0ca71 |
# 39 Street No. 4426 Cienfuegos, Cuba.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
f23b0d |
######################################################################
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
c0ca71 |
# Make a list of all the supported files inside the directory provided
|
|
Alain Reguera Delgado |
c0ca71 |
# as argument in the command-line. They it passed each file found to
|
|
Alain Reguera Delgado |
c0ca71 |
# files module, where they are processed one by one.
|
|
Alain Reguera Delgado |
f23b0d |
function directories {
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
local FILES=''
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
# Sanitate non-option arguments to be sure they match the
|
|
Alain Reguera Delgado |
f23b0d |
# directory conventions established by centos-art.sh script
|
|
Alain Reguera Delgado |
f23b0d |
# against source directory locations in the working copy.
|
|
Alain Reguera Delgado |
3a0a02 |
local DIRECTORY=$(tcar_checkWorkDirSource ${1})
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
# Define regular expression used by locale module to determine the
|
|
Alain Reguera Delgado |
f23b0d |
# file extension that it can retrieve translatable strings from,
|
|
Alain Reguera Delgado |
f23b0d |
# when a directory as argument is provided in the command-line.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
f23b0d |
# Don't include file extensions for script files here.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
f23b0d |
# Scripts files shouldn't be localized when a directory has been
|
|
Alain Reguera Delgado |
f23b0d |
# passed argument in the command-line because when we are
|
|
Alain Reguera Delgado |
f23b0d |
# processing directories, each file inside it is processed
|
|
Alain Reguera Delgado |
f23b0d |
# individually. For example, modules might involve several script
|
|
Alain Reguera Delgado |
f23b0d |
# files but they should have only one PO file for all the files
|
|
Alain Reguera Delgado |
f23b0d |
# they are made of. Using directory processing would create one
|
|
Alain Reguera Delgado |
f23b0d |
# PO file for each script file in the directory and that is what
|
|
Alain Reguera Delgado |
f23b0d |
# should not happen. For this reason don't include any file
|
|
Alain Reguera Delgado |
f23b0d |
# extension related to script files here.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
f23b0d |
# Don't include file extensions for asciidoc files here.
|
|
Alain Reguera Delgado |
f23b0d |
#
|
|
Alain Reguera Delgado |
f23b0d |
# Asciidoc documents need configuration files in order to be
|
|
Alain Reguera Delgado |
f23b0d |
# localized in coordination with render module. If you list
|
|
Alain Reguera Delgado |
f23b0d |
# asciidoc documents here, the configuration files won't be read
|
|
Alain Reguera Delgado |
f23b0d |
# and it will be localized in a way that may or may not match the
|
|
Alain Reguera Delgado |
f23b0d |
# way it is produced through render module.
|
|
Alain Reguera Delgado |
f23b0d |
local LOCALE_SUPPORTED_FILES='.+/.+\.(svgz|svg)$'
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
# Build list of supported files which locale module will extract
|
|
Alain Reguera Delgado |
f23b0d |
# translatable strings from.
|
|
Alain Reguera Delgado |
f23b0d |
if [[ ${LOCALE_FLAG_RECURSIVE} == 'true' ]];then
|
|
Alain Reguera Delgado |
dd8f6b |
FILES=$(tcar_getFilesList -t 'f' -p "${LOCALE_SUPPORTED_FILES}" ${DIRECTORY} \
|
|
Alain Reguera Delgado |
f23b0d |
| egrep "${TCAR_FLAG_FILTER}")
|
|
Alain Reguera Delgado |
f23b0d |
else
|
|
Alain Reguera Delgado |
dd8f6b |
FILES=$(tcar_getFilesList -i 1 -a 1 -t 'f' -p "${LOCALE_SUPPORTED_FILES}" ${DIRECTORY} \
|
|
Alain Reguera Delgado |
f23b0d |
| egrep "${TCAR_FLAG_FILTER}")
|
|
Alain Reguera Delgado |
f23b0d |
fi
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
# Verify found files. In case no file is found, print an error
|
|
Alain Reguera Delgado |
f23b0d |
# message describing it.
|
|
Alain Reguera Delgado |
f23b0d |
tcar_checkFiles -ef ${FILES}
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
# Execute files module to process files found, one by one.
|
|
Alain Reguera Delgado |
f23b0d |
for FILE in ${FILES};do
|
|
Alain Reguera Delgado |
f23b0d |
tcar_setModuleEnvironment -m 'files' -t 'sibling' -g ${FILE}
|
|
Alain Reguera Delgado |
f23b0d |
done
|
|
Alain Reguera Delgado |
f23b0d |
|
|
Alain Reguera Delgado |
f23b0d |
}
|