summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2024-03-20 17:17:40 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-03-25 11:55:08 +0900
commit2dd2204d8cac9ffb25cbd415fabaf315e0c7e839 (patch)
treedcacd970b3c4df1a0209e20487021631ec580e60
parent083e7080d19a5f6489cae5a060c533ea1932de75 (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 1a5119d87e..c5ee78cc79 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -586,7 +586,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
@@ -598,7 +602,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"
@@ -613,6 +617,10 @@ module RbInstall
files
end
+
+ def root
+ "#{srcdir}/lib"
+ end
end
end
end