rbinstall.rb: Note about no_write [ci skip]

Since RubyGems 3.0.0 `dir_mode` option is supported, but using `File`
method to apply it, not `FileUtils`.  To reduce overwriting existing
methods (especially built-in class), and to record making directories,
keep using `no_write` method.
This commit is contained in:
Nobuyoshi Nakada 2025-01-02 10:44:54 +09:00
parent 51952929e1
commit d842554769
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -527,6 +527,8 @@ module RbInstall
const_set(:FileUtils, fu::NoWrite)
fu
end
# RubyGems 3.0.0 or later supports `dir_mode`, but it uses
# `File` method to apply it, not `FileUtils`.
dir_mode = options.delete(:dir_mode) if options
end
yield
@ -806,6 +808,7 @@ def install_default_gem(dir, srcdir, bindir)
install_dir = with_destdir(gem_dir)
prepare "default gems from #{dir}", gem_dir
RbInstall.no_write do
# Record making directories
makedirs(Gem.ensure_default_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)})
end
@ -1103,6 +1106,7 @@ install?(:ext, :comm, :gem, :'bundled-gems') do
install_dir = with_destdir(gem_dir)
prepare "bundled gems", gem_dir
RbInstall.no_write do
# Record making directories
makedirs(Gem.ensure_gem_subdirectories(install_dir, $dir_mode).map {|d| File.join(gem_dir, d)})
end