[rubygems/rubygems] Add credentials file path to "gem env".

There are 3 possible locations:

- $HOME/.gem/credentials
- $XDG_DATA_HOME/gem/credentials
- $HOME/.local/share/gem/credentials

https://github.com/rubygems/rubygems/commit/c51756b96e
This commit is contained in:
Ellen Marie Dash 2024-12-31 17:04:16 -05:00 committed by git
parent 2da91080d3
commit d96cc52ef1

View File

@ -15,6 +15,7 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
version display the gem format version version display the gem format version
remotesources display the remote gem servers remotesources display the remote gem servers
platform display the supported gem platforms platform display the supported gem platforms
credentials display the path where credentials are stored
<omitted> display everything <omitted> display everything
EOF EOF
args.gsub(/^\s+/, "") args.gsub(/^\s+/, "")
@ -88,6 +89,8 @@ lib/rubygems/defaults/operating_system.rb
Gem.sources.to_a.join("\n") Gem.sources.to_a.join("\n")
when /^platform/ then when /^platform/ then
Gem.platforms.join(File::PATH_SEPARATOR) Gem.platforms.join(File::PATH_SEPARATOR)
when /^credentials/, /^creds/ then
Gem.configuration.credentials_path
when nil then when nil then
show_environment show_environment
else else
@ -114,6 +117,8 @@ lib/rubygems/defaults/operating_system.rb
out << " - USER INSTALLATION DIRECTORY: #{Gem.user_dir}\n" out << " - USER INSTALLATION DIRECTORY: #{Gem.user_dir}\n"
out << " - CREDENTIALS FILE: #{Gem.configuration.credentials_path}\n"
out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil? out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
out << " - RUBY EXECUTABLE: #{Gem.ruby}\n" out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"