diff --git a/tools/unix/generate_localizations.sh b/tools/unix/generate_localizations.sh index 03bb1bb175..e4e83f71d4 100755 --- a/tools/unix/generate_localizations.sh +++ b/tools/unix/generate_localizations.sh @@ -1,7 +1,9 @@ #!/bin/bash set -euxo pipefail -# Use ruby from brew on Mac OS X, because system ruby is outdated/broken/will be removed in future releases. +OMIM_PATH="$(dirname "$0")/../.." + +# Use correct ruby version from homebrew for MacOS case $OSTYPE in darwin*) if [ -x /usr/local/opt/ruby/bin/ruby ]; then @@ -19,9 +21,9 @@ case $OSTYPE in fi ;; esac -OMIM_PATH="$(dirname "$0")/../.." TWINE_SUBMODULE=tools/twine TWINE_PATH="$OMIM_PATH/$TWINE_SUBMODULE" +GEM_PATH="$OMIM_PATH/$TWINE_SUBMODULE/gem" if [ ! -e "$TWINE_PATH/twine" ]; then echo "You need to have twine submodule present to run this script" @@ -29,10 +31,14 @@ if [ ! -e "$TWINE_PATH/twine" ]; then exit 1 fi +# Always run gem install to use the latest version +gem install twine --install-dir $GEM_PATH + TWINE_COMMIT="$(git -C $TWINE_SUBMODULE rev-parse HEAD)" TWINE_GEM="twine-$TWINE_COMMIT.gem" -if [ ! -f "$TWINE_PATH/$TWINE_GEM" ] || ! gem list -i twine; then +# If twine gem does not exist, then install it +if [ ! -f "$GEM_PATH/$TWINE_GEM" ] || ! gem list -i twine; then echo "Building & installing twine gem..." ( cd "$TWINE_PATH" \