diff --git a/src/usr/local/containerbase/tools/v2/ruby.sh b/src/usr/local/containerbase/tools/v2/ruby.sh index eba3e14962..69a6870b88 100644 --- a/src/usr/local/containerbase/tools/v2/ruby.sh +++ b/src/usr/local/containerbase/tools/v2/ruby.sh @@ -3,7 +3,7 @@ function prepare_tool() { local version_codename local tool_path - local cp_home + local path version_codename="$(get_distro)" case "${version_codename}" in @@ -23,18 +23,35 @@ function prepare_tool() { ; tool_path=$(create_tool_path) + # Redirect gemrc + path="$(get_home_path)/.gemrc" { - printf -- "gem: --bindir %s/bin --no-document\n" "${USER_HOME}" - } > "${USER_HOME}"/.gemrc - chown -R "${USER_ID}" "${USER_HOME}"/.gemrc - chmod -R g+w "${USER_HOME}"/.gemrc + printf -- "gem: --no-document\n" + } > "${path}" + chown "${USER_ID}" "${path}" + chmod g+w "${path}" + ln -sf "${path}" "${USER_HOME}/.gemrc" + + # Redirect gem home + path="$(get_home_path)/.gem" + create_folder "${path}" 775 + chown "${USER_ID}" "${path}" + chmod g+w "${path}" + ln -sf "${path}" "${USER_HOME}/.gem" # Redirect cocoapods home - cp_home="$(get_home_path)/.cocoapods" - create_folder "${cp_home}" 775 - chown "${USER_ID}" "${cp_home}" - chmod g+w "${cp_home}" - ln -sf "${cp_home}" "${USER_HOME}/.cocoapods" + path="$(get_home_path)/.cocoapods" + create_folder "${path}" 775 + chown "${USER_ID}" "${path}" + chmod g+w "${path}" + ln -sf "${path}" "${USER_HOME}/.cocoapods" + + # Redirect Library home + path="$(get_home_path)/Library" + create_folder "${path}" 775 + chown "${USER_ID}" "${path}" + chmod g+w "${path}" + ln -sf "${path}" "${USER_HOME}/Library" # Workaround for compatibillity for Ruby hardcoded paths if [ "${tool_path}" != "${ROOT_DIR_LEGACY}/ruby" ]; then @@ -76,7 +93,7 @@ function install_tool () { # System settings mkdir -p "$versioned_tool_path/etc" { - printf -- "gem: --bindir /usr/local/bin --no-document\n" + printf -- "gem: --no-document\n" printf -- ":benchmark: false\n" printf -- ":verbose: true\n" printf -- ":update_sources: true\n" diff --git a/test/ruby/Dockerfile b/test/ruby/Dockerfile index c59d018316..e936a6cfd0 100644 --- a/test/ruby/Dockerfile +++ b/test/ruby/Dockerfile @@ -34,36 +34,6 @@ FROM base AS build # renovate: datasource=github-releases packageName=containerbase/ruby-prebuild RUN install-tool ruby 3.3.3 -#-------------------------------------- -# test: bundler (gem) -#-------------------------------------- -FROM build AS test-bundler-a - -ENV PATH=/home/ubuntu/bin:$PATH - -# fix perms -RUN chown -R 1005:0 /test - -# openshift -USER 1005 - -RUN ruby --version -RUN gem env - -# renovate: datasource=rubygems depName=bundler -ENV BUNDLER_VERSION=2.5.14 -RUN gem install bundler -v $BUNDLER_VERSION - -RUN bundle env - -RUN set -ex; \ - [ "$(command -v bundle)" = "/home/${USER_NAME}/bin/bundle" ] && echo "works" || exit 1; \ - bundler env - -RUN set -ex; \ - cd a; \ - bundler lock - #-------------------------------------- # test: global bundler #-------------------------------------- @@ -89,7 +59,6 @@ RUN ruby --version #-------------------------------------- FROM build AS test-bundler-c - USER 1000 # renovate: datasource=rubygems depName=bundler @@ -108,6 +77,11 @@ RUN set -ex; \ cd a; \ bundler lock; +RUN set -ex; \ +ls -la $USER_HOME; \ +ls -la $USER_HOME/.gem/; \ +true + #-------------------------------------- # test: bundler install root - install rootless #-------------------------------------- @@ -145,6 +119,13 @@ RUN set -ex; \ cd b/Project; \ pod install; +RUN set -ex; \ + ls -la $USER_HOME; \ + ls -la $USER_HOME/.gem/; \ + ls -la $USER_HOME/.cocoapods/; \ + ls -la $USER_HOME/Library/; \ + true + #-------------------------------------- # test: install-gem #-------------------------------------- @@ -163,7 +144,6 @@ RUN rake --help #-------------------------------------- FROM base -COPY --from=test-bundler-a /.dummy /.dummy COPY --from=test-bundler-b /.dummy /.dummy COPY --from=test-bundler-c /.dummy /.dummy COPY --from=test-bundler-d /.dummy /.dummy