Existing code from lib/rubygems/config_file.rb:
def credentials_path
File.join Gem.user_home, '.gem', 'credentials'
end
permissions = 0600 & (~File.umask)
File.open(credentials_path, 'w', permissions) do |f|
f.write config.to_yaml
end
The above doesn't deal with existing credentials
files with 0644 permissions. Would something along these lines be able to go somewhere reasonable to update existing credentials
to 0600?:
if File.exist? credentials_path
unless File.stat(credentials_path).mode.to_s(8).end_with? '0600'
File.chmod 0600, credentials_path
end
end