From befbcfd90c4fbbdc3cc3fa3a083ff6868a2bfb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Tue, 12 Dec 2023 14:47:15 +0100 Subject: [PATCH] [rubygems/rubygems] Explain the 3 states `options[:user_install]` can have. This was issue previously, so hopefully this comment tries to state this explicitly for future readers. https://github.com/rubygems/rubygems/commit/8ccd830f85 --- lib/rubygems/installer.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index acb49f510a..cd1031dc2e 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -680,6 +680,10 @@ class Gem::Installer unless @gem_home # `--build-root` overrides `--user-install` and auto-user-install if @build_root.nil? + # Please note that `options[:user_install]` might have three states: + # * `true`: `--user-install` + # * `false`: `--no-user-install` and + # * `nil`: option was not specified if options[:user_install] @gem_home = Gem.user_dir elsif options[:user_install].nil? && !ENV.key?("GEM_HOME") && (File.exist?(Gem.dir) && !File.writable?(Gem.dir))