summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-04-23 19:16:06 +0900
committerGitHub <noreply@github.com>2020-04-23 19:16:06 +0900
commit5c6269c4593f8b1a83b72e157c460dd2b37338c7 (patch)
treed179fbf295790b083035ddaf454f1db4b4982986 /lib/rubygems.rb
parentf563f3c5ef517b62f1a95ab03286335e4fe72314 (diff)
Support XDG_* (#2174)
* Support XDG_CONFIG_HOME for gemrc. * Support XDG_DATA_HOME for .gem * Added test for XDG_DATA_HOME * Do not reuse environmental variable. * Unify .rdoc path to RDoc.home. * Support XDG_DATA_HOME for .rdoc * Ignore exists? * Extracted config_home path * Use XDG_CONFIG_HOME for default credential path * Fixed inconsistency location. * Fixed the broken tests. * Support XDG_CONFIG_HOME for irbrc * Introduce Gem.cache_home as XDG_CACHE_HOME * Use Gem.cache_home instead of Gem.config_home for the credential file of RubyGems. * Initialized the old configurations * Fixed test failure related the configuration initialization * restore XDG_DATA_HOME * Fixed the broken examples of bundler with XDG_* * Do not modify environmental variable on test file * Use XDG_DATA_HOME insted of XDG_CACHE_HOME for credential file * stub out Gem.data_home * Move dir accessor to defaults.rb file * Use XDG_DATA_HOME for signed gem features * Use XDG_DATA_HOME for spec cache * Do not rely on Gem.user_home * Gem.user_home is always exists. Don't need to use FileUitls.mkdir_p * Bump support version to RubyGems 3.2.0+ * Removed the needless fallback configuration * Fixed the inconsistency methods that are find_config_file and config_file * Use Gem.configuration.credentials_path instead of hard-coded path * gem_path is always provided * Removed the duplicated code of find_home * Also removed the duplicated code of user_home * use Gem::UNTAINT instead of untaint for surpressing the warnings * Use File.directory * Restore XDG_DATA_HOME * Use File.write
Notes
Notes: Merged-By: hsbt <hsbt@ruby-lang.org>
Diffstat (limited to 'lib/rubygems.rb')
-rw-r--r--lib/rubygems.rb41
1 files changed, 0 insertions, 41 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 73321ec47b..5026fc41e6 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -338,13 +338,6 @@ module Gem
end
##
- # The path to standard location of the user's .gemrc file.
-
- def self.config_file
- @config_file ||= File.join Gem.user_home, '.gemrc'
- end
-
- ##
# The standard configuration object for gems.
def self.configuration
@@ -558,33 +551,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
##
- # Finds the user's home directory.
- #--
- # Some comments from the ruby-talk list regarding finding the home
- # directory:
- #
- # I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems
- # to be depending on HOME in those code samples. I propose that
- # it should fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at
- # least on Win32).
- #++
- #--
- #
- #++
-
- def self.find_home
- Dir.home.dup
- rescue
- if Gem.win_platform?
- File.expand_path File.join(ENV['HOMEDRIVE'] || ENV['SystemDrive'], '/')
- else
- File.expand_path "/"
- end
- end
-
- private_class_method :find_home
-
- ##
# Top level install helper method. Allows you to install gems interactively:
#
# % irb
@@ -1057,13 +1023,6 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
##
- # The home directory for the user.
-
- def self.user_home
- @user_home ||= find_home.tap(&Gem::UNTAINT)
- end
-
- ##
# Is this a windows platform?
def self.win_platform?