Simplify FileCollector interface

This commit is contained in:
David Rodriguez 2024-03-20 17:10:36 +01:00 коммит произвёл Hiroshi SHIBATA
Родитель 348d8bdb0e
Коммит 1e6117d665
1 изменённых файлов: 4 добавлений и 10 удалений

Просмотреть файл

@ -553,12 +553,10 @@ module RbInstall
end end
class Ext < self class Ext < self
def skip_install?(files)
# install ext only when it's configured
!File.exist?("#{makefile_dir}/Makefile")
end
def ruby_libraries def ruby_libraries
# install ext only when it's configured
return [] unless File.exist?("#{makefile_dir}/Makefile")
Dir.glob("lib/**/*.rb", base: makefile_dir) Dir.glob("lib/**/*.rb", base: makefile_dir)
end end
@ -570,10 +568,6 @@ module RbInstall
end end
class Lib < self class Lib < self
def skip_install?(files)
files.empty?
end
def ruby_libraries def ruby_libraries
gemname = File.basename(gemspec, ".gemspec") gemname = File.basename(gemspec, ".gemspec")
base = relative_base || gemname base = relative_base || gemname
@ -763,7 +757,7 @@ def install_default_gem(dir, srcdir, bindir)
spec = load_gemspec("#{base}/#{src}") spec = load_gemspec("#{base}/#{src}")
file_collector = RbInstall::Specs::FileCollector.for(srcdir, dir, src) file_collector = RbInstall::Specs::FileCollector.for(srcdir, dir, src)
files = file_collector.collect files = file_collector.collect
if file_collector.skip_install?(files) if files.empty?
next next
end end
spec.files = files spec.files = files