mirror of
https://github.com/Llewellynvdm/Joomla-XML-Lang-stream.git
synced 2024-12-18 03:24:08 +00:00
Code formating
This commit is contained in:
parent
d82aa6d4db
commit
91c09b5d1b
66
run.sh
66
run.sh
@ -25,18 +25,17 @@ function main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# now get the mapper data
|
# now get the mapper data
|
||||||
while IFS=$'\t' read -r -a row
|
while IFS=$'\t' read -r -a row; do
|
||||||
do
|
[[ "$row" =~ ^#.*$ ]] && continue
|
||||||
[[ "$row" =~ ^#.*$ ]] && continue
|
# set the url
|
||||||
# set the url
|
|
||||||
URL_MAIN_LANG="${STREAM_ENDPOINT}&${URL_VERSION_KEY}=${row[0]}"
|
URL_MAIN_LANG="${STREAM_ENDPOINT}&${URL_VERSION_KEY}=${row[0]}"
|
||||||
# set the path
|
# set the path
|
||||||
PATH_MAIN_FILE="${TARGET_FOLDER}${row[1]}.xml"
|
PATH_MAIN_FILE="${TARGET_FOLDER}${row[1]}.xml"
|
||||||
# get the main translation file of this version
|
# get the main translation file of this version
|
||||||
showMessage "Downloading: ${URL_MAIN_LANG}\nStoring@: ${PATH_MAIN_FILE}"
|
showMessage "Downloading: ${URL_MAIN_LANG}\nStoring@: ${PATH_MAIN_FILE}"
|
||||||
# do the work now
|
# do the work now
|
||||||
wget -q "${URL_MAIN_LANG}" --output-document="${PATH_MAIN_FILE}"
|
wget -q "${URL_MAIN_LANG}" --output-document="${PATH_MAIN_FILE}"
|
||||||
# now get each translation pack
|
# now get each translation pack
|
||||||
while readXML; do
|
while readXML; do
|
||||||
# get the language tag
|
# get the language tag
|
||||||
LANG=$(getElement)
|
LANG=$(getElement)
|
||||||
@ -49,19 +48,18 @@ function main() {
|
|||||||
# set the path
|
# set the path
|
||||||
PATH_FILE="${PATH_LANG}/${LANG}_details.xml"
|
PATH_FILE="${PATH_LANG}/${LANG}_details.xml"
|
||||||
# get the language pack file
|
# get the language pack file
|
||||||
showMessage "Downloading: ${URL_LANG}\nStoring@: ${PATH_FILE}"
|
showMessage "Downloading: ${URL_LANG}\nStoring@: ${PATH_FILE}"
|
||||||
# make sure the directory is set
|
# make sure the directory is set
|
||||||
mkdir -p "${PATH_LANG}"
|
mkdir -p "${PATH_LANG}"
|
||||||
# do the work now
|
# do the work now
|
||||||
wget -q "${URL_LANG}" --output-document="${PATH_FILE}"
|
wget -q "${URL_LANG}" --output-document="${PATH_FILE}"
|
||||||
fi
|
fi
|
||||||
done < "${PATH_MAIN_FILE}"
|
done <"${PATH_MAIN_FILE}"
|
||||||
done < "$REPO_MAPPER"
|
done <"$REPO_MAPPER"
|
||||||
# check if we should update the repo
|
# check if we should update the repo
|
||||||
if (("$PUSH" == 1)); then
|
if (("$PUSH" == 1)); then
|
||||||
# we first check if there are changes
|
# we first check if there are changes
|
||||||
if [[ -z $(git status --porcelain) ]];
|
if [[ -z $(git status --porcelain) ]]; then
|
||||||
then
|
|
||||||
echo "Nothing to commit here"
|
echo "Nothing to commit here"
|
||||||
else
|
else
|
||||||
# make sure all new files are added and others removed where needed
|
# make sure all new files are added and others removed where needed
|
||||||
@ -71,7 +69,7 @@ function main() {
|
|||||||
# now push changes up to github...
|
# now push changes up to github...
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# show completion message
|
# show completion message
|
||||||
completedBuildMessage
|
completedBuildMessage
|
||||||
exit 0
|
exit 0
|
||||||
@ -99,21 +97,21 @@ function completedBuildMessage() {
|
|||||||
|
|
||||||
# our XML helpers
|
# our XML helpers
|
||||||
# https://stackoverflow.com/a/7052168/1429677
|
# https://stackoverflow.com/a/7052168/1429677
|
||||||
function readXML () {
|
function readXML() {
|
||||||
local IFS=\>
|
local IFS=\>
|
||||||
read -d \< ENTITY CONTENT
|
read -d \< ENTITY CONTENT
|
||||||
local ret=$?
|
local ret=$?
|
||||||
TAG_NAME=${ENTITY%% *}
|
TAG_NAME=${ENTITY%% *}
|
||||||
ATTRIBUTES=${ENTITY#* }
|
ATTRIBUTES=${ENTITY#* }
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
function getElement () {
|
function getElement() {
|
||||||
if [[ $TAG_NAME = "extension" ]] ; then
|
if [[ $TAG_NAME == "extension" ]]; then
|
||||||
eval local $ATTRIBUTES
|
eval local $ATTRIBUTES
|
||||||
echo "$element"
|
echo "$element"
|
||||||
else
|
else
|
||||||
echo ''
|
echo ''
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# set any/all default config property
|
# set any/all default config property
|
||||||
@ -239,9 +237,9 @@ while :; do
|
|||||||
--dry)
|
--dry)
|
||||||
DRYRUN=1
|
DRYRUN=1
|
||||||
;;
|
;;
|
||||||
--push)
|
--push)
|
||||||
PUSH=1
|
PUSH=1
|
||||||
;;
|
;;
|
||||||
--version-key) # Takes an option argument; ensure it has been specified.
|
--version-key) # Takes an option argument; ensure it has been specified.
|
||||||
if [ "$2" ]; then
|
if [ "$2" ]; then
|
||||||
URL_VERSION_KEY=$2
|
URL_VERSION_KEY=$2
|
||||||
|
Loading…
Reference in New Issue
Block a user