diff options
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-x | tool/rbinstall.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index 7d22a83431..97cde087c6 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb @@ -871,7 +871,7 @@ install?(:ext, :arch, :gem, :'default-gems', :'default-gems-arch') do install_default_gem('ext', srcdir) end -def load_gemspec(file) +def load_gemspec(file, expanded = false) file = File.realpath(file) code = File.read(file, encoding: "utf-8:-") code.gsub!(/`git.*?`/m, '""') @@ -881,6 +881,18 @@ def load_gemspec(file) raise TypeError, "[#{file}] isn't a Gem::Specification (#{spec.class} instead)." end spec.loaded_from = file + + # gather expanded bundled gem files + if expanded + base = File.dirname(file) + Dir.glob("**/*", File::FNM_DOTMATCH, base: base) do |n| + next if n.start_with?(".git") # git related files are useless + case File.basename(n); when ".", ".."; next; end + next if File.directory?(File.join(base, n)) + spec.files << n + end + end + spec end @@ -955,7 +967,7 @@ install?(:ext, :comm, :gem, :'bundled-gems') do gem_name = "#$1-#$2" path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec" next unless File.exist?(path) - spec = load_gemspec(path) + spec = load_gemspec(path, true) next unless spec.platform == Gem::Platform::RUBY next unless spec.full_name == gem_name spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" |