aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ruby/devcontainer-feature.json2
-rwxr-xr-xsrc/ruby/install.sh16
2 files changed, 13 insertions, 5 deletions
diff --git a/src/ruby/devcontainer-feature.json b/src/ruby/devcontainer-feature.json
index fdf8b26..29591e6 100644
--- a/src/ruby/devcontainer-feature.json
+++ b/src/ruby/devcontainer-feature.json
@@ -1,6 +1,6 @@
{
"id": "ruby",
- "version": "1.1.0",
+ "version": "1.1.1",
"name": "Ruby (via rvm)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/ruby",
"description": "Installs Ruby, rvm, rbenv, common Ruby utilities, and needed dependencies.",
diff --git a/src/ruby/install.sh b/src/ruby/install.sh
index 0871085..2b47d8a 100755
--- a/src/ruby/install.sh
+++ b/src/ruby/install.sh
@@ -177,9 +177,11 @@ fi
find_version_from_git_tags RUBY_VERSION "https://github.com/ruby/ruby" "tags/v" "_"
# Just install Ruby if RVM already installed
-if [ $(rvm --version) != "" ]; then
+if rvm --version > /dev/null; then
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."
su ${USERNAME} -c "rvm install ruby ${RUBY_VERSION}"
fi
@@ -191,6 +193,9 @@ else
# Determine appropriate settings for rvm installer
if [ "${RUBY_VERSION}" = "none" ]; then
RVM_INSTALL_ARGS=""
+ elif [[ "$(ruby -v)" = *"${RUBY_VERSION}"* ]]; then
+ echo "(!) Ruby is already installed with version ${RUBY_VERSION}. Skipping..."
+ RVM_INSTALL_ARGS=""
else
if [ "${RUBY_VERSION}" = "latest" ] || [ "${RUBY_VERSION}" = "current" ] || [ "${RUBY_VERSION}" = "lts" ]; then
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
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/"
chmod -R g+r+w "/home/${USERNAME}/.rbenv"
find "/home/${USERNAME}/.rbenv" -type d | xargs -n 1 chmod g+s