summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2024-03-20 17:17:40 +0100
committerTakashi Kokubun <takashikkbn@gmail.com>2024-05-28 13:30:26 -0700
commite60ad0b6f5ba9ad2da83472049cd7dd6f830139e (patch)
treea791f82b4ed9532059dc99f2feffa93d02b56b00
parent642cf3fc8a0f7c31875d4bbc3628f835ebfc48a5 (diff)
Extract `root` helper
It holds the root directory for each type of default gem (ext/ or lib/).
-rwxr-xr-xtool/rbinstall.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 6b93b189c2..e5ea4e4fc7 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -782,7 +782,11 @@ module RbInstall
end
def makefile_dir
- File.expand_path("#{$ext_build_dir}/#{relative_base}", srcdir)
+ "#{root}/#{relative_base}"
+ end
+
+ def root
+ File.expand_path($ext_build_dir, srcdir)
end
end
@@ -794,7 +798,7 @@ module RbInstall
if m = /.*(?=-(.*)\z)/.match(gemname)
base = File.join(base, *m.to_a.select {|n| !base.include?(n)})
end
- files = Dir.glob("#{base}{.rb,/**/*.rb}", base: "#{srcdir}/lib")
+ files = Dir.glob("#{base}{.rb,/**/*.rb}", base: root)
if !relative_base and files.empty? # no files at the toplevel
# pseudo gem like ruby2_keywords
files << "#{gemname}.rb"
@@ -809,6 +813,10 @@ module RbInstall
files
end
+
+ def root
+ "#{srcdir}/lib"
+ end
end
end
end