diff options
author | Benoit Daloze <eregontp@gmail.com> | 2018-09-09 16:46:40 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2018-09-09 16:50:54 +0200 |
commit | 667ba5b82139e776c331f3459c1ec6b5a9f5096f (patch) | |
tree | 29c8b583d7c6dcca1077fdc15523575dd9d00c79 | |
parent | 0aa5ea78c0d6cc1b843aeab603182c0d301203f2 (diff) | |
download | bundler-667ba5b82139e776c331f3459c1ec6b5a9f5096f.tar.gz |
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 https://github.com/bundler/bundler/issues/6163 and
https://github.com/rubinius/rubinius/issues/3769.
-rw-r--r-- | lib/bundler/deprecate.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bundler/deprecate.rb b/lib/bundler/deprecate.rb index 387f632a39..f59533630e 100644 --- a/lib/bundler/deprecate.rb +++ b/lib/bundler/deprecate.rb @@ -8,7 +8,8 @@ rescue LoadError 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 |