diff options
author | Hiroshi SHIBATA <[email protected]> | 2023-04-18 09:51:06 +0900 |
---|---|---|
committer | git <[email protected]> | 2023-04-19 06:56:21 +0000 |
commit | 644d7df021e17c70932da3173ec309ae1c8063d5 () | |
tree | 8a352701847bc182417c8b6c7ed2298e91f722f5 /lib/rubygems/config_file.rb | |
parent | 45655089dac2f7ac5684f99607698d9eb6dae5d5 (diff) |
[rubygems/rubygems] Introduce self.dump_with_rubygems_yaml
https://.com/rubygems/rubygems/commit/3d3b0d80a1
-rw-r--r-- | lib/rubygems/config_file.rb | 24 |
1 files changed, 11 insertions, 13 deletions
@@ -320,19 +320,13 @@ if you believe they were disclosed to a third party. config = load_file(credentials_path).merge(host => api_key) - config.transform_keys! do |k| - k.is_a?(Symbol) ? ":#{k}" : k - end - dirname = File.dirname credentials_path require "fileutils" FileUtils.mkdir_p(dirname) - require "bundler/yaml_serializer" - permissions = 0o600 & (~File.umask) File.open(credentials_path, "w", permissions) do |f| - f.write Bundler::YAMLSerializer.dump(config) end load_api_keys # reload @@ -492,12 +486,7 @@ if you believe they were disclosed to a third party. yaml_hash[key.to_s] = value end - yaml_hash.transform_keys! do |k| - k.is_a?(Symbol) ? ":#{k}" : k - end - - require "bundler/yaml_serializer" - Bundler::YAMLSerializer.dump(yaml_hash) end # Writes out this config file, replacing its source. @@ -532,6 +521,15 @@ if you believe they were disclosed to a third party. attr_reader :hash protected :hash def self.convert_rubygems_config_hash(content) content.transform_keys! do |k| if k.match?(/\A:(.*)\Z/) |