Ruby Feature [bug fix] : Fails if the dev container has the same ruby version installed (#609)
* Ruby Feature [bug fix] : Fails if the dev container has the same ruby version installed * add comment * remove scenario
This commit is contained in:
parent
f90cb26c7f
commit
1d1a23625d
2 changed files with 13 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"id": "ruby",
|
"id": "ruby",
|
||||||
"version": "1.1.0",
|
"version": "1.1.1",
|
||||||
"name": "Ruby (via rvm)",
|
"name": "Ruby (via rvm)",
|
||||||
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
|
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
|
||||||
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
|
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
|
||||||
|
|
|
@ -177,9 +177,11 @@ fi
|
||||||
find_version_from_git_tags RUBY_VERSION "https://github.com/ruby/ruby" "tags/v" "_"
|
find_version_from_git_tags RUBY_VERSION "https://github.com/ruby/ruby" "tags/v" "_"
|
||||||
|
|
||||||
# Just install Ruby if RVM already installed
|
# Just install Ruby if RVM already installed
|
||||||
if [ $(rvm --version) != "" ]; then
|
if rvm --version > /dev/null; then
|
||||||
echo "Ruby Version Manager already exists."
|
echo "Ruby Version Manager already exists."
|
||||||
if [ "${RUBY_VERSION}" != "none" ]; then
|
if [[ "$(ruby -v)" = *"${RUBY_VERSION}"* ]]; then
|
||||||
|
echo "(!) Ruby is already installed with version ${RUBY_VERSION}. Skipping..."
|
||||||
|
elif [ "${RUBY_VERSION}" != "none" ]; then
|
||||||
echo "Installing specified Ruby version."
|
echo "Installing specified Ruby version."
|
||||||
su ${USERNAME} -c "rvm install ruby ${RUBY_VERSION}"
|
su ${USERNAME} -c "rvm install ruby ${RUBY_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
@ -191,6 +193,9 @@ else
|
||||||
# Determine appropriate settings for rvm installer
|
# Determine appropriate settings for rvm installer
|
||||||
if [ "${RUBY_VERSION}" = "none" ]; then
|
if [ "${RUBY_VERSION}" = "none" ]; then
|
||||||
RVM_INSTALL_ARGS=""
|
RVM_INSTALL_ARGS=""
|
||||||
|
elif [[ "$(ruby -v)" = *"${RUBY_VERSION}"* ]]; then
|
||||||
|
echo "(!) Ruby is already installed with version ${RUBY_VERSION}. Skipping..."
|
||||||
|
RVM_INSTALL_ARGS=""
|
||||||
else
|
else
|
||||||
if [ "${RUBY_VERSION}" = "latest" ] || [ "${RUBY_VERSION}" = "current" ] || [ "${RUBY_VERSION}" = "lts" ]; then
|
if [ "${RUBY_VERSION}" = "latest" ] || [ "${RUBY_VERSION}" = "current" ] || [ "${RUBY_VERSION}" = "lts" ]; then
|
||||||
RVM_INSTALL_ARGS="--ruby"
|
RVM_INSTALL_ARGS="--ruby"
|
||||||
|
@ -273,8 +278,11 @@ if [ "${SKIP_RBENV_RBUILD}" != "true" ]; then
|
||||||
ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
|
ln -s /usr/local/share/ruby-build /home/${USERNAME}/.rbenv/plugins/ruby-build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s /usr/local/rvm/rubies/default/bin/ruby /usr/local/rvm/gems/default/bin
|
# Oryx expects ruby to be installed in this specific path, else it breaks the oryx magic for ruby projects.
|
||||||
|
if [ ! -f /usr/local/rvm/gems/default/bin/ruby ]; then
|
||||||
|
ln -s /usr/local/rvm/rubies/default/bin/ruby /usr/local/rvm/gems/default/bin
|
||||||
|
fi
|
||||||
|
|
||||||
chown -R "${USERNAME}:rvm" "/home/${USERNAME}/.rbenv/"
|
chown -R "${USERNAME}:rvm" "/home/${USERNAME}/.rbenv/"
|
||||||
chmod -R g+r+w "/home/${USERNAME}/.rbenv"
|
chmod -R g+r+w "/home/${USERNAME}/.rbenv"
|
||||||
find "/home/${USERNAME}/.rbenv" -type d | xargs -n 1 chmod g+s
|
find "/home/${USERNAME}/.rbenv" -type d | xargs -n 1 chmod g+s
|
||||||
|
|
Loading…
Reference in a new issue