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

Commit

Permalink
Auto merge of #6692 - eregon:simplify-autoload-require-deprecate, r=s…
Browse files Browse the repository at this point in the history
…egiddins

Check that Bundler::Deprecate is not an autoload constant

* Otherwise, it should be defined by this file.
* The issue is bundler/deprecate.rb checks `defined? Bundler::Deprecate`
  and this would normally return true since an autoload is defined for
  that constant. But since the autoload file is #require-d explicitly
  (by bundler/psyched_yaml and bundler/shared_helpers), MRI makes it
  undefined to save this pattern. This however requires a complex
  autoload implementation and is confusing to debug, so let's simplify.
* Related to #6163 and rubinius/rubinius#3769.

### What was the end-user problem that led to this PR?

Bundler fails in TruffleRuby without this change.
We plan to fix this case in TruffleRuby, but since at least 2 Ruby implementations did not expect such a corner case, we should make the code simpler since it's easy enough in this case.

### What was your diagnosis of the problem?

See above.

### Why did you choose this fix out of the possible options?

It's simple and does not break if an extra `require "bundler/deprecate"` is later added in the codebase.
  • Loading branch information
bundlerbot committed Sep 10, 2018
2 parents 0aa5ea7 + 667ba5b commit 02af3c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/bundler/deprecate.rb
Expand Up @@ -8,7 +8,8 @@
end

module Bundler
if defined? Bundler::Deprecate
# If Bundler::Deprecate is an autoload constant, we need to define it
if defined?(Bundler::Deprecate) && !autoload?(:Deprecate)
# nothing to do!
elsif defined? ::Deprecate
Deprecate = ::Deprecate
Expand Down

0 comments on commit 02af3c2

Please sign in to comment.