[rubygems/rubygems] Dump RbConfig elements to escape special characters

Naively embed strings do not work if special characters (newline,
backslahes and so on) are contained.

https://github.com/rubygems/rubygems/commit/ac2c4c4af1
This commit is contained in:
Nobuyoshi Nakada 2024-06-19 18:19:16 +09:00 committed by git
parent 2ccd5f8cef
commit 378e65af9a

View File

@ -323,10 +323,10 @@ install:
end
RUBY
RbConfig::CONFIG.each do |k, v|
f.puts %(RbConfig::CONFIG["#{k}"] = "#{v}")
f.puts %(RbConfig::CONFIG[#{k.dump}] = #{v.dump})
end
RbConfig::MAKEFILE_CONFIG.each do |k, v|
f.puts %(RbConfig::MAKEFILE_CONFIG["#{k}"] = "#{v}")
f.puts %(RbConfig::MAKEFILE_CONFIG[#{k.dump}] = #{v.dump})
end
f.puts "RbConfig::CONFIG['host_os'] = 'fake_os'"
f.puts "RbConfig::CONFIG['arch'] = 'fake_arch'"