Skip to content

Commit

Permalink
[rubygems/rubygems] Explain the 3 states options[:user_install] can…
Browse files Browse the repository at this point in the history
… have.

This was issue previously, so hopefully this comment tries to state this
explicitly for future readers.

rubygems/rubygems@8ccd830f85
  • Loading branch information
voxik authored and hsbt committed Dec 13, 2023
1 parent 1fa5dd8 commit befbcfd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/rubygems/installer.rb
Expand Up @@ -680,6 +680,10 @@ def process_options # :nodoc:
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))
Expand Down

0 comments on commit befbcfd

Please sign in to comment.