summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2023-12-12 14:47:15 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-13 12:16:55 +0900
commitbefbcfd90c4fbbdc3cc3fa3a083ff6868a2bfb02 (patch)
tree3c5ae6ed94096e2c7dac598f3938be352d94b86b
parent1fa5dd883e286a768a9dfa82ef3de562fcdabd01 (diff)
[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
-rw-r--r--lib/rubygems/installer.rb4
1 files changed, 4 insertions, 0 deletions
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))