mirror of
https://github.com/YunoHost-Apps/discourse_ynh.git
synced 2024-09-03 18:26:18 +02:00
manage previous rbenv instllations
This commit is contained in:
parent
2128978f4c
commit
29be65c72e
1 changed files with 16 additions and 9 deletions
|
@ -166,7 +166,7 @@ ynh_maintenance_mode_OFF () {
|
||||||
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 || {
|
||||||
echo "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
|
||||||
}
|
}
|
||||||
|
@ -247,9 +247,6 @@ ynh_use_ruby () {
|
||||||
#
|
#
|
||||||
# ynh_install_ruby will install the version of Ruby provided as argument by using rbenv.
|
# ynh_install_ruby will install the version of Ruby provided as argument by using rbenv.
|
||||||
#
|
#
|
||||||
# rbenv (Ruby Version Management) stores the target Ruby version in a .ruby_version file created in the target folder (using rbenv local <version>)
|
|
||||||
# It then uses that information for every Ruby user that uses rbenv provided Ruby command
|
|
||||||
#
|
|
||||||
# This helper creates a /etc/profile.d/rbenv.sh that configures PATH environment for rbenv
|
# This helper creates a /etc/profile.d/rbenv.sh that configures PATH environment for rbenv
|
||||||
# for every LOGIN user, hence your user must have a defined shell (as opposed to /usr/sbin/nologin)
|
# for every LOGIN user, hence your user must have a defined shell (as opposed to /usr/sbin/nologin)
|
||||||
#
|
#
|
||||||
|
@ -279,16 +276,26 @@ ynh_install_ruby () {
|
||||||
# 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
|
||||||
|
|
||||||
# Instal or update rbenv
|
# Install or update rbenv
|
||||||
rbenv="$(command -v rbenv $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 -q rbenv; then
|
if git remote -v 2>/dev/null | grep -q "origin https://github.com/rbenv/rbenv.git"; then
|
||||||
echo "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
|
||||||
cd ..
|
|
||||||
ynh_ruby_try_bash_extension
|
ynh_ruby_try_bash_extension
|
||||||
|
else
|
||||||
|
ynh_print_info --message="Reinstalling rbenv with git..."
|
||||||
|
cd ..
|
||||||
|
ynh_secure_remove --file=$rbenv_install_dir
|
||||||
|
mkdir -p $rbenv_install_dir
|
||||||
|
cd $rbenv_install_dir
|
||||||
|
git init -q
|
||||||
|
git remote add -f -t master origin https://github.com/rbenv/rbenv.git > /dev/null 2>&1
|
||||||
|
git checkout -q -b master origin/master
|
||||||
|
ynh_ruby_try_bash_extension
|
||||||
|
rbenv=$rbenv_install_dir/bin/rbenv
|
||||||
fi
|
fi
|
||||||
popd
|
popd
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue