summaryrefslogtreecommitdiff
path: root/lib/rubygems/defaults.rb
diff options
context:
space:
mode:
authorJosef Šimánek <josef.simanek@gmail.com>2022-10-29 02:47:14 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-11-11 17:24:08 +0900
commit7ce0f81fbbd9c2b35e9fe35f5ef040626e284a88 (patch)
tree7bad4d0b3734a3c075b489cf6bcb53adbefcebbf /lib/rubygems/defaults.rb
parentc7d043065c058f20ce30c61bb3ce127cb15cc0a8 (diff)
[rubygems/rubygems] Use file in XDG_STATE_HOME directory to store last update check timestamp.
https://github.com/rubygems/rubygems/commit/0fbc4ace8a
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6715
Diffstat (limited to 'lib/rubygems/defaults.rb')
-rw-r--r--lib/rubygems/defaults.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index e12c13cb46..8daff0bc30 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -134,6 +134,13 @@ module Gem
end
##
+ # The path to standard location of the user's state file.
+
+ def self.state_file
+ @state_file ||= File.join(Gem.state_home, "gem", "last_update_check").tap(&Gem::UNTAINT)
+ end
+
+ ##
# The path to standard location of the user's cache directory.
def self.cache_home
@@ -148,6 +155,13 @@ module Gem
end
##
+ # The path to standard location of the user's state directory.
+
+ def self.state_home
+ @data_home ||= (ENV["XDG_STATE_HOME"] || File.join(Gem.user_home, ".local", "state"))
+ end
+
+ ##
# How String Gem paths should be split. Overridable for esoteric platforms.
def self.path_separator