Merge pull request #290 from TouchInstinct/fix/php_not_found
Add user enviroment for localization script
This commit is contained in:
commit
6bc60ac0ab
|
|
@ -1,3 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Description:
|
||||
# Add user defined enviroment if programm not found
|
||||
#
|
||||
|
|
@ -14,7 +16,19 @@
|
|||
|
||||
function source_home_file {
|
||||
file="$HOME/$1"
|
||||
[[ -f "${file}" ]] && source "${file}"
|
||||
|
||||
if [[ -f "${file}" ]]; then
|
||||
if ! source "${file}"; then
|
||||
export_commands="$(cat "${file}" | grep "^export PATH=")"
|
||||
|
||||
while read export_command
|
||||
do
|
||||
eval "$export_command"
|
||||
done <<< "$export_commands"
|
||||
fi
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# Use specific exec due to Xcode has custom value of $PATH
|
||||
|
|
|
|||
|
|
@ -19,18 +19,29 @@
|
|||
# . localization.sh common/strings Resources/Localization/ .main
|
||||
#
|
||||
|
||||
readonly EXIT_SUCCESS=0
|
||||
readonly EXIT_FAILURE=1
|
||||
|
||||
. ${SCRIPT_DIR}/../aux_scripts/install_env.sh php
|
||||
|
||||
STRINGS_FOLDER=${1:-"common/strings"}
|
||||
LOCALIZATION_PATH=${2:-"${PRODUCT_NAME}/Resources/Localization/"}
|
||||
BUNDLE=${3:-".main"}
|
||||
|
||||
if ! [ -e ${LOCALIZATION_PATH} ]; then
|
||||
echo "${LOCALIZATION_PATH} path does not exist. Add these folders and try again."
|
||||
exit 1
|
||||
exit ${EXIT_FAILURE}
|
||||
fi
|
||||
|
||||
if ! [ -e "${STRINGS_FOLDER}" ]; then
|
||||
echo "${STRINGS_FOLDER} path does not exist. Submodule with strings should be named common and contain strings folder."
|
||||
exit 1
|
||||
exit ${EXIT_FAILURE}
|
||||
fi
|
||||
|
||||
php ${SCRIPT_DIR}/../aux_scripts/import_strings.php ${LOCALIZATION_PATH} ${STRINGS_FOLDER} ${BUNDLE}
|
||||
if which php >/dev/null; then
|
||||
php ${SCRIPT_DIR}/../aux_scripts/import_strings.php ${LOCALIZATION_PATH} ${STRINGS_FOLDER} ${BUNDLE}
|
||||
else
|
||||
echo "warning: php not installed, install using 'brew install php'"
|
||||
|
||||
exit ${EXIT_FAILURE}
|
||||
fi
|
||||
Loading…
Reference in New Issue