diff --git a/lib/rubygems/install_update_options.rb b/lib/rubygems/install_update_options.rb index 15b0860fc9..5c7289426e 100644 --- a/lib/rubygems/install_update_options.rb +++ b/lib/rubygems/install_update_options.rb @@ -185,24 +185,9 @@ module Gem::InstallUpdateOptions # Default options for the gem install and update commands. def install_update_options - default_options = { + { :document => %w[ri], } - - # If Gem.paths.home exists, but we can't write to it, - # fall back to a user installation. - if File.exist?(Gem.paths.home) && !File.writable?(Gem.paths.home) - default_options[:user_install] = true - - alert_warning "The default GEM_HOME (#{Gem.paths.home}) is not" \ - " writable, so rubygems is falling back to installing" \ - " under your home folder. To get rid of this warning" \ - " permanently either fix your GEM_HOME folder permissions" \ - " or add the following to your ~/.gemrc file:\n" \ - " gem: --user-install" - end - - default_options end ## diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb index b596b4f6b8..310d6a0669 100644 --- a/lib/rubygems/path_support.rb +++ b/lib/rubygems/path_support.rb @@ -32,6 +32,19 @@ class Gem::PathSupport @home = expand(@home) + # If @home (aka Gem.paths.home) exists, but we can't write to it, + # fall back to Gem.user_dir (the directory used for user installs). + if File.exist?(@home) && !File.writable?(@home) + warn "The default GEM_HOME (#{@home}) is not" \ + " writable, so rubygems is falling back to installing" \ + " under your home folder. To get rid of this warning" \ + " permanently either fix your GEM_HOME folder permissions" \ + " or add the following to your ~/.gemrc file:\n" \ + " gem: --install-dir #{Gem.user_dir}" + + @home = Gem.user_dir + end + @path = split_gem_path env["GEM_PATH"], @home @spec_cache_dir = env["GEM_SPEC_CACHE"] || Gem.default_spec_cache_dir