From d29a76b90bae06cbad72bf9d14ff5581206e6f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Tue, 25 Jun 2024 14:24:09 +0200 Subject: [PATCH] [rubygems/rubygems] Only override `pre_install_checks` when necessary RubyGems >= 3.5 no longer raises `Gem::FilePermissionError` explicitly. https://github.com/rubygems/rubygems/commit/df54b9fd90 --- lib/bundler/rubygems_gem_installer.rb | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/bundler/rubygems_gem_installer.rb b/lib/bundler/rubygems_gem_installer.rb index aee908c47e..10c2da1781 100644 --- a/lib/bundler/rubygems_gem_installer.rb +++ b/lib/bundler/rubygems_gem_installer.rb @@ -48,12 +48,14 @@ module Bundler spec end - def pre_install_checks - super - rescue Gem::FilePermissionError - # Ignore permission checks in RubyGems. Instead, go on, and try to write - # for real. We properly handle permission errors when they happen. - nil + if Bundler.rubygems.provides?("< 3.5") + def pre_install_checks + super + rescue Gem::FilePermissionError + # Ignore permission checks in RubyGems. Instead, go on, and try to write + # for real. We properly handle permission errors when they happen. + nil + end end def generate_plugins