From d842554769157087f23459e8f0ef9eec8fd7b7fe Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Thu, 2 Jan 2025 10:44:54 +0900 Subject: [PATCH] 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. --- tool/rbinstall.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index d00d3ff69c..b9df7c070c 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -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