Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Bypass recursive RubyGems require #4973

Closed

Conversation

aycabta
Copy link
Contributor

@aycabta aycabta commented Sep 12, 2016

I fixed a bug that I reported for Rake test problem.

First, Bundler::Plugin uses cascading autoload for Bundler::Plugin::API and Bundler::Plugin::API::Source.

Secondly, Bundler uses monkey patch for RubyGems loading logic, thus Gem::Specification#full_gem_path is overridden.

Next, if a module is loaded by require in RubyGems with Bundler's monkey patch, the Gem::Specification#full_gem_path that uses Bundler::Plugin::API::Source is called in it. But bundler/plugin/api/source uses require before Bundler::Plugin::API::Source is defined. RubyGems loading logic runs again by the require. Bundler::Plugin::API::Source is not defined yet. Gem::Specification#full_gem_path is called again, and it uses Bundler::Plugin::API::Source. The autoload is skipped after 2nd call. So exception is occurred.

NameError: uninitialized constant Bundler::Plugin::API::Source

This Pull Request bypasses the recursive RubyGems require.

@segiddins
Copy link
Member

If this fixes a bug, could you see if it's possible to add test coverage? Thanks!

@aycabta
Copy link
Contributor Author

aycabta commented Sep 14, 2016

#4981 is better then this Pull Request for this problem.

@aycabta aycabta closed this Sep 14, 2016
@aycabta aycabta deleted the bypass-recursive-rubygems-require branch February 7, 2019 05:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants