Skip to content

Commit

Permalink
Simplified to find gemspecs for bundled gems (ruby#12709)
Browse files Browse the repository at this point in the history
* Simplified to find gemspecs for bundled gems

Co-authored-by: Nobuyoshi Nakada <[email protected]>
  • Loading branch information
hsbt and nobu authored Feb 7, 2025
1 parent 8dbbc79 commit 7178593
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions tool/rbinstall.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1138,21 +1138,18 @@ class << (w = [])
next unless /^(\S+)\s+(\S+).*/ =~ name
gem = $1
gem_name = "#$1-#$2"
# Try to find the original gemspec file
path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem}.gemspec"
unless File.exist?(path)
# Try to find the gemspec file for C ext gems
path = [
# gemspec that removed duplicated dependencies of bundled gems
"#{srcdir}/.bundle/gems/#{gem_name}/#{gem}.gemspec",
# gemspec for C ext gems, It has the original dependencies
# ex .bundle/gems/debug-1.7.1/debug-1.7.1.gemspec
# This gemspec keep the original dependencies
path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec"
unless File.exist?(path)
# Try to find the gemspec file for gems that hasn't own gemspec
path = "#{srcdir}/.bundle/specifications/#{gem_name}.gemspec"
unless File.exist?(path)
skipped[gem_name] = "gemspec not found"
next
end
end
"#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec",
# original gemspec generated by rubygems
"#{srcdir}/.bundle/specifications/#{gem_name}.gemspec"
].find { |gemspec| File.exist?(gemspec) }
if path.nil?
skipped[gem_name] = "gemspec not found"
next
end
spec = load_gemspec(path, "#{srcdir}/.bundle/gems/#{gem_name}")
unless spec.platform == Gem::Platform::RUBY
Expand Down

0 comments on commit 7178593

Please sign in to comment.