mirror of
https://github.com/YunoHost-Apps/fab-manager_ynh.git
synced 2024-09-03 18:36:16 +02:00
Update ynh_install_ruby__2 from mastodon
This commit is contained in:
parent
ea5e35b8ce
commit
4458ef45cd
1 changed files with 187 additions and 187 deletions
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
ynh_ruby_try_bash_extension() {
|
ynh_ruby_try_bash_extension() {
|
||||||
if [ -x src/configure ]; then
|
if [ -x src/configure ]; then
|
||||||
src/configure && make -C src || {
|
src/configure && make -C src || {
|
||||||
ynh_print_info --message="Optional bash extension failed to build, but things will still work normally."
|
ynh_print_info --message="Optional bash extension failed to build, but things will still work normally."
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,19 +36,19 @@ build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
|
||||||
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
|
# However, $PATH is duplicated into $ruby_path to outlast any manipulation of $PATH
|
||||||
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
|
# You can use the variable `$ynh_ruby_load_path` to quickly load your Ruby version
|
||||||
# in $PATH for an usage into a separate script.
|
# in $PATH for an usage into a separate script.
|
||||||
# Exemple: $ynh_ruby_load_path $final_path/script_that_use_gem.sh`
|
# Exemple: $ynh_ruby_load_path $install_dir/script_that_use_gem.sh`
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Finally, to start a Ruby service with the correct version, 2 solutions
|
# Finally, to start a Ruby service with the correct version, 2 solutions
|
||||||
# Either the app is dependent of Ruby or gem, but does not called it directly.
|
# Either the app is dependent of Ruby or gem, but does not called it directly.
|
||||||
# In such situation, you need to load PATH
|
# In such situation, you need to load PATH
|
||||||
# `Environment="__YNH_RUBY_LOAD_PATH__"`
|
# `Environment="__YNH_RUBY_LOAD_PATH__"`
|
||||||
# `ExecStart=__FINALPATH__/my_app`
|
# `ExecStart=__FINALPATH__/my_app`
|
||||||
# You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path
|
# You will replace __YNH_RUBY_LOAD_PATH__ with $ynh_ruby_load_path
|
||||||
#
|
#
|
||||||
# Or Ruby start the app directly, then you don't need to load the PATH variable
|
# Or Ruby start the app directly, then you don't need to load the PATH variable
|
||||||
# `ExecStart=__YNH_RUBY__ my_app run`
|
# `ExecStart=__YNH_RUBY__ my_app run`
|
||||||
# You will replace __YNH_RUBY__ with $ynh_ruby
|
# You will replace __YNH_RUBY__ with $ynh_ruby
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# one other variable is also available
|
# one other variable is also available
|
||||||
|
@ -58,32 +58,32 @@ build_pkg_dependencies="$build_pkg_dependencies $build_ruby_dependencies"
|
||||||
#
|
#
|
||||||
# Requires YunoHost version 3.2.2 or higher.
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
ynh_use_ruby () {
|
ynh_use_ruby () {
|
||||||
ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
|
ruby_version=$(ynh_app_setting_get --app=$app --key=ruby_version)
|
||||||
|
|
||||||
# Get the absolute path of this version of Ruby
|
# Get the absolute path of this version of Ruby
|
||||||
ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
ruby_path="$ruby_version_path/$YNH_APP_INSTANCE_NAME/bin"
|
||||||
|
|
||||||
# Allow alias to be used into bash script
|
# Allow alias to be used into bash script
|
||||||
shopt -s expand_aliases
|
shopt -s expand_aliases
|
||||||
|
|
||||||
# Create an alias for the specific version of Ruby and a variable as fallback
|
# Create an alias for the specific version of Ruby and a variable as fallback
|
||||||
ynh_ruby="$ruby_path/ruby"
|
ynh_ruby="$ruby_path/ruby"
|
||||||
alias ynh_ruby="$ynh_ruby"
|
alias ynh_ruby="$ynh_ruby"
|
||||||
# And gem
|
# And gem
|
||||||
ynh_gem="$ruby_path/gem"
|
ynh_gem="$ruby_path/gem"
|
||||||
alias ynh_gem="$ynh_gem"
|
alias ynh_gem="$ynh_gem"
|
||||||
|
|
||||||
# Load the path of this version of Ruby in $PATH
|
# Load the path of this version of Ruby in $PATH
|
||||||
if [[ :$PATH: != *":$ruby_path"* ]]; then
|
if [[ :$PATH: != *":$ruby_path"* ]]; then
|
||||||
PATH="$ruby_path:$PATH"
|
PATH="$ruby_path:$PATH"
|
||||||
fi
|
fi
|
||||||
# Create an alias to easily load the PATH
|
# Create an alias to easily load the PATH
|
||||||
ynh_ruby_load_path="PATH=$PATH"
|
ynh_ruby_load_path="PATH=$PATH"
|
||||||
|
|
||||||
# Sets the local application-specific Ruby version
|
# Sets the local application-specific Ruby version
|
||||||
pushd $final_path
|
pushd $install_dir
|
||||||
$rbenv_install_dir/bin/rbenv local $ruby_version
|
$rbenv_install_dir/bin/rbenv local $ruby_version
|
||||||
popd
|
popd
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install a specific version of Ruby
|
# Install a specific version of Ruby
|
||||||
|
@ -103,145 +103,145 @@ ynh_use_ruby () {
|
||||||
#
|
#
|
||||||
# Requires YunoHost version 3.2.2 or higher.
|
# Requires YunoHost version 3.2.2 or higher.
|
||||||
ynh_install_ruby () {
|
ynh_install_ruby () {
|
||||||
# Declare an array to define the options of this helper.
|
# Declare an array to define the options of this helper.
|
||||||
local legacy_args=v
|
local legacy_args=v
|
||||||
local -A args_array=( [v]=ruby_version= )
|
local -A args_array=( [v]=ruby_version= )
|
||||||
local ruby_version
|
local ruby_version
|
||||||
# Manage arguments with getopts
|
# Manage arguments with getopts
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
# Load rbenv path in PATH
|
# Load rbenv path in PATH
|
||||||
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
||||||
|
|
||||||
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
||||||
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
||||||
|
|
||||||
# Move an existing Ruby binary, to avoid to block rbenv
|
# Move an existing Ruby binary, to avoid to block rbenv
|
||||||
test -x /usr/bin/ruby && mv /usr/bin/ruby /usr/bin/ruby_rbenv
|
test -x /usr/bin/ruby && mv /usr/bin/ruby /usr/bin/ruby_rbenv
|
||||||
|
|
||||||
# Install or update rbenv
|
# Install or update rbenv
|
||||||
rbenv="$(command -v rbenv $rbenv_install_dir/bin/rbenv | grep "$rbenv_install_dir/bin/rbenv" | head -1)"
|
rbenv="$(command -v rbenv $rbenv_install_dir/bin/rbenv | grep "$rbenv_install_dir/bin/rbenv" | head -1)"
|
||||||
if [ -n "$rbenv" ]; then
|
if [ -n "$rbenv" ]; then
|
||||||
ynh_print_info --message="rbenv already seems installed in \`$rbenv'."
|
ynh_print_info --message="rbenv already seems installed in \`$rbenv'."
|
||||||
pushd "${rbenv%/*/*}"
|
pushd "${rbenv%/*/*}"
|
||||||
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/rbenv.git"; then
|
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/rbenv.git"; then
|
||||||
ynh_print_info --message="Trying to update with git..."
|
ynh_print_info --message="Trying to update with git..."
|
||||||
git pull -q --tags origin master
|
git pull -q --tags origin master
|
||||||
ynh_ruby_try_bash_extension
|
ynh_ruby_try_bash_extension
|
||||||
else
|
else
|
||||||
ynh_print_info --message="Reinstalling rbenv with git..."
|
ynh_print_info --message="Reinstalling rbenv with git..."
|
||||||
cd ..
|
cd ..
|
||||||
ynh_secure_remove --file=$rbenv_install_dir
|
ynh_secure_remove --file=$rbenv_install_dir
|
||||||
mkdir -p $rbenv_install_dir
|
mkdir -p $rbenv_install_dir
|
||||||
cd $rbenv_install_dir
|
cd $rbenv_install_dir
|
||||||
git init -q
|
git init -q
|
||||||
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
||||||
git checkout -q -b master origin/master
|
git checkout -q -b master origin/master
|
||||||
ynh_ruby_try_bash_extension
|
ynh_ruby_try_bash_extension
|
||||||
rbenv=$rbenv_install_dir/bin/rbenv
|
rbenv=$rbenv_install_dir/bin/rbenv
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
ynh_print_info --message="Installing rbenv with git..."
|
ynh_print_info --message="Installing rbenv with git..."
|
||||||
mkdir -p $rbenv_install_dir
|
mkdir -p $rbenv_install_dir
|
||||||
pushd $rbenv_install_dir
|
pushd $rbenv_install_dir
|
||||||
git init -q
|
git init -q
|
||||||
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
||||||
git checkout -q -b master origin/master
|
git checkout -q -b master origin/master
|
||||||
ynh_ruby_try_bash_extension
|
ynh_ruby_try_bash_extension
|
||||||
rbenv=$rbenv_install_dir/bin/rbenv
|
rbenv=$rbenv_install_dir/bin/rbenv
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ruby_build="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-install rbenv-install | head -1)"
|
ruby_build="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-install rbenv-install | head -1)"
|
||||||
if [ -n "$ruby_build" ]; then
|
if [ -n "$ruby_build" ]; then
|
||||||
ynh_print_info --message="\`rbenv install' command already available in \`$ruby_build'."
|
ynh_print_info --message="\`rbenv install' command already available in \`$ruby_build'."
|
||||||
pushd "${ruby_build%/*/*}"
|
pushd "${ruby_build%/*/*}"
|
||||||
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/ruby-build.git"; then
|
if git remote -v 2>/dev/null | grep "https://github.com/rbenv/ruby-build.git"; then
|
||||||
ynh_print_info --message="Trying to update rbenv with git..."
|
ynh_print_info --message="Trying to update rbenv with git..."
|
||||||
git pull -q origin master
|
git pull -q origin master
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
ynh_print_info --message="Installing ruby-build with git..."
|
ynh_print_info --message="Installing ruby-build with git..."
|
||||||
mkdir -p "${rbenv_install_dir}/plugins"
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
git clone -q https://github.com/rbenv/ruby-build.git "${rbenv_install_dir}/plugins/ruby-build"
|
git clone -q https://github.com/rbenv/ruby-build.git "${rbenv_install_dir}/plugins/ruby-build"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rbenv_alias="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-alias rbenv-alias | head -1)"
|
rbenv_alias="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-alias rbenv-alias | head -1)"
|
||||||
if [ -n "$rbenv_alias" ]; then
|
if [ -n "$rbenv_alias" ]; then
|
||||||
ynh_print_info --message="\`rbenv alias' command already available in \`$rbenv_alias'."
|
ynh_print_info --message="\`rbenv alias' command already available in \`$rbenv_alias'."
|
||||||
pushd "${rbenv_alias%/*/*}"
|
pushd "${rbenv_alias%/*/*}"
|
||||||
if git remote -v 2>/dev/null | grep "https://github.com/tpope/rbenv-aliases.git"; then
|
if git remote -v 2>/dev/null | grep "https://github.com/tpope/rbenv-aliases.git"; then
|
||||||
ynh_print_info --message="Trying to update rbenv-aliases with git..."
|
ynh_print_info --message="Trying to update rbenv-aliases with git..."
|
||||||
git pull -q origin master
|
git pull -q origin master
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
ynh_print_info --message="Installing rbenv-aliases with git..."
|
ynh_print_info --message="Installing rbenv-aliases with git..."
|
||||||
mkdir -p "${rbenv_install_dir}/plugins"
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
git clone -q https://github.com/tpope/rbenv-aliases.git "${rbenv_install_dir}/plugins/rbenv-aliase"
|
git clone -q https://github.com/tpope/rbenv-aliases.git "${rbenv_install_dir}/plugins/rbenv-aliase"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rbenv_latest="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-latest rbenv-latest | head -1)"
|
rbenv_latest="$(command -v "$rbenv_install_dir"/plugins/*/bin/rbenv-latest rbenv-latest | head -1)"
|
||||||
if [ -n "$rbenv_latest" ]; then
|
if [ -n "$rbenv_latest" ]; then
|
||||||
ynh_print_info --message="\`rbenv latest' command already available in \`$rbenv_latest'."
|
ynh_print_info --message="\`rbenv latest' command already available in \`$rbenv_latest'."
|
||||||
pushd "${rbenv_latest%/*/*}"
|
pushd "${rbenv_latest%/*/*}"
|
||||||
if git remote -v 2>/dev/null | grep "https://github.com/momo-lab/xxenv-latest.git"; then
|
if git remote -v 2>/dev/null | grep "https://github.com/momo-lab/xxenv-latest.git"; then
|
||||||
ynh_print_info --message="Trying to update xxenv-latest with git..."
|
ynh_print_info --message="Trying to update xxenv-latest with git..."
|
||||||
git pull -q origin master
|
git pull -q origin master
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
ynh_print_info --message="Installing xxenv-latest with git..."
|
ynh_print_info --message="Installing xxenv-latest with git..."
|
||||||
mkdir -p "${rbenv_install_dir}/plugins"
|
mkdir -p "${rbenv_install_dir}/plugins"
|
||||||
git clone -q https://github.com/momo-lab/xxenv-latest.git "${rbenv_install_dir}/plugins/xxenv-latest"
|
git clone -q https://github.com/momo-lab/xxenv-latest.git "${rbenv_install_dir}/plugins/xxenv-latest"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enable caching
|
# Enable caching
|
||||||
mkdir -p "${rbenv_install_dir}/cache"
|
mkdir -p "${rbenv_install_dir}/cache"
|
||||||
|
|
||||||
# Create shims directory if needed
|
# Create shims directory if needed
|
||||||
mkdir -p "${rbenv_install_dir}/shims"
|
mkdir -p "${rbenv_install_dir}/shims"
|
||||||
|
|
||||||
# Restore /usr/local/bin in PATH
|
# Restore /usr/local/bin in PATH
|
||||||
PATH=$CLEAR_PATH
|
PATH=$CLEAR_PATH
|
||||||
|
|
||||||
# And replace the old Ruby binary
|
# And replace the old Ruby binary
|
||||||
test -x /usr/bin/ruby_rbenv && mv /usr/bin/ruby_rbenv /usr/bin/ruby
|
test -x /usr/bin/ruby_rbenv && mv /usr/bin/ruby_rbenv /usr/bin/ruby
|
||||||
|
|
||||||
# Install the requested version of Ruby
|
# Install the requested version of Ruby
|
||||||
local final_ruby_version=$(rbenv latest --print $ruby_version)
|
local final_ruby_version=$(rbenv latest --print $ruby_version)
|
||||||
if ! [ -n "$final_ruby_version" ]; then
|
if ! [ -n "$final_ruby_version" ]; then
|
||||||
final_ruby_version=$ruby_version
|
final_ruby_version=$ruby_version
|
||||||
fi
|
fi
|
||||||
ynh_print_info --message="Installing Ruby-$final_ruby_version"
|
ynh_print_info --message="Installing Ruby-$final_ruby_version"
|
||||||
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
|
CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $final_ruby_version > /dev/null 2>&1
|
||||||
|
|
||||||
# Store ruby_version into the config of this app
|
# Store ruby_version into the config of this app
|
||||||
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
|
ynh_app_setting_set --app=$YNH_APP_INSTANCE_NAME --key=ruby_version --value=$final_ruby_version
|
||||||
|
|
||||||
# Remove app virtualenv
|
# Remove app virtualenv
|
||||||
if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
|
if `rbenv alias --list | grep --quiet "$YNH_APP_INSTANCE_NAME " 1>/dev/null 2>&1`
|
||||||
then
|
then
|
||||||
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create app virtualenv
|
# Create app virtualenv
|
||||||
rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
|
rbenv alias $YNH_APP_INSTANCE_NAME $final_ruby_version
|
||||||
|
|
||||||
# Cleanup Ruby versions
|
# Cleanup Ruby versions
|
||||||
ynh_cleanup_ruby
|
ynh_cleanup_ruby
|
||||||
|
|
||||||
# Set environment for Ruby users
|
# Set environment for Ruby users
|
||||||
echo "#rbenv
|
echo "#rbenv
|
||||||
export RBENV_ROOT=$rbenv_install_dir
|
export RBENV_ROOT=$rbenv_install_dir
|
||||||
export PATH=\"$rbenv_install_dir/bin:$PATH\"
|
export PATH=\"$rbenv_install_dir/bin:$PATH\"
|
||||||
eval \"\$(rbenv init -)\"
|
eval \"\$(rbenv init -)\"
|
||||||
#rbenv" > /etc/profile.d/rbenv.sh
|
#rbenv" > /etc/profile.d/rbenv.sh
|
||||||
|
|
||||||
# Load the environment
|
# Load the environment
|
||||||
eval "$(rbenv init -)"
|
eval "$(rbenv init -)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove the version of Ruby used by the app.
|
# Remove the version of Ruby used by the app.
|
||||||
|
@ -250,21 +250,21 @@ eval \"\$(rbenv init -)\"
|
||||||
#
|
#
|
||||||
# usage: ynh_remove_ruby
|
# usage: ynh_remove_ruby
|
||||||
ynh_remove_ruby () {
|
ynh_remove_ruby () {
|
||||||
local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
|
local ruby_version=$(ynh_app_setting_get --app=$YNH_APP_INSTANCE_NAME --key=ruby_version)
|
||||||
|
|
||||||
# Load rbenv path in PATH
|
# Load rbenv path in PATH
|
||||||
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
local CLEAR_PATH="$rbenv_install_dir/bin:$PATH"
|
||||||
|
|
||||||
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
# Remove /usr/local/bin in PATH in case of Ruby prior installation
|
||||||
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
PATH=$(echo $CLEAR_PATH | sed 's@/usr/local/bin:@@')
|
||||||
|
|
||||||
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
rbenv alias $YNH_APP_INSTANCE_NAME --remove
|
||||||
|
|
||||||
# Remove the line for this app
|
# Remove the line for this app
|
||||||
ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
|
ynh_app_setting_delete --app=$YNH_APP_INSTANCE_NAME --key=ruby_version
|
||||||
|
|
||||||
# Cleanup Ruby versions
|
# Cleanup Ruby versions
|
||||||
ynh_cleanup_ruby
|
ynh_cleanup_ruby
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove no more needed versions of Ruby used by the app.
|
# Remove no more needed versions of Ruby used by the app.
|
||||||
|
@ -276,35 +276,35 @@ ynh_remove_ruby () {
|
||||||
# usage: ynh_cleanup_ruby
|
# usage: ynh_cleanup_ruby
|
||||||
ynh_cleanup_ruby () {
|
ynh_cleanup_ruby () {
|
||||||
|
|
||||||
# List required Ruby versions
|
# List required Ruby versions
|
||||||
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
|
local installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
|
||||||
local required_ruby_versions=""
|
local required_ruby_versions=""
|
||||||
for installed_app in $installed_apps
|
for installed_app in $installed_apps
|
||||||
do
|
do
|
||||||
local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
|
local installed_app_ruby_version=$(ynh_app_setting_get --app=$installed_app --key="ruby_version")
|
||||||
if [[ $installed_app_ruby_version ]]
|
if [[ $installed_app_ruby_version ]]
|
||||||
then
|
then
|
||||||
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
|
required_ruby_versions="${installed_app_ruby_version}\n${required_ruby_versions}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Remove no more needed Ruby versions
|
# Remove no more needed Ruby versions
|
||||||
local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/')
|
local installed_ruby_versions=$(rbenv versions --bare --skip-aliases | grep -Ev '/')
|
||||||
for installed_ruby_version in $installed_ruby_versions
|
for installed_ruby_version in $installed_ruby_versions
|
||||||
do
|
do
|
||||||
if ! `echo ${required_ruby_versions} | grep "${installed_ruby_version}" 1>/dev/null 2>&1`
|
if ! `echo ${required_ruby_versions} | grep "${installed_ruby_version}" 1>/dev/null 2>&1`
|
||||||
then
|
then
|
||||||
ynh_print_info --message="Removing of Ruby-$installed_ruby_version"
|
ynh_print_info --message="Removing of Ruby-$installed_ruby_version"
|
||||||
$rbenv_install_dir/bin/rbenv uninstall --force $installed_ruby_version
|
$rbenv_install_dir/bin/rbenv uninstall --force $installed_ruby_version
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If none Ruby version is required
|
# If none Ruby version is required
|
||||||
if [[ ! $required_ruby_versions ]]
|
if [[ ! $required_ruby_versions ]]
|
||||||
then
|
then
|
||||||
# Remove rbenv environment configuration
|
# Remove rbenv environment configuration
|
||||||
ynh_print_info --message="Removing of rbenv-$rbenv_version"
|
ynh_print_info --message="Removing of rbenv-$rbenv_version"
|
||||||
ynh_secure_remove --file="$rbenv_install_dir"
|
ynh_secure_remove --file="$rbenv_install_dir"
|
||||||
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
ynh_secure_remove --file="/etc/profile.d/rbenv.sh"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue