Files
runner-images/images/ubuntu/scripts/build/install-ruby.sh
T

64 lines
2.3 KiB
Bash
Raw Normal View History

2020-10-07 13:49:40 +05:00
#!/bin/bash -e
################################################################################
2023-11-22 21:49:23 +01:00
## File: install-ruby.sh
## Desc: Install Ruby requirements and ruby gems
################################################################################
2023-12-29 12:36:27 +01:00
# Source the helpers for use with the script
source $HELPER_SCRIPTS/os.sh
2020-11-27 10:52:00 +03:00
source $HELPER_SCRIPTS/install.sh
2021-02-19 18:33:28 +03:00
apt-get install ruby-full
# temporary fix for fastlane installation https://github.com/sporkmonger/addressable/issues/541
if is_ubuntu20; then
gem install public_suffix -v 5.1.1
fi
2021-02-19 18:33:28 +03:00
# Install ruby gems from toolset
2023-12-29 12:36:27 +01:00
gems_to_install=$(get_toolset_value ".rubygems[] .name")
if [[ -n "$gems_to_install" ]]; then
for gem in $gems_to_install; do
2021-02-19 18:33:28 +03:00
echo "Installing gem $gem"
gem install $gem
2021-02-19 18:33:28 +03:00
done
fi
2020-01-20 16:39:06 +03:00
# Install Ruby requirements
2024-05-29 13:43:07 +02:00
apt-get install libz-dev openssl libssl-dev
2020-11-27 10:52:00 +03:00
echo "Install Ruby from toolset..."
2023-12-29 12:36:27 +01:00
package_tar_names=$(curl -fsSL "https://api.github.com/repos/ruby/ruby-builder/releases/latest" | jq -r '.assets[].name')
toolset_versions=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .versions[]')
platform_version=$(get_toolset_value '.toolcache[] | select(.name | contains("Ruby")) | .platform_version')
ruby_path="$AGENT_TOOLSDIRECTORY/Ruby"
2020-11-27 10:52:00 +03:00
echo "Check if Ruby hostedtoolcache folder exist..."
2023-12-29 12:36:27 +01:00
if [[ ! -d $ruby_path ]]; then
mkdir -p $ruby_path
2020-11-27 10:52:00 +03:00
fi
2023-12-29 12:36:27 +01:00
for toolset_version in ${toolset_versions[@]}; do
package_tar_name=$(echo "$package_tar_names" | grep "^ruby-${toolset_version}-ubuntu-${platform_version}.tar.gz$" | sort -V | tail -1)
ruby_version=$(echo "$package_tar_name" | cut -d'-' -f 2)
ruby_version_path="$ruby_path/$ruby_version"
2020-11-27 10:52:00 +03:00
2023-12-29 12:36:27 +01:00
echo "Create Ruby $ruby_version directory..."
mkdir -p $ruby_version_path
2020-11-27 10:52:00 +03:00
2023-12-29 12:36:27 +01:00
echo "Downloading tar archive $package_tar_name"
download_url="https://github.com/ruby/ruby-builder/releases/download/toolcache/${package_tar_name}"
package_archive_path=$(download_with_retry "$download_url")
2020-11-27 10:52:00 +03:00
2023-12-29 12:36:27 +01:00
echo "Expand '$package_tar_name' to the '$ruby_version_path' folder"
tar xf "$package_archive_path" -C $ruby_version_path
2020-11-27 10:52:00 +03:00
2023-12-29 12:36:27 +01:00
complete_file_path="$ruby_version_path/x64.complete"
if [[ ! -f $complete_file_path ]]; then
2020-11-27 10:52:00 +03:00
echo "Create complete file"
2023-12-29 12:36:27 +01:00
touch $complete_file_path
2020-11-27 10:52:00 +03:00
fi
2021-02-19 18:33:28 +03:00
done
2023-11-22 21:49:23 +01:00
invoke_tests "Tools" "Ruby"