diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-04-17 13:44:17 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-19 06:56:13 +0000 |
commit | 6f50ecfe664924c086879273a29a2ecea9e51683 () | |
tree | 3b3e2c0f0a753f6500e80c11ef4b5f46744129c7 /lib/rubygems/config_file.rb | |
parent | 628e432739e1d2578d357420aa652a97eb8c2649 (diff) |
[rubygems/rubygems] Try to use pure-ruby YAML serializer for configuration
https://.com/rubygems/rubygems/commit/3268d40974
-rw-r--r-- | lib/rubygems/config_file.rb | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -324,11 +324,11 @@ if you believe they were disclosed to a third party. require "fileutils" FileUtils.mkdir_p(dirname) - Gem.load_yaml permissions = 0o600 & (~File.umask) File.open(credentials_path, "w", permissions) do |f| - f.write config.to_yaml end load_api_keys # reload @@ -344,15 +344,14 @@ if you believe they were disclosed to a third party. end def load_file(filename) - Gem.load_yaml yaml_errors = [ArgumentError] - yaml_errors << Psych::SyntaxError if defined?(Psych::SyntaxError) return {} unless filename && !filename.empty? && File.exist?(filename) begin - content = Gem::SafeYAML.load(File.read(filename)) unless content.is_a? Hash warn "Failed to load #{filename} because it doesn't contain valid YAML hash" return {} @@ -487,7 +486,7 @@ if you believe they were disclosed to a third party. yaml_hash[key.to_s] = value end - yaml_hash.to_yaml end # Writes out this config file, replacing its source. |