aboutsummaryrefslogtreecommitdiff
path: root/src/ruby/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ruby/install.sh')
-rwxr-xr-xsrc/ruby/install.sh16
1 files changed, 12 insertions, 4 deletions
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